Co-authored-by: yinfan.1024 <yinfan.1024@bytedance.com> Co-authored-by: yinfan98 <1106110035@qq.com> Co-authored-by: Yineng Zhang <me@zhyncs.com>
2.3 KiB
2.3 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 src/sgl-kernel/include/sgl_kernel_ops.h
- Create torch extension in src/sgl-kernel/torch_extension.cc
- 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
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