add-sgl-kernel

Add a CUDA/C++ AOT kernel to sgl-kernel with tests and benchmarks.

410|14|Updated Apr 8, 2026
One-click install
npx skills add https://github.com/OpenMOSS/MOSS-VL --skill add-sgl-kernel-openmoss
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-sgl-kernel
Source: https://github.com/OpenMOSS/MOSS-VL/tree/main/sglang/.claude/skills/add-sgl-kernel
Command: npx skills add https://github.com/OpenMOSS/MOSS-VL --skill add-sgl-kernel-openmoss

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The Skill helps developers add a heavyweight CUDA/C++ AOT kernel to the sgl-kernel project, including tests and benchmarks, enabling end-to-end kernel integration.

Core Features & Use Cases

  • Provides a complete workflow to implement a new kernel in sgl-kernel, including C++/CUDA source, header declarations, torch extension registration, CMake integration, Python API, tests, and performance benchmarks.
  • Covers validation via unit tests and benchmarking to ensure correctness and performance before deployment.
  • Useful for teams extending sgl-kernel with new operations that require deterministic kernel behavior and integration with PyTorch.

Quick Start

Build the project with make build in the sgl-kernel directory and run the tests to verify the new kernel.

Frequently Asked Questions about add-sgl-kernel

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new CUDA kernel to sgl-kernel with tests and benchmarks?

To add a CUDA kernel to sgl-kernel, implement the C++/CUDA source, declare headers, register the torch extension, integrate CMake, expose the Python API, and write unit tests and benchmarks for validation.

What is the process for integrating an AOT CUDA kernel into a PyTorch extension?

Integrating an AOT CUDA kernel into a PyTorch extension involves writing the C++/CUDA implementation, adding header declarations, configuring the CMake build system, and registering the operation to ensure reproducible builds and deterministic behavior.

Do I need CMake and PyTorch to build C++ kernels in sgl-kernel?

Yes, building C++ kernels in sgl-kernel requires CMake for build integration and PyTorch for the torch extension registration and Python API exposure to ensure proper end-to-end kernel deployment.

What's the best way to validate CUDA kernel performance before deployment?

The best way to validate CUDA kernel performance is by running the integrated benchmarks after building the project with make build, ensuring the new kernel meets correctness and performance standards reproducibly.

Why does my sgl-kernel build fail when adding a new C++ operation?

Build failures when adding a new C++ operation often stem from incomplete CMake integration or missing header declarations, which are required to properly register the torch extension and expose the Python API.

Can I add a deterministic CUDA kernel to sgl-kernel for new PyTorch operations?

Yes, you can add deterministic CUDA kernels to sgl-kernel for new PyTorch operations by following the complete workflow of C++/CUDA implementation, library registration, CMake integration, and testing.