add add-flashinfer-solution skill (end-to-end Solution authoring)

#6

Summary

Adds a new agent skill add-flashinfer-solution under .claude/skills/
covering the Solution authoring side of the flashinfer-bench workflow:

pick a Definition → wrap a kernel → write Solution JSON → run benchmark
→ inspect traces → visualize

The existing skill suite covers the Definition / Workload / model side
(extract-kernel-definitions, collect-workloads, onboard-model,
add-reference-tests, track-models, clone-repos,
collect-workloads-bench). Solution authoring had no skill-level
documentation; this PR fills that gap.

Motivation

Three real Solutions were authored end-to-end against the public
flashinfer-trace dataset during this work:

Solution Definition Verified on
sdpa_paged_decode_v1 gqa_paged_decode_h32_kv8_d128_ps1 H100 PCIe
fla_gdn_decode_v1 gdn_decode_qk4_v8_d128_k_last H100 PCIe
sglang_mla_decode_v1 mla_paged_decode_h16_ckv512_kpe64_ps1 H100 PCIe + B200

Recurring patterns surfaced — paged KV layout conversion, LSE base-2 vs
base-e, GQA H_kv → H_q expansion, FLA's transpose_state_layout flag,
vendored-Triton sys.path, FlashInfer-GDN CuTe DSL ABI mismatch on NGC
PyTorch 24.10 — were costly to re-derive each time. This skill captures
them as a reusable playbook.

What's added

.claude/skills/add-flashinfer-solution/
├── SKILL.md 7-step workflow + gotchas + quick-run script
├── reference/
│ ├── definition_schema.md Definition JSON full schema
│ ├── solution_schema.md Solution JSON full schema
│ ├── wrapper_gotchas.md 17+ failure modes with diagnostics
│ └── visualization.md Local web UI / public site / SSH forwarding
└── templates/
├── dense_baseline_main.py + .json PyTorch SDPA-style baseline
├── linear_attention_main.py + .json External lib wrapper (FLA)
└── vendored_kernel_main.py + .json Vendored Triton kernel (SGLang-style)

Verified environment

All three reference Solutions were verified using the workflow in SKILL.md
Section 3.3 + Step 5.1a
:

crun -q 'gpu.chip=gh100 and cpu.arch=x86_64' --gpus=1 -C \
     -img nvcr.io/nvidia/pytorch:24.10-py3 \
     -r /tmp <user_script>.sh

with the following pinned pip-install stack inside the user script:

pip install --target /tmp/pip-pkgs --no-cache-dir \
    flashinfer-python==0.6.9 \
    "flashinfer-bench>=0.6.0,<0.7" \
    "flash-linear-attention>=0.5.0" \
    "nvidia-cutlass-dsl[cu13]" \
    cuda-python safetensors huggingface-hub

No NGC API key required (crun authenticates against NGC via the compute
node's docker daemon credentials); no custom container image needed.
Per-invocation cost: ~5 min pip install. SKILL.md Section 3.3 explains why
a pre-built .sqsh image was considered as an optimization and rejected
(computelab front-end constraints: no user docker daemon, cgroup namespace
mismatch under VS Code SSH session, NGC private blob auth).

Layout note for reviewers

Existing skills are single-file SKILL.md. This one uses subdirectories
(reference/, templates/) because:

1. Schema reference docs (~200 lines each) are more useful as standalone
linkable artifacts than inline sections of a longer SKILL.md
2. Wrapper templates need to be runnable as .py / .json for the
"copy → modify" use case, not as inline code blocks

Total content is ~1500 lines distributed across 11 purposeful files. Happy
to flatten into a single SKILL.md if maintainers prefer the strict
one-file convention.

How to test

1. Skill metadata sanity:
head -4 .claude/skills/add-flashinfer-solution/SKILL.md
# Expect valid YAML frontmatter with name + description
2. End-to-end Solution run on a computelab GPU node: follow SKILL.md
Section 3.3 + Step 5.1a to author a trivial Solution against any
existing Definition (e.g. gqa_paged_decode_h32_kv8_d128_ps1) and
confirm flashinfer-bench run --solutions <yours> produces PASSED
traces.
3. Lint / format: no code changes; only markdown + Python + JSON
templates.

Checklist

- PR title follows <type>: <description> convention
- Skill metadata (name, description) follows existing skill pattern
- No changes to flashinfer_bench/ Python package
- No changes to existing skills (additive only)
- No CI / build system changes required
- CONTRIBUTING.md workflow followed (fork → branch → PR)
- Reviewers comfortable with subdir layout (else willing to flatten)

Related

- Existing skills suite: see .claude/skills/ and CLAUDE.md
- Last skill-related PR: #384 (docs: add skill summaries and
cross-references)
- Prior skill-restructure PR: #224 (referenced in #384)

---

## 紧凑提交命令(直接跑)

```bash
cd /home/scratch.yuny_wwfo/kernel_arena/flashinfer-bench
git config user.name "Yun Yang"
git config user.email "yuny@nvidia.com"

# 1. fork on GitHub web first, then:
git remote add fork https://github.com/<your-gh-handle>/flashinfer-bench.git

# 2. clean branch
git fetch origin
git checkout -b yyang/add-solution-skill origin/main

# 3. copy skill (PR_DESCRIPTION.md 不进 commit)
mkdir -p .claude/skills/add-flashinfer-solution
cp -r /home/yuny/kernel_arena/skills/add-flashinfer-solution/SKILL.md \
      /home/yuny/kernel_arena/skills/add-flashinfer-solution/reference \
      /home/yuny/kernel_arena/skills/add-flashinfer-solution/templates \
      .claude/skills/add-flashinfer-solution/

# 4. confirm only skill files staged
git add .claude/skills/add-flashinfer-solution
git status  # 确认只有这些文件 + 不要 stage flashinfer_trace/* 的 deleted 项

# 5. commit (paste commit message above)
git commit

# 6. push to fork
git push -u fork yyang/add-solution-skill

# 7. open PR
gh pr create --repo flashinfer-ai/flashinfer-bench --base main \
    --title "feat: add add-flashinfer-solution skill for Solution authoring workflow"
yunyangNV changed pull request status to closed

Sign up or log in to comment