add-cuda-kernel

Automate adding a CUDA kernel to FlashInfer with launcher, TVM-FFI binding, JIT generator, Python API, tests, and AOT registration.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/sunxxuns/flashinfer --skill add-cuda-kernel
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-cuda-kernel
Source: https://github.com/sunxxuns/flashinfer/tree/main/.claude/skills/add-cuda-kernel
Command: npx skills add https://github.com/sunxxuns/flashinfer --skill add-cuda-kernel

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a practical, end-to-end guide for adding new CUDA kernels to FlashInfer, enabling developers to extend the kernel library with custom operations.

Core Features & Use Cases

  • Step-by-step workflow covering kernel implementation, launcher creation, TVM-FFI binding, JIT module generation, Python API exposure, testing, and AOT registration.
  • Real-world scenario: integrate a new CUDA kernel into FlashInfer to accelerate a custom op in an LLM serving pipeline.
  • Demonstrates how to expose a clean Python API and ensure compatibility with FlashInfer's build and deployment tooling.

Quick Start

Follow the steps in SKILL.md to implement a sample CUDA kernel, including creating include and csrc code, binding, JIT generation, Python API, tests, and AOT registration.

Frequently Asked Questions about add-cuda-kernel

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

FAQPage Schema
How do I add a new CUDA kernel to FlashInfer?

Adding a CUDA kernel to FlashInfer requires implementing the kernel, creating a launcher, writing a TVM-FFI binding, generating a JIT module, exposing a Python API, and completing AOT registration. The workflow assumes a standard FlashInfer project layout and requires CUDA plus the FlashInfer toolchain.

What is the process for creating TVM-FFI bindings for a custom CUDA kernel?

Creating a TVM-FFI binding for a custom CUDA kernel involves writing the C++ binding code to bridge the launcher with the Python runtime. This step is part of the standard FlashInfer integration workflow, enabling the custom operation to be callable via the exposed Python API.

Do I need external packages to integrate a custom CUDA op into FlashInfer?

No, you do not need external packages beyond CUDA and the FlashInfer toolchain to integrate a custom CUDA op. The workflow operates entirely within a standard FlashInfer project layout, utilizing built-in mechanisms for JIT generation and AOT registration.

How does FlashInfer JIT generation work for newly added CUDA kernels?

FlashInfer JIT generation for newly added CUDA kernels produces the necessary runtime code to compile the kernel on-demand. Following the creation of the TVM-FFI binding and launcher, the JIT generator ensures the custom op integrates cleanly with the FlashInfer build and deployment tooling.

When should I use AOT registration for FlashInfer CUDA kernels?

AOT registration for FlashInfer CUDA kernels should be used to pre-compile custom operations into the deployment binary. This step, which follows JIT generation and Python API exposure, ensures the custom op is immediately available without runtime compilation overhead.