Skip to content

[Kernel][SM70] Port actual FlashInfer CUDA decode to sparse QSA (prototype) - #513

Draft
yangzhuxinyzx wants to merge 2 commits into
mainfrom
codex/v100-flashinfer-qsa-sm70-20260905-164136
Draft

yangzhuxinyzx wants to merge 2 commits into
mainfrom
codex/v100-flashinfer-qsa-sm70-20260905-164136

Conversation

@yangzhuxinyzx

@yangzhuxinyzx yangzhuxinyzx commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Purpose

Begin a real FlashInfer CUDA source port to Volta, starting with sparse QSA.
Instantiate the actual upstream paged-decode and cascade kernels through an
ordered virtual-page adapter; no forwarding to Triton or Flash-V100. This is
an experimental benchmark entry, not a serving/default change.

Implementation: FP16 D256, variable batch/page/selection width, GQA 1/2/4/6/8,
ordered selections including duplicates, 64-bit KV offsets, invalid-slot zero
loads, FP32 partials/LSE, persistent per-instance buffers and graph-compatible
GPU preparation. Upstream's existing pre-SM80 synchronous-load fallback is
used. The global FlashInfer hardware gate remains unchanged.

Test Plan

  • CPU-only native sm_70 compilation and library loading.
  • Independent FP32 oracle, repeated indices, invalid rows/pages, empty states,
    strided tensors, alignment guards and poisoned-buffer CUDA Graph replay.
  • Paired component timing against the current two-warp Triton route at
    B1/4/8/16, with index preparation and merge included.
  • Sanitizer, serving metadata integration and E2E/task-level quality before
    runtime admission. No model speed claim from component or compile results.
  • Targets remain C4/C8/C16 = 238/420/728 aggregate no-MTP decode tok/s against
    the fixed 70 tok/s single-request denominator.

Test Result

  • Native CUDA 12.8 SM70 compile and load: passed.
  • cuobjdump: native sm_70, GQA6 72 registers/thread, zero stack/local.
  • CPU pytest: 5 passed, 9 skipped; GPU skips are not GPU passes.
  • All applicable staged pre-commit hooks passed (Ruff, CUDA/C++ formatting,
    mypy, shellcheck, Markdown and repository-specific checks).
  • GPU pytest: 14 passed, including graph replay and poisoned-buffer cases.
  • Compute Sanitizer 12.8.93: 2 targeted cases, memcheck 0 errors;
    racecheck 0 errors / 0 warnings. Older system sanitizer failures were
    not counted as passes; see worklog.
  • Paired warmed CUDA Graph microbenchmark, V100-SXM2, local Hq6/Hkv1/D256,
    8192 context / 2051 sparse slots / page784, 11 samples x 100 calls:
Rows Current Triton us FlashInfer us Splits Latency change
1 27.228 30.556 32 +12.22% regression
4 54.641 45.066 32 -17.52%
8 100.055 60.611 32 -39.42%
16 167.311 87.491 16 -47.71%

The FlashInfer arm includes preparation + decode + merge; best splits are
from an exploratory 16/32/64 sweep. Auto boost, post-sample 1530/877 MHz,
driver 580.173.02. Maximum observed relative L2 versus FP32 = 0.00021144.
No E2E/model-quality acceptance or default change; B1 regression explicitly
prevents global admission. GPU processes exited and memory released.

Commands and contract: docs/design/sm70_flashinfer_qsa_port.md.
The benchmark-only test is run with --confcutdir=flashinfer-sm70/tests; no
new wheel is required. Generated build/test artifacts remain unversioned.

Risks: SIMT may be slower than the existing tensor-core route; numerical
reduction order differs and task quality is not proven by an FP32 unit oracle.
FP8 KV, prefill, fused gate, GDN/conv and TP integration are later stages, not
claimed supported by this prototype. Keep Draft until GPU gates and human
review are complete.

This work is AI-assisted (Codex); human maintainer review is required before
promotion or merge. All commits carry DCO sign-off and AI attribution.

yangzhuxinyzx and others added 2 commits September 6, 2026 01:13
Instantiate pinned upstream decode and cascade kernels through an ordered sparse KV adapter. Keep serving dispatch unchanged pending GPU correctness and performance validation.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Warm all benchmark arms before paired timing, report hardware telemetry, and record component gains without promoting the B1-regressing prototype to serving.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant