add-jit-kernel

Add a lightweight JIT CUDA kernel with host wrapper, tests, and benchmarks to SGLang's jit_kernel module.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Automates the process of adding a new lightweight JIT CUDA kernel to SGLang's jit_kernel module, reducing iteration time and ensuring consistent abstractions.

Core Features & Use Cases

  • Provides a complete end-to-end workflow to add a JIT kernel: kernel source, Python wrapper, unit tests, and benchmarks.
  • Demonstrates safe usage of TensorMatcher, AlignedVector, and LaunchKernel from the sgl_kernel library.
  • Includes guidance for cross-type support (FP16/BF16/FP32), vector width selection, and runtime safety checks.

Quick Start

Follow the steps in this guide to implement a minimal end-to-end JIT CUDA kernel and validate it with tests.

Frequently Asked Questions about add-jit-kernel

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

FAQPage Schema
How do I add a custom CUDA kernel to SGLang for rapid GPU operation iteration?

Add a lightweight JIT CUDA kernel to SGLang's jit_kernel module. This workflow provides a complete end-to-end pipeline including the kernel source, Python wrapper, unit tests, and benchmark scaffold to ensure safe and reproducible custom GPU operations.

How does SGLang ensure safe execution and input validation for JIT kernels?

SGLang ensures JIT kernel safety through TensorMatcher-based input validation and LaunchKernel-based safe execution. These mechanisms validate tensor inputs and manage secure kernel launches, maintaining correctness and preventing runtime errors during custom GPU operations.

Can I use SGLang JIT kernels across different floating-point precision workflows?

Yes, SGLang JIT kernels support cross-type workflows across FP16, BF16, and FP32. The skill provides guidance for precision support, vector width selection, and vectorized memory access via AlignedVector to optimize operations across these formats.

What is the best way to benchmark a newly added CUDA kernel in SGLang?

The best way is using the integrated benchmark scaffold provided when adding a JIT kernel. This scaffold accompanies the host wrapper and unit tests, ensuring reproducible performance measurements for your custom GPU operations within the SGLang framework.

What do I need to set up before writing a JIT CUDA kernel for SGLang?

You need a SGLang environment configured for GPU operations and familiarity with the sgl_kernel library. The setup requires utilizing TensorMatcher, AlignedVector, and LaunchKernel abstractions to prepare host wrappers and ensure vectorized memory access for the new kernel.

Why should I use SGLang's jit_kernel module instead of writing standalone CUDA code?

The jit_kernel module enforces consistent abstractions and automates the end-to-end integration of custom GPU operations. It reduces iteration time by providing built-in TensorMatcher validation, LaunchKernel safety, cross-type precision support, and testing scaffolds that standalone code lacks.