What problem does it solve?
This Skill provides a comprehensive guide to integrating custom, heavyweight CUDA/C++ kernels into the sgl-kernel library, ensuring they are properly tested and benchmarked.
Core Features & Use Cases
- Kernel Implementation: Step-by-step instructions for writing CUDA kernels for element-wise operations.
- Integration Workflow: Details on updating C++ declarations, Torch extension registration, CMake build files, and Python APIs.
- Testing & Benchmarking: Guidance on creating robust unit tests and performance benchmarks using pytest and Triton.
- Use Case: A developer needs to add a highly optimized custom matrix multiplication kernel to
sgl-kernel to accelerate a specific model inference task.
Quick Start
Follow the tutorial to implement a new CUDA kernel, add its C++ declaration, register it in common_extension.cc, update CMakeLists.txt, expose a Python API, write tests in tests/, and add a benchmark in benchmark/.