FIT-side companion to two-mode timing PR: setup-hook solutions + first traces
FIT-side companion to two-mode timing PR: setup-hook solutions + first traces
Summary
This PR is the flashinfer-trace dataset companion to the engine PRfeat/two-mode-kernel-agnostic
in nvidia-china-sae/flashinfer-bench-fork. The engine PR lands the
kernel-agnostic two-mode timing engine; this PR lands the FIT-side
kernel separation: two canonical example solutions written in menyu's
setup-hook contract that the engine consumes, plus the first batch of
real kernel_ms / kernel_gpu_ms trace evaluations they produce.
Why two repos
We split the work along the agreed responsibility line:
- FIB (flashinfer-bench) owns scheduling + statistics: the
abstract engine inflashinfer_bench.bench.timing.time_runnable_two_modePerformanceschema extension +--two-modeCLI flag. That work
is the companion PR; no op-type awareness anywhere in it.
- FIT (flashinfer-trace) owns kernel support + decomposition:
each kernel exposes its ownsetup+runsplit in its solutionmain.py. This PR adds the first two canonical examples.
What's in this PR (3 files, +92 lines, no new blobs)
1. fa3_gqa_prefill_setuphook_v1.json (R8 FA3 paged-prefill)
solutions/kernel-arena/gqa_paged/
gqa_paged_prefill_causal_h16_kv1_d128_ps64/
fa3_gqa_prefill_setuphook_v1.json
The setup-hook variant of fa3_gqa_prefill_v1:
setup(*args)precomputespage_table,cu_seqlens_q,cache_seqlens,max_seqlen_q, and FA3scheduler_metadatafrom
the meta inputs (qo_indptr/kv_indptr/kv_indices/kv_last_page_len). Returns them as a dict.run(*args, **state)callsflash_attn_with_kvcachewith the
pre-computed kwargs. No Python-side.item()syncs, no allocations,
no scheduler rebuild — just the kernel.
The original fa3_gqa_prefill_v1.json is untouched; callers that
don't opt into two-mode see no behavior change.
2. flashinfer_mla_setuphook_v1.json (R14 MLA paged-prefill)
solutions/kernel-arena/mla_paged/
mla_paged_prefill_causal_h16_ckv512_kpe64_ps1/
flashinfer_mla_setuphook_v1.json
The setup-hook variant of flashinfer_wrapper_ea3787:
setup(*args)builds + callswrapper.plan()on a freshBatchMLAPagedAttentionWrapper. Returns{"wrapper": wrapper}.run(*args, *, wrapper)callswrapper.run(q_nope, q_pe, ckv_cache, kpe_cache, return_lse=True)— just the kernel.
Again, the original flashinfer_wrapper_ea3787.json baseline stays.
3. 48 trace entries on gqa_paged_decode_h32_kv8_d128_ps1.jsonl
traces/baseline/gqa_paged/gqa_paged_decode_h32_kv8_d128_ps1.jsonl
Real flashinfer-bench run --two-mode evaluations produced during
validation of the engine PR on H100 NVL. Every appended row carries
the new four Performance schema fields:
kernel_ms— cudagraph + cudaEvent median, mskernel_gpu_ms— CUPTI activity sum (real CUPTI on cu13), mskernel_ms_status—"ok"for all 48 rowskernel_gpu_ms_status—"ok"for all 48 rows
All entries reference workload uuids already present in the dataset;
no new workloads, no new safetensors blobs.
Contract — same recipe both solutions
def setup(*input_args):
# Build per-workload meta state from the META input subset.
# Touches only meta inputs; data inputs (q / k_cache / …) ignored.
return {"key_a": ..., "key_b": ..., ...} # dict, splatted as kwargs into run()
def run(*input_args, *, key_a, key_b, ...):
# The kernel hot path. Takes the same positional signature as setup
# plus keyword-only params whose names match setup's returned keys.
# No `.item()` syncs, no rebuilds, no allocations of pre-computable
# buffers. The engine captures THIS into a CUDA graph for kernel_ms.
...
setup and run have the same positional signature — that's
required by the PythonBuilder's signature validator
(flashinfer_bench.compile.builders.python_builder). Setup-injected
state arrives via the keyword-only * suffix on run's signature.
Environment for the trace data
- Hardware: NVIDIA H100 NVL (a1u1g-mil-0678)
- Container: ngc_pt25.12_fi0.6.11_dg2.5.0.sqsh (NGC pytorch 25.12)
- Torch: 2.10.0a0+b4e4ee81d3.nv25.12
- CUDA: 13.1
- FlashInfer: 0.6.11.post1
- Triton: 3.5.1
- Date: 2026-06-25
What this PR does NOT touch
- No changes to any existing solution / definition / workload /
trace except the one appended .jsonl listed above.
- No new safetensors / blob files — all referenced blobs already in
the dataset.
- No changes to schema (the new four Performance fields are all
Optional → existing trace JSONs round-trip unchanged).
Companion PR
Engine implementation that consumes these solutions and produced the
trace data:
nvidia-china-sae/flashinfer-bench-fork:feat/two-mode-kernel-agnostic
Recommended merge order:
1. Merge the engine PR upstream into flashinfer-bench first.
2. Then merge this PR into flashinfer-trace.
(The two solutions in this PR will fail to import without menyu's
setup-hook PR landed too, since PythonBuilder.setup_callable wiring
lives there. menyu's setup-hook is already merged or in flight; the
engine PR cherry-picks it as a stack base.)
Reproducing
Once the engine PR is merged and you have either canonical solution
deployed:
flashinfer-bench run \
--two-mode \
--graph-iters 20 \
--definitions gqa_paged_decode_h32_kv8_d128_ps1 \
--solutions flashinfer_wrapper_a9588f \
--warmup-runs 10 --iterations 50 --num-trials 2 \
--local /path/to/flashinfer-trace
The new rows in
traces/baseline/gqa_paged/gqa_paged_decode_h32_kv8_d128_ps1.jsonl
will match within run-to-run noise.
---