add-sgl-kernel

Guide adding AOT CUDA or C++ kernels with Torch registration, CMake, tests, and benchmarks.

556|81|Updated May 19, 2026
One-click install
npx skills add https://github.com/FutureMLS-Lab/OSCAR --skill add-sgl-kernel-futuremls-lab
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: add-sgl-kernel
Source: https://github.com/FutureMLS-Lab/OSCAR/tree/main/sglang-research/.claude/skills/add-sgl-kernel
Command: npx skills add https://github.com/FutureMLS-Lab/OSCAR --skill add-sgl-kernel-futuremls-lab

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers add heavyweight ahead-of-time CUDA or C++ kernels to sgl-kernel without missing the required integration, testing, benchmarking, or build steps.

Core Features & Use Cases

  • Kernel Implementation: Guides creation of CUDA source files with tensor validation, dtype dispatch, stream handling, and launch error checks.
  • Framework Integration: Covers C++ declarations, Torch operator registration, CMake source inclusion, and Python API exposure.
  • Verification Workflow: Provides pytest correctness tests, Triton benchmarking, build commands, and troubleshooting guidance.
  • Use Case: Add a new FP16, BF16, and FP32 CUDA elementwise operation to SGLang's AOT kernel library with a complete test and performance benchmark.

Quick Start

Use the add-sgl-kernel skill to implement, register, build, test, and benchmark a new heavyweight CUDA kernel in sgl-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?▼

Adding a CUDA kernel to sgl-kernel requires creating the source file with tensor validation, registering the Torch operator, updating CMake, exposing the Python API, and writing pytest tests.

What is the process for integrating C++ operations into SGLang's AOT kernel library?▼

Integrating C++ operations into SGLang involves Torch operator registration, CMake source inclusion, Python API exposure, and controlled build validation for the ahead-of-time kernel.

Does sgl-kernel support FP16, BF16, and FP32 dtype dispatch for new elementwise operations?▼

Yes, sgl-kernel supports FP16, BF16, and FP32 dtype dispatch for new elementwise operations, requiring CUDA-aware tensor validation and kernel launch error checking.

How do I benchmark PyTorch CUDA kernels using Triton?▼

You benchmark PyTorch CUDA kernels in sgl-kernel by executing Triton performance measurements alongside pytest correctness tests to validate speed and accuracy.

What are common build validation issues when registering Torch operators for CUDA kernels?▼

Common build validation issues when registering Torch operators include missing CMake source inclusion, incorrect dtype dispatch, or lacking kernel launch error checks, which troubleshooting addresses.