[Kernel][SM70] Share FP16 attention fast paths with E4M3 KV - #638
Merged
yangzhuxinyzx merged 6 commits intoSep 14, 2026
Merged
Conversation
Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Route E4M3 GQA6/D256 prefill through the shared FP16 workspace and Q8192 FP32-accumulated kernel. Preserve E4M3 decode partials in FP32, repair long page-800 indexing, remove the artificial batch cap, and send resident small-query rows in mixed batches through paged XQA. Make the cold benchmark CUDA-graph-only, document the full-model gates, and fix CPython ABI suffixes for source-built SM70 pybind extensions. Co-authored-by: areslp <100579+areslp@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
E4M3 FP8 KV cache could not consistently reuse the qualified SM70 FP16 attention fast paths. Long prefix prefill could miss the Q8192 75T kernel, decode had an artificial batch-16 cap, mixed chunked-prefill batches sent resident q=1..16 rows through serial paged prefill, and the page-800 wave loader addressed only two logical pages even when p896/p1664 spans three or four. The last issue produced a maximum absolute error of 1.2546e-3 at 256K.
This change gives the Qwen3.8 GQA6/D256 E4M3 route the corresponding FP16 schedules:
All new fast paths are default on and have explicit environment rollback controls. The E4M3 FP32 partial workspace adds about 25 MiB for B1/256K and about 200 MiB for B32/256K on this shape.
Test Plan
TORCH_CUDA_ARCH_LIST=7.0,VLLM_FLASH_ATTN_SM70=ON, andVLLM_SM70_79T_PREFILL=ON.torch.cuda.CUDAGraph.FULL_AND_PIECEWISECUDA graphs. Do not use--enforce-eager.vllm bench servecohorts at concurrency 2/4/8/16/32 with exact 2048-token input and 256-token output, then check a 32-request natural-language answer burst.Test Result
build_ext --inplace: exit 0 for the SM70 core, stable libtorch, FA2/Q8192, Flash-V100, H3, sparse-attention, MoE, and bundled FlashQLA extensions. The optional Rust frontend was skipped because cargo is absent; it is not required by the SM70 CUDA runtime.compileallandgit diff --checkpassed.海蓝石榴;木星;校验词是「海蓝石榴」,太阳系最大的行星是木星。; its 15 decode intervals are not reported as a speed baseline;cached_tokens=0, and the log containsenforce_eager=Falsewith all four ranks completing FULL graph capture;startup captured both FULL and PIECEWISE graphs for
[1, 2, 4, 8, 16, 32]; B32 recorded the page-800 E4M3 XQA route;standard
vllm bench serve, exact 2048 input / 256 output, prefix cache off, graph mode, zero failures:all 62 requests generated exactly 256 tokens; all 32 natural-language responses returned the same complete
海蓝石榴;木星answer and natural EOS;B2/B4/B8/B16/B32 page-800/256K CUDA Graph operator checks were finite, differed from scalar E4M3 by at most
4.77e-7, and were 3.64x/6.12x/6.35x/6.46x/6.59x faster;the full policy suite passes 153/153 with the source Flash-V100 package, and pre-commit passes all hooks.
2557f6b7...fa4c4, stable libtorch622af596...d162, FA2/Q8192aa657e16...5add, Flash-V10066df783d...70b3. Local imports and process maps resolve the attention DSOs from this owned worktree.