add-cuda-kernel

Extend FlashInfer with new CUDA kernels from definition to Python API.

4|2|Updated Feb 19, 2026
One-click install
npx skills add https://github.com/drunkcoding/AgentSkillsArxiv --skill add-cuda-kernel-drunkcoding
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-cuda-kernel
Source: https://github.com/drunkcoding/AgentSkillsArxiv/tree/main/skills/flashinfer/add-cuda-kernel
Command: npx skills add https://github.com/drunkcoding/AgentSkillsArxiv --skill add-cuda-kernel-drunkcoding

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide helps teams extend FlashInfer with new CUDA kernels to accelerate custom operations and workflows.

Core Features & Use Cases

  • End-to-end kernel integration: from CUDA kernel definition to a Python API.
  • TVM-FFI bindings and JIT module generation for dynamic workloads.
  • Production-ready patterns: dtype dispatch, CUDA stream handling, error reporting, and optional pre-allocated outputs.

Quick Start

Implement a new CUDA kernel by following the steps in this guide to define the kernel, write a launcher, bind via TVM-FFI, generate a JIT module, and expose a Python API.

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 custom CUDA kernel to FlashInfer?

To add a custom CUDA kernel to FlashInfer, follow the complete workflow: define the kernel, write a host launcher, bind via TVM-FFI, generate a JIT module, and expose a Python API for production-grade integration.

What is TVM-FFI binding used for when integrating CUDA kernels?

TVM-FFI binding is used to bridge the C++ host launcher with Python, enabling JIT module generation for dynamic workloads and allowing the custom CUDA kernel to be called directly from the FlashInfer Python API.

Does FlashInfer support dtype dispatch and CUDA stream handling for custom kernels?

Yes, FlashInfer supports production-ready patterns for custom kernels including dtype dispatch, CUDA stream handling, error reporting, and optional pre-allocated outputs to ensure robust operation.

Why do I need a JIT module for custom CUDA operations in FlashInfer?

You need a JIT module to handle dynamic workloads efficiently. It compiles the CUDA kernel on the fly via TVM-FFI, allowing the FlashInfer Python API to adapt to varying input shapes and types without static recompilation.

Can I pre-allocate output tensors when running a custom CUDA kernel in FlashInfer?

Yes, the integration workflow supports optional pre-allocated outputs. This production-ready pattern allows you to manage memory externally and pass existing buffers to the CUDA kernel via the host launcher.