This is a downstream distribution of Dao-AILab/flash-attention that bundles six open upstream PRs targeting consumer Blackwell hardware (RTX 5090, RTX PRO 6000, DGX Spark GB10, SM121a). Once these PRs merge upstream, prefer the upstream flash-attn package; this bundle exists so SM120 users can use the improvements today.
Why this exists
flash-attn-4's CuTe DSL kernels work great on Hopper (SM90) and datacenter Blackwell (SM100). But SM120 (consumer Blackwell) is genuinely different hardware:
No WGMMA (so the SM90 epilogue path doesn't apply)
99 KB shared memory capacity (vs 163 KB on SM80)
Has TMA, but only single-CTA flavor
Same SM80-era mma.sync.aligned.m16n8k16 for FP16/BF16 MMA
The PRs bundled here adapt FA4's kernels to these constraints — runtime-correct dispatch, SMEM-budget-aware tiling, paged KV that fits in 99 KB, TMA-with-warp-spec for the loaded path, and a couple of crash fixes that block dispatch entirely.
1import sys
2sys.path.insert(0,"flash-attn-4-sm120/build/torch-cuda")3import importlib
4flash_attn_4 = importlib.import_module("flash_attn_4_sm120")# or whatever you alias the dir to
The kernels.get_kernel(...) path is recommended since it handles caching and dependency resolution automatically.
Forward: 64 / 64 configurations pass — max diff ≤ 0.0156 vs PyTorch f32 reference
Backward: 40 / 40 configurations pass (dq, dk, dv all within 0.05 vs PyTorch f32 reference)
Standalone install: validated via kernels.get_kernel(...) from a clean Python venv with only kernels, torch, nvidia-cutlass-dsl, apache-tvm-ffi, einops, quack-kernels installed — no flash-attn dependency required.
Performance
Patched HF FA4 vs vLLM's FA2 baseline on SM121a (DGX Spark), bf16, causal, Qwen3-style GQA Hq=16, Hkv=8, D=128, median of 30 iters after 5 warmups:
Shape (B, S, Hq, Hkv, D)
HF FA4 (ms)
vLLM FA2 (ms)
FA4 / FA2
(1, 128, 16, 8, 128)
0.036
0.021
1.71x
(1, 512, 16, 8, 128)
0.053
0.049
1.07x
(1, 1024, 16, 8, 128)
0.106
0.102
1.04x
(1, 2048, 16, 8, 128)
0.289
0.278
1.04x
(1, 4096, 16, 8, 128)
0.976
0.886
1.10x
(2, 512, 16, 8, 128)
0.075
0.069
1.09x
(4, 256, 16, 8, 128)
0.059
0.049
1.19x
(8, 256, 16, 8, 128)
0.109
0.104
1.05x
At very short sequences (S = 128) FA4's dispatch overhead dominates (~70% slower than FA2). At realistic Qwen 3 prefill lengths (S = 512 to 4096) FA4 is within 4 to 10 percent of FA2. This is consistent with the SM120 hardware: no tcgen05 / TMEM means FA4's primary speed path doesn't apply, so it compiles down to roughly the same SM80 era mma.sync compute as FA2 with a small dispatch overhead. Use this kernel for the FA4 only features (paged KV, score_mod, block sparse, dropout); use FA2 if pure attention throughput is the only goal.
Known limitations
GQA dispatches through the non-packed path on SM120 (PR #2484 workaround). Functionally correct on every GQA / MQA shape we tested. Throughput is within roughly 10% of fmha_v2 on the GQA shapes measured. Tracked upstream.
head_dim > 128 is not supported on SM120 — the 99 KB SMEM budget cannot hold the Q tile. This affects models like Qwen3.5-9B (D=256) and Qwen3-Coder-Next (D=256). vLLM's existing fa_utils.py gate already routes head_size > 128 to FA2 on Blackwell; this kernel maintains that boundary.
Split-KV not supported on SM120 in this kernel variant. PR #2336 implements it but the bundle's interface.py clamps num_splits to 1 on SM12x. Decode workloads use a single split, which is consistent with how vLLM and SGLang configure SM120 today.
Dropout runs but spills registers at tile_m=128, tile_n=128 non-causal; the bundle's interface.py falls back to tile_m=128, tile_n=64 (or tile_m=64, tile_n=64 for D > 64) when dropout_p > 0, which fixes the spill at a small throughput cost.
Hardware support outside SM120
The bundle inherits from upstream flash-attn-4's SM80 / SM90 / SM100 dispatch paths. Those should work the same as upstream main; the bundled PRs target SM120 specifically. We do not test SM80 / SM90 / SM100 — please open an issue if you find regressions.
For bundle-specific issues (the dispatch logic, validation gaps, packaging), open an issue on this HF repo. For kernel-level issues that exist upstream, file against Dao-AILab/flash-attention directly.
See also
CONFLICTS_LOG.md — detailed log of every conflict encountered while stacking the six PRs, with resolution and per-PR backport guidance