2.2 KiB
2.2 KiB
Developer Guide for sgl-kernel
Development Environment Setup
Use Docker to set up the development environment. See Docker setup guide.
Create and enter development container:
docker run -itd --shm-size 32g --gpus all -v $HOME/.cache:/root/.cache --ipc=host --name sglang_zhyncs lmsysorg/sglang:dev /bin/zsh
docker exec -it sglang_zhyncs /bin/zsh
Project Structure
Dependencies
Third-party libraries:
Kernel Development
Steps to add a new kernel:
- Implement in src/sgl-kernel/csrc/
- Expose interface in csrc/sgl_kernel_ops.cu with pybind11
- Create Python wrapper in src/sgl-kernel/ops/__init__.py
- Expose Python interface in src/sgl-kernel/__init__.py
- Update setup.py to include new CUDA source
Build & Install
Development build:
make build
pip3 install dist/*whl --force-reinstall --no-deps
# Or use: make install (runs pip install -e .)
Testing & Benchmarking
- Add pytest tests in tests/
- Add benchmarks using triton benchmark in benchmark/
- Run test suite
Release new version
Update version in pyproject.toml and version.py