add-cuda-kernel

Guides adding new CUDA kernels to the FlashInfer library.

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

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, step-by-step guide to integrating new custom CUDA kernels into the FlashInfer library, enabling users to extend its functionality with their own optimized operations.

Core Features & Use Cases

  • End-to-End Workflow: Covers defining CUDA kernels, creating C++ launchers, implementing TVM-FFI bindings, generating JIT modules, and creating Python APIs.
  • Best Practices: Demonstrates proper error handling, dtype dispatch, and architecture-specific compilation.
  • Use Case: A researcher needs to implement a novel attention mechanism not supported by FlashInfer. They can follow this guide to add their custom kernel, test it rigorously, and integrate it seamlessly into their existing FlashInfer-based inference pipeline.

Quick Start

Follow the detailed steps in the tutorial to add a new CUDA kernel to FlashInfer.

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 custom CUDA kernels to FlashInfer for a new attention mechanism?

To add custom CUDA kernels to FlashInfer, you define the kernel in C++, implement launchers, create TVM-FFI bindings, generate JIT modules, and expose Python APIs. This end-to-end workflow ensures seamless integration of novel operations into your inference pipeline.

What is the process for creating JIT modules and Python APIs for FlashInfer CUDA kernels?

Creating JIT modules for FlashInfer CUDA kernels involves compiling architecture-specific code and binding it via TVM-FFI. You then wrap these bindings in Python APIs to enable dtype dispatch and proper error handling for the custom operations.

Does FlashInfer support compiling custom CUDA kernels for different data types and architectures?

Yes, FlashInfer supports compiling custom CUDA kernels for various data types and CUDA architectures. The integration workflow includes dtype dispatch and architecture-specific compilation to ensure optimized performance across different hardware configurations.

What's the best way to test and benchmark custom GPU kernels integrated into FlashInfer?

The best way to test and benchmark custom GPU kernels in FlashInfer is to follow the provided integration guide, which includes rigorous testing and benchmarking steps. This ensures your custom operations maintain correctness and achieve optimized performance.

Can I implement TVM-FFI bindings for FlashInfer kernel development without external dependencies?

Yes, you can implement TVM-FFI bindings for FlashInfer kernel development without external dependencies. The skill provides a self-contained workflow covering C++ launcher implementation and binding generation to seamlessly connect your C++ code with Python.