add-sgl-kernel

Automates end-to-end integration of CUDA/C++ kernels in SGL-Kernel with tests, benchmarks, and Python wrappers.

1|Updated May 8, 2026
One-click install
npx skills add https://github.com/dyyoungg/sglang-dev --skill add-sgl-kernel-dyyoungg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-sgl-kernel
Source: https://github.com/dyyoungg/sglang-dev/tree/main/.claude/skills/add-sgl-kernel
Command: npx skills add https://github.com/dyyoungg/sglang-dev --skill add-sgl-kernel-dyyoungg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This tutorial guides engineers on extending sgl-kernel with a heavyweight AOT CUDA/C++ kernel, including tests and benchmarks.

Core Features & Use Cases

  • End-to-end kernel integration: implement the kernel under csrc, declare it in a public header, register it in the Torch extension, wire a Python API, and provide tests and benchmarks.
  • Production-ready workflow: includes CMake build integration, Python API exposure, unit tests, and performance benchmarks to verify correctness and performance.
  • Use Case: A developer adds a new scale-like operation that operates on CUDA tensors, with cross-type support and dispatch rules.

Quick Start

Follow the workflow to implement a new AOT CUDA/C++ kernel: write the kernel, declare and register it, expose Python API, add tests and benchmarks, then build and verify.

Frequently Asked Questions about add-sgl-kernel

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

FAQPage Schema
How do I integrate a new CUDA C++ kernel into SGL-Kernel?

To integrate a CUDA kernel, implement the kernel under csrc, declare it in a public header, register it in the Torch extension, wire the Python API, and add tests and benchmarks for end-to-end integration.

What steps are needed to expose a CUDA kernel through a Python API in SGL-Kernel?

Exposing a CUDA kernel through a Python API requires declaring the kernel in a header, registering it in the Torch extension, and wrapping it with a Python API to ensure it is accessible for unit tests and benchmarks.

Does SGL-Kernel support end-to-end CMake build integration for custom CUDA kernels?

Yes, SGL-Kernel supports end-to-end CMake build integration for custom CUDA kernels, ensuring the new operations are compiled and registered correctly across dev builds, CI, and production pipelines.

How do I add unit tests and performance benchmarks for a new CUDA tensor operation?

You add unit tests and performance benchmarks by writing test cases and benchmarking scripts alongside the Python API exposure, verifying both correctness and performance of the new CUDA tensor operation.

Can I use SGL-Kernel to add scale-like operations with cross-type support on CUDA tensors?

Yes, you can use SGL-Kernel to add scale-like operations on CUDA tensors, utilizing its framework to implement dispatch rules and cross-type support for the new kernel integration.

Why do I need to register a new CUDA kernel in the Torch extension?

Registering a new CUDA kernel in the Torch extension connects the C++ implementation to the Torch library, enabling CMake build integration and allowing the Python API to access the custom kernel.