Files
sglang/sgl-kernel/developer_guide.md

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:

  1. Implement in src/sgl-kernel/csrc/
  2. Expose interface in csrc/sgl_kernel_ops.cu with pybind11
  3. Create Python wrapper in src/sgl-kernel/ops/__init__.py
  4. Expose Python interface in src/sgl-kernel/__init__.py
  5. 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

  1. Add pytest tests in tests/
  2. Add benchmarks using triton benchmark in benchmark/
  3. Run test suite

Release new version

Update version in pyproject.toml and version.py