Skip to content

Commit a547aad

Browse files
authored
docs: add developer guide for sgl-kernel (sgl-project#3068)
1 parent ea535dc commit a547aad

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

sgl-kernel/developer_guide.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Developer Guide for sgl-kernel
2+
3+
## Development Environment Setup
4+
5+
Use Docker to set up the development environment. See [Docker setup guide](https://github.com/sgl-project/sglang/blob/main/docs/developer/development_guide_using_docker.md#setup-docker-container).
6+
7+
Create and enter development container:
8+
```bash
9+
docker run -itd --shm-size 32g --gpus all -v $HOME/.cache:/root/.cache --ipc=host --name sglang_zhyncs lmsysorg/sglang:dev /bin/zsh
10+
docker exec -it sglang_zhyncs /bin/zsh
11+
```
12+
13+
## Project Structure
14+
15+
### Dependencies
16+
17+
Third-party libraries:
18+
19+
- [CCCL](https://github.com/NVIDIA/cccl)
20+
- [CUTLASS](https://github.com/NVIDIA/cutlass)
21+
- [FlashInfer](https://github.com/flashinfer-ai/flashinfer)
22+
23+
### Kernel Development
24+
25+
Steps to add a new kernel:
26+
27+
1. Implement in `sgl-kernel/src/sgl-kernel/csrc`
28+
2. Expose interface in `sgl-kernel/csrc/sgl_kernel_ops.cu` with pybind11
29+
3. Create Python wrapper in `sgl-kernel/src/sgl-kernel/ops/__init__.py`
30+
4. Expose Python interface in `sgl-kernel/src/sgl-kernel/__init__.py`
31+
32+
### Build & Install
33+
34+
Development build:
35+
36+
```bash
37+
make build
38+
pip3 install dist/*whl --force-reinstall --no-deps
39+
# Or use: make install (runs pip install -e .)
40+
```
41+
42+
### Testing & Benchmarking
43+
44+
1. Add pytest tests in `sgl-kernel/tests/`
45+
2. Add benchmarks using [triton benchmark](https://triton-lang.org/main/python-api/generated/triton.testing.Benchmark.html) in `sgl-kernel/benchmark/`
46+
3. Run test suite

0 commit comments

Comments
 (0)