add-sgl-kernel

Integrate an AOT CUDA/C++ kernel with Torch bindings and CMake.

Updated Mar 17, 2026
One-click install
npx skills add https://github.com/togethercomputer/xorl-sglang --skill add-sgl-kernel-togethercomputer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-sgl-kernel
Source: https://github.com/togethercomputer/xorl-sglang/tree/main/.claude/skills/add-sgl-kernel
Command: npx skills add https://github.com/togethercomputer/xorl-sglang --skill add-sgl-kernel-togethercomputer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This step-by-step tutorial guides engineers on adding a heavyweight AOT CUDA/C++ kernel to sgl-kernel, including tests and benchmarks.

Core Features & Use Cases

  • Comprehensive workflow covering kernel implementation, dispatch, tests, and benchmarks.
  • Demonstrates integration with Torch extension, Python API, and CMake build.
  • Use Case: A developer wants to add a new matrix scale kernel to the sgl-kernel wheel and ensure correct CUDA dispatch, tests, and performance benchmarks.

Quick Start

Follow the steps in this guide to implement, register, and validate a new CUDA kernel end-to-end (C++, headers, Python bindings, tests, and benchmarks).

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 PyTorch bindings?

Adding a CUDA kernel to sgl-kernel involves writing C++ sources and headers, configuring CMake integration, registering the Torch extension, and exposing Python bindings for the new operation.

What is the process for integrating a heavyweight C++ kernel into a CUDA project?

Integrating a heavyweight C++ kernel requires implementing proper CUDA dispatch, configuring CMake integration, registering the Torch extension, and validating CUDA availability alongside architecture constraints.

How do I write tests and benchmarks for a new CUDA kernel operation?

Writing tests and benchmarks for a CUDA kernel operation involves adding validation tests and performance benchmarks alongside the kernel implementation, Torch bindings, and CMake build configuration.

Does adding a CUDA kernel to sgl-kernel require validating CUDA availability and architecture constraints?

Yes, adding a CUDA kernel requires validation for CUDA availability and architecture constraints to ensure correct CUDA dispatch and proper operation of the heavyweight AOT C++ kernel extension.

How do I configure CMake integration when extending a CUDA kernel library?

Configuring CMake integration when extending a CUDA kernel library involves updating the build configuration to compile new C++ sources and headers, link the Torch extension, and enable Python bindings.