extract-kernel-definitions
БесплатноБез исполняемых скриптовНе проверенGenerate Definition JSON files for the flashinfer-trace HuggingFace dataset by harvesting them from a short SGLang inference pass (FlashInfer's…
Об этом скилле
Extract Kernel Definitions
Produce per-(op, shape) Definition JSONs and stage them in the HuggingFace dataset clone at
tmp/flashinfer-trace/definitions/{op_type}/. PR submission is out of scope here — see
submit-onboarding-prs (Phase 4 of /onboard-model).
Two paths
| Path | When to use | What you do |
|---|---|---|
| A. Trace-dump (primary) | Kernel is fi_supported per /discover-models — i.e. the FlashInfer API used by SGLang carries a @flashinfer_api(trace=...) template (see coverage list). |
Run a short SGLang inference pass with FLASHINFER_TRACE_DUMP=1. The dumper writes one JSON per unique (op, shape) before the kernel runs (crash-safe, deduplicated). |
| B. Manual extraction (fallback) | Kernel is fi_missing, or the relevant FlashInfer API is not yet trace-instrumented. |
Read the SGLang model source + sgl-cookbook serving config + HF model config; write the Definition JSON by hand using the schema reference. |
The trace-dump path is the default — it eliminates manual axis derivation and produces
JSONs that already carry axes, inputs, outputs, tags (fi_api:*,
status:verified), and a reference implementation.
Background: the trace dumper was added in flashinfer-ai/flashinfer#2931. Schema and full env-var docs live at
docs/fi_trace.rstin the FlashInfer repo. SGLang harness reference:tests/trace/example_sglang.py.
Usage
# Path A — auto-dump every fi_supported definition for a model in one inference pass
/extract-kernel-definitions --model-name llama-3.2-3b --hf-repo-id meta-llama/Llama-3.2-3B-Instruct
# Path A — multi-config: one short run per (TP, EP) listed in sgl-cookbook
/extract-kernel-definitions --model-name qwen3-next --tp-list 2,4
# Path B — manual fallback for fi_missing kernels (or names that didn't appear in the dump)
/extract-kernel-definitions --model-name kimi-k2 --manual --op-types new_op_type
Parameters
--model-name(required): Model slug (e.g.llama,deepseek-v3,qwen3-next). Used to look up the SGLang model file and the sgl-cookbook YAML.--hf-repo-id(optional): HuggingFace repo override; inferred from--model-nameif omitted.--tp-list(optional): Comma-separated TP values to run for; default reads sgl-cookbook YAML.--ep-list(optional): Comma-separated EP values for MoE models.--manual(optional): Force Path B (manual extraction) even for fi_supported ops.--op-types(optional): Comma-separatedop_typefilter when using--manualor for--dry-runreporting.--dry-run(optional): Report what would be dumped/written without running anything.--skip-existing(optional, defaulttrue): Skip any definition whose name already exists undertmp/flashinfer-trace/definitions/.
Prerequisites
/clone-reposhas been run, sotmp/sglang/,tmp/flashinfer/,tmp/sgl-cookbook/, andtmp/flashinfer-trace/are present and current. The HF dataset clone attmp/flashinfer-trace/is the only home for definitions — the in-repoflashinfer_trace/directory was removed in the trace-dataset refactor.- For Path A: a working CUDA-enabled environment, GPU memory sufficient for the chosen
model + TP, and
attention_backend="flashinfer"available in the installed SGLang. - For Path B: HuggingFace
config.jsonaccess for the target model.
Path A: trace-dump from a short SGLang pass
The dumper fires inside FlashInfer when both env vars are set before the FlashInfer
import. SGLang routes through @flashinfer_api(trace=...)-decorated APIs whenever
attention_backend="flashinfer" is selected, so a single short prefill+decode pass
exercises most ops at once.
A1. Pick the serving config(s)
Open the sgl-cookbook YAML for the target model and list the unique TP/EP values — one trace-dump pass per unique combination is enough to cover every shape variant.
ls tmp/sgl-cookbook/data/models/generated/v0.5.6/ | grep -i {model_name}
cat tmp/sgl-cookbook/data/models/generated/v0.5.6/{model_yaml}
If the model has no cookbook entry, default to TP=1 (single-GPU baseline) and skip EP.
A2. Run the trace-dump pass
Use tools/gpu-lock so CUDA_VISIBLE_DEVICES is set correctly. The script below mirrors
tests/trace/example_sglang.py
in the FlashInfer repo — adapt the model_path, tp_size, and attention_backend:
DUMP_DIR=tmp/dumps/fi_trace_{model_slug}_tp{TP}_ep{EP}
tools/gpu-lock --gpus {TP} --exec-timeout 1800 -- python - <<EOF
import os, shutil
from pathlib import Path
# Must be set BEFORE
Установить extract-kernel-definitions в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл extract-kernel-definitions?
Generate Definition JSON files for the flashinfer-trace HuggingFace dataset by harvesting them from a short SGLang inference pass (FlashInfer's @flashinfer_api(trace=...) dumper) — or, as a fallback, by manually transcribing the schema from SGLang sources when FlashInfer doesn't yet have a trace template. Use when adding a new model, extracting GPU kernels (MLA, MoE, GQA, RMSNorm, GEMM, GDN, RoPE, sampling), or filling gaps in the dataset.
Как установить скилл extract-kernel-definitions?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл extract-kernel-definitions запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic