Add add-flashinfer-solution skill (end-to-end Solution authoring + benchmarking + visualization + docker image)

#5

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 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 — KV-cache layout conversion, LSE base-2 vs
base-e, GQA H_kv → H_q expansion, FLA's transpose_state_layout flag,
vendored-Triton sys.path, NGC PyTorch + CuTe DSL ABI mismatch — were
costly to re-derive each time. This skill captures them as a reusable
playbook so subsequent Solution contributors don't relive the debug loops.

What's added

.claude/skills/add-flashinfer-solution/
├── SKILL.md                              7-step workflow + gotchas
├── 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                  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)
└── docker/
    ├── Dockerfile                          Pinned reproducible runtime
    ├── README.md                           Build / run / volume-mount guide
    ├── build.sh, run.sh                    Helper scripts

Docker environment

Pinned exact stack used to verify the three reference Solutions:

Component Version
Base nvcr.io/nvidia/pytorch:24.10-py3
flashinfer-python ==0.6.9 (pinned for CuTe DSL ABI compat)
flashinfer-bench >=0.6.0,<0.7
flash-linear-attention >=0.5.0
nvidia-cutlass-dsl[cu13], cuda-python latest
safetensors, huggingface-hub, git-lfs latest

Build + smoke test:

cd .claude/skills/add-flashinfer-solution/docker
./build.sh             # ~5-10 min
./run.sh --smoke       # imports verified

Layout note for reviewers

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

  1. Schema reference docs (~200 lines each) are more useful as standalone
    linkable artifacts than as inline sections of a longer SKILL.md
  2. Wrapper templates need to be runnable as .py / .json, not as
    inline code blocks
  3. The Dockerfile is consumed by docker build, not read by Claude

Total content is ~1600 lines but distributed across 11 purposeful files.
Happy to flatten if maintainers prefer strict one-file convention; in
that case the templates and Dockerfile would still need to live as
separate executable artifacts somewhere.

How to test

1. Skill metadata sanity

head -4 .claude/skills/add-flashinfer-solution/SKILL.md
# Expect a valid YAML frontmatter with name + description

2. Docker build

cd .claude/skills/add-flashinfer-solution/docker
./build.sh
./run.sh --smoke

Smoke output should show: torch >= 2.7, CUDA: True, FLA: OK,
fbench: present.

3. End-to-end Solution run inside the container

HOST_TRACE=/path/to/your/flashinfer-trace ./run.sh
# Inside the container:
cd /workspace/flashinfer-trace
flashinfer-bench run --local . \
    --definitions gqa_paged_decode_h32_kv8_d128_ps1 \
    --solutions <baseline_or_your_solution> \
    --num-trials 1 --iterations 5 --timeout 300

4. Lint / format

No code changes; only markdown + Dockerfile + shell + json.

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)

---

## How to actually open the PR (recap of the procedure)

```bash
# 0. set git identity if not yet (replace with yours)
cd /home/scratch.yuny_wwfo/kernel_arena/flashinfer-bench
git config user.name "Your Name"
git config user.email "your@email"

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

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

# 3. copy the skill in place
mkdir -p .claude/skills/add-flashinfer-solution
cp -r /home/yuny/kernel_arena/skills/add-flashinfer-solution/* \
      .claude/skills/add-flashinfer-solution/

# 4. confirm only the skill files are staged (the working tree currently has
#    unrelated 'deleted' entries from the flashinfer_trace symlink — DO NOT
#    stage those)
git add .claude/skills/add-flashinfer-solution
git status

# 5. commit (paste the suggested commit message above)
git commit -F /home/yuny/kernel_arena/skills/add-flashinfer-solution/PR_DESCRIPTION.md
# (or interactively edit, taking just the commit-message section)

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

# 7. open PR via gh CLI (or GitHub web)
gh pr create \
    --repo flashinfer-ai/flashinfer-bench \
    --base main \
    --head <your-gh-handle>:yyang/add-solution-skill \
    --title "feat: add add-flashinfer-solution skill (end-to-end Solution authoring + benchmarking + visualization)" \
    --body-file <(sed -n '/^## PR description/,/^---$/p' /home/yuny/kernel_arena/skills/add-flashinfer-solution/PR_DESCRIPTION.md | sed -n '/```markdown/,/^```$/p' | grep -v '^```')
yunyangNV changed pull request title from Add add-flashinfer-solution skill (end-to-end Solution authoring + benchmarking + visualization) to Add add-flashinfer-solution skill (end-to-end Solution authoring + benchmarking + visualization + docker image)
yunyangNV changed pull request status to closed
yunyangNV changed pull request status to open
yunyangNV changed pull request status to closed

Sign up or log in to comment