add-jit-kernel

Guide adding lightweight JIT CUDA kernels to the sglang framework.

31.6k|7.8k|Updated Jan 8, 2024
One-click install
npx skills add https://github.com/sgl-project/sglang --skill add-jit-kernel-sgl-project
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-jit-kernel
Source: https://github.com/sgl-project/sglang/tree/main/.claude/skills/add-jit-kernel
Command: npx skills add https://github.com/sgl-project/sglang --skill add-jit-kernel-sgl-project

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide to extending SGLang's capabilities by adding new, lightweight Just-In-Time (JIT) CUDA kernels, enabling custom high-performance operations directly within the framework.

Core Features & Use Cases

  • JIT Kernel Integration: Learn the workflow for implementing and integrating custom CUDA kernels using SGLang's JIT compilation system.
  • Abstractions & Best Practices: Understand and utilize SGLang's provided C++ and CUDA abstractions for safe, efficient, and maintainable kernel development.
  • Use Case: You need to implement a novel element-wise operation for a specific model that isn't supported by default. This Skill guides you through creating that operation as a JIT kernel, complete with Python wrappers, tests, and benchmarks.

Quick Start

Follow the step-by-step tutorial to implement a new JIT kernel for element-wise scaling.

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 custom CUDA kernels to SGLang for tensor operations?

To add custom CUDA kernels to SGLang, use its JIT compilation system to implement C++ abstractions for tensor validation, vectorized memory access, and kernel launching, alongside Python wrapper integration for custom tensor operations.

What is the difference between JIT and AOT kernel compilation in SGLang?

JIT kernel compilation in SGLang enables lightweight, on-the-fly compilation of custom CUDA kernels during runtime, whereas AOT involves ahead-of-time compilation, with the Skill specifically detailing the JIT integration strategy for high-performance operations.

How do I implement and benchmark element-wise operations using JIT CUDA kernels?

To implement and benchmark element-wise operations, follow the step-by-step tutorial for creating a JIT CUDA kernel, which includes writing the kernel logic, wrapping it in Python, and running the provided benchmarking procedures to evaluate performance.

Can I use SGLang abstractions for tensor validation and device utilities in custom kernels?

Yes, you can use SGLang's provided C++ and CUDA abstractions for safe kernel development, which includes built-in tensor validation, device utilities, and vectorized memory access for your custom JIT CUDA kernels.

Do I need to write Python wrappers when integrating JIT CUDA kernels into SGLang?

Yes, implementing Python wrappers is a required step in the SGLang JIT kernel integration workflow, ensuring your custom CUDA operations are callable within the framework alongside completing tests and benchmarks.