extract-kernel-definitions

Extract GPU kernel schemas from SGLang models into deduplicated Definition JSON files.

264|47|Updated Jun 30, 2025
One-click install
npx skills add https://github.com/flashinfer-ai/flashinfer-bench --skill extract-kernel-definitions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: extract-kernel-definitions
Source: https://github.com/flashinfer-ai/flashinfer-bench/tree/main/.claude/skills/extract-kernel-definitions
Command: npx skills add https://github.com/flashinfer-ai/flashinfer-bench --skill extract-kernel-definitions

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires SGLang, FlashInfer.

What problem does it solve?

This Skill automates the extraction of kernel schemas and definitions from SGLang model implementations, enabling consistent, deduplicated kernel definitions for FlashInfer trace.

Core Features & Use Cases

  • Kernel extraction: Detect and extract kernel definitions (MLA, MoE, GQA, RMSNorm, GEMM) from SGLang models.
  • Deduplication: Prevent duplicate definitions by consolidating shared kernels and tagging model usage.
  • Definition generation: Produce JSON-based kernel definitions suitable for flashinfer_trace and downstream testing.

Quick Start

Run /extract-kernel-definitions --model-name <MODEL_NAME> to scan the model and generate new definitions under flashinfer_trace/definitions, then review and deduplicate if needed.

Frequently Asked Questions about extract-kernel-definitions

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

FAQPage Schema
How do I extract GPU kernel schemas from SGLang model implementations?

To extract GPU kernel schemas from SGLang models, run the extraction command with the target model name. This automates scanning the model implementation to detect kernel definitions like MLA, MoE, GQA, RMSNorm, and GEMM for FlashInfer trace.

What is kernel definition deduplication and when do I need it for FlashInfer?

Kernel definition deduplication prevents duplicate kernel schemas by consolidating shared definitions and tagging model usage. You need it when adding new SGLang models to maintain consistent, reusable FlashInfer trace definitions without redundancy.

Can I use this to generate Definition JSON files for MLA and MoE kernels?

Yes, you can generate Definition JSON files for MLA, MoE, GQA, RMSNorm, and GEMM kernels. The extraction process scans SGLang models and outputs JSON-based definitions suitable for flashinfer_trace and downstream testing.

Does extracting kernel definitions require existing FlashInfer tests to validate references?

Yes, the kernel definition extraction relies on the existing project structure and FlashInfer tests to validate references. This ensures the extracted kernel schemas are accurate and the generated definitions remain reusable across models.

What's the best way to handle duplicate kernel definitions when adding a new SGLang model?

The best way to handle duplicate kernel definitions is to run the extraction tool and then review the generated schemas. The tool automatically consolidates shared kernels and tags model usage to prevent redundant FlashInfer trace definitions.

Why are my generated FlashInfer trace definitions not reusable across different models?

FlashInfer trace definitions may not be reusable if deduplication was skipped during extraction. Running the extraction process ensures shared kernels are consolidated and tagged by model usage, maintaining consistent reusable definitions.