Skip to main content

Kernel Library for SGLang

Project description

SGL Kernel

Kernel Library for SGLang

PyPI

Installation

For CUDA 11.8:

pip3 install sgl-kernel -i https://docs.sglang.ai/whl/cu118

For CUDA 12.1 or CUDA 12.4:

pip3 install sgl-kernel

Developer Guide

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 src/sgl-kernel/include/sgl_kernels_ops.h
  3. Create torch extension in src/sgl-kernel/torch_extension.cc
  4. Create Python wrapper in src/sgl-kernel/ops/__init__.py
  5. Expose Python interface in src/sgl-kernel/__init__.py
  6. Update setup.py to include new CUDA source

Build & Install

Development build:

make build

Note:

The sgl-kernel is rapidly evolving. If you experience a compilation failure, try using make rebuild.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

File details

Details for the file sgl_kernel-0.0.3.post7-cp39-abi3-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for sgl_kernel-0.0.3.post7-cp39-abi3-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 30c25fce653c866fe5539926a0bf10c336156da83f72c178abee42f31b0bde64
MD5 c18ae65b3ece4de203bb0e624aca3fa5
BLAKE2b-256 3f615b24125d3679afa895472539475ee47238c855a324cdb2840998e252dba9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page