Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
242 commits
Select commit Hold shift + click to select a range
ead67d3
[Cute,Fwd,Sm120] Disable use_tma_O in SM80 base class
jganbar May 11, 2026
bc67a9c
[Cute,Fwd,Sm120] Use universal smem-store atom for SM80 MMA layout
jganbar May 11, 2026
c0250ca
[Cute,Fwd,Sm120] Default pack_gqa=False on consumer Blackwell
jganbar May 11, 2026
e595c95
Add SM120 TMA forward kernel with warp specialization
blake-snc Mar 14, 2026
a6b9896
Fix arch override and add SMEM fallback in SM120 TMA forward
blake-snc Apr 2, 2026
bf10b6d
Move `stream` to end of FlashAttentionForwardSm120Tma.__call__
blake-snc Apr 18, 2026
b7be538
Add SM80/SM120 block-sparse forward attention support
blake-snc Mar 25, 2026
3cd8cb6
Use get_total_block_count utility for block-sparse early exit check
blake-snc Mar 25, 2026
cee3b54
SM120 (consumer Blackwell) integration: forward + backward end-to-end…
thad0ctor May 25, 2026
e06bc15
test: make backward postprocess white-box guard whitespace-agnostic
thad0ctor May 25, 2026
4670859
test: use deterministic per-pattern seeds instead of Python hash()
thad0ctor May 25, 2026
a0dd865
bench: backward tile sweep harness for SM120
thad0ctor May 25, 2026
47aa883
bench: loosen SM120 backward correctness tol to 0.1 abs
thad0ctor May 25, 2026
4d59090
cute: flip SM120 backward d<=64 default num_stages 2->1
thad0ctor May 25, 2026
362a65a
cute: SM120 backward repartition 4 warps -> 8 warps per block
thad0ctor May 25, 2026
55ab672
cute: SM120 backward v4 atomic dQ/dK/dV via 4-contig per-thread gmem …
thad0ctor May 25, 2026
dd8ef9b
cute: enable pack_gqa in SM120 backward (interface + kernel port)
thad0ctor May 26, 2026
8ec45d9
cute: keep SM120 bwd pack_gqa opt-in
thad0ctor May 26, 2026
78870f9
cute: store SM120 pack_gqa dkv accum directly
thad0ctor May 26, 2026
e63118b
cute: split SM120 pack_gqa backward m-loop
thad0ctor May 26, 2026
0e821f3
cute: coalesce SM120 pack_gqa dkv accum zero
thad0ctor May 26, 2026
bf6861f
cute: fuse SM120 pack_gqa dkv postprocess
thad0ctor May 26, 2026
d93408a
cute: skip aligned SM120 pack_gqa row guards
thad0ctor May 26, 2026
c43a7b4
cute: keep SM120 GQA forward on nonpacked path
thad0ctor May 26, 2026
1b7db10
cute: restore SM120 packed GQA forward path
thad0ctor May 26, 2026
d2d0ec2
bench: mark SM120 forward current winner
thad0ctor May 26, 2026
9b46c42
bench: record SM120 current FA2 comparison
thad0ctor May 26, 2026
37f3b27
cute: retune SM120 Qwen forward tile
thad0ctor May 26, 2026
f609c64
cute: optimize SM120 local forward dispatch
thad0ctor May 26, 2026
0af9a4c
cute: skip SM120 dense TMA seqlen masks
thad0ctor May 26, 2026
eb6e4b8
cute: skip SM120 dense base seqlen mask
thad0ctor May 26, 2026
e65b67a
cute: retune SM120 qpkv5 and local forward tiles
thad0ctor May 26, 2026
4c0b291
cute: retune SM120 Qwen forward tiles
thad0ctor May 26, 2026
37840d3
cute: retune SM120 long Qwen forward tiles
thad0ctor May 26, 2026
14459b8
cute: retune SM120 long Qwen forward tiles
thad0ctor May 26, 2026
5174f9e
cute: skip unneeded SM120 causal mask work
thad0ctor May 26, 2026
7466e10
cute: stage SM120 long qpkv5 Q in registers
thad0ctor May 26, 2026
f25e87e
cute: retune SM120 long qpkv5 forward
thad0ctor May 26, 2026
48c7d4d
cute: extend SM120 qpkv5 long causal retune
thad0ctor May 27, 2026
4e895b5
cute: tune SM120 qpkv6 TMA stages
thad0ctor May 27, 2026
ec6dd92
cute: tune SM120 qpkv5 noncausal TMA stages
thad0ctor May 27, 2026
ca7f03e
cute: narrow SM120 qpkv5 TMA retune
thad0ctor May 27, 2026
08c184f
cute: keep SM120 qpkv6 TMA retune noncausal
thad0ctor May 27, 2026
6a8f9ab
cute: revert unstable SM120 TMA stage retune
thad0ctor May 27, 2026
3dc3f22
cute: tune SM120 Gemma qpkv4 local forward
thad0ctor May 27, 2026
6b77ace
cute: tune SM120 qpkv5 midseq causal forward
thad0ctor May 27, 2026
6459f7d
cute: tune SM120 qpkv6 D256 forward load overlap
thad0ctor May 28, 2026
532331f
cute: retune SM120 qpkv5 16k forward
thad0ctor May 28, 2026
4774a0c
docs: add SM120 win ledger
thad0ctor May 28, 2026
c6051aa
docs: tighten SM120 win ledger scope
thad0ctor May 28, 2026
60354fd
cute: retune SM120 qpkv8 8k forward
thad0ctor May 28, 2026
a986d34
docs: record SM120 qpkv6 profiling note
thad0ctor May 28, 2026
bbe6294
docs: record SM120 qpkv6 hook scheduling result
thad0ctor May 28, 2026
3c34c6a
docs: record SM120 qpkv6 predicate probes
thad0ctor May 28, 2026
fb5d416
cute: address SM120 review correctness
thad0ctor May 28, 2026
56310a8
cute: close remaining SM120 review gaps
thad0ctor May 28, 2026
ced523f
cute: retune SM120 qpkv4 forward lookup
thad0ctor May 28, 2026
fdd8c12
docs: record SM120 qpkv4 lookup validation
thad0ctor May 28, 2026
09b885d
docs: record SM120 five-repeat broad sweep
thad0ctor May 28, 2026
b9261e6
docs: record rejected SM120 qpkv2 dense probe
thad0ctor May 28, 2026
f6cf982
docs: record SM120 five-repeat rerun
thad0ctor May 28, 2026
d6bdf7e
docs: record SM120 noisy miss repeat
thad0ctor May 28, 2026
4275428
docs: record SM120 ten-repeat broad sweep
thad0ctor May 28, 2026
e93f8ef
Tune SM120 D64 MHA forward lookup
thad0ctor May 29, 2026
3dcf691
Tune SM120 D128 qpkv4 forward lookup
thad0ctor May 29, 2026
85d75e0
Add SM120 paged KV for D192 and D256
thad0ctor May 29, 2026
1b7c366
Fix SM120 local test worktree import
thad0ctor May 29, 2026
7e29608
Add SM120 D256 backward baseline
thad0ctor May 29, 2026
3b236a5
docs: record SM120 forward tail reruns
thad0ctor May 29, 2026
610a666
cute: auto-pack SM120 qpkv8 noncausal backward
thad0ctor May 29, 2026
ed94071
docs: record SM120 D256 N32 backward rejection
thad0ctor May 29, 2026
bd5b29f
cute: auto-pack SM120 qpkv4 S8192 backward
thad0ctor May 29, 2026
74c0b4d
cute: expand SM120 qpkv4 S8192 backward auto-pack
thad0ctor May 29, 2026
5bbee40
docs: record SM120 D256 backward follow-up probes
thad0ctor May 29, 2026
08ea5fc
cute: expand SM120 D256 backward autopack rows
thad0ctor May 29, 2026
f5b5ea1
docs: record qpkv2 backward autopack extension
thad0ctor May 29, 2026
e01e891
cute: tune SM120 qpkv5 forward hooks
thad0ctor May 29, 2026
effed34
docs: record D64 MHA override rejection
thad0ctor May 29, 2026
e20ee42
cute: tune SM120 qpkv8 S4096 forward
thad0ctor May 29, 2026
76746ef
docs: record SM120 forward no-change probes
thad0ctor May 29, 2026
a05b301
cute: add SM120 fused dKV profiling gate
thad0ctor May 29, 2026
3b1f43f
cute: oversplit SM120 qpkv4 causal backward
thad0ctor May 29, 2026
1432c92
cute: fuse SM120 qpkv8 causal dkv postprocess
thad0ctor May 29, 2026
e943809
cute: gate SM120 qpkv8 fused dkv to bf16
thad0ctor May 29, 2026
7d12686
docs: record SM120 D256 backward retest results
thad0ctor May 29, 2026
30db028
docs: record SM120 D256 source probe rejections
thad0ctor May 29, 2026
8dc70d4
tests: harden SM120 review guards
thad0ctor May 29, 2026
229f87f
cute: split SM120 D256 qpkv6 qpkv8 causal bwd
thad0ctor May 29, 2026
2d7ce45
docs: record SM120 split2 B1 validation
thad0ctor May 29, 2026
89fe103
docs: record SM120 empty split rejection
thad0ctor May 29, 2026
3b276ae
cute: tune SM120 qpkv8 h8 causal bwd split
thad0ctor May 29, 2026
17ce38a
docs: record SM120 qpkv8 h8 split3 sweep
thad0ctor May 29, 2026
986d732
docs: record SM120 combined zero rejection
thad0ctor May 29, 2026
e59fa22
docs: record SM120 qpkv4 split rejection
thad0ctor May 29, 2026
cf39944
docs: record SM120 fused dKV rejections
thad0ctor May 29, 2026
4f1ea4d
cute: tune SM120 qpkv4 causal pack split
thad0ctor May 29, 2026
541cd4b
test: update SM120 qpkv4 split policy
thad0ctor May 29, 2026
32f1d31
docs: record SM120 qpkv6 bwd NCU
thad0ctor May 29, 2026
f5da596
docs: record SM120 split3 wide rejection
thad0ctor May 29, 2026
10dbd84
cute: tune SM120 qpkv8 long causal
thad0ctor May 29, 2026
d7f8a5d
cute: extend SM120 qpkv8 long causal tile
thad0ctor May 29, 2026
eb91374
docs: record SM120 qpkv5 tile rejection
thad0ctor May 29, 2026
557ce60
docs: record SM120 qpkv5 non-TMA rejection
thad0ctor May 29, 2026
a11ddad
docs: record SM120 D256 schedule rejections
thad0ctor May 29, 2026
a8632f8
docs: record SM120 long forward sweep
thad0ctor May 29, 2026
38fb046
docs: record SM120 long forward rejections
thad0ctor May 29, 2026
0d709fb
docs: record SM120 focused long no-patch probes
thad0ctor May 29, 2026
d11c0a1
docs: record SM120 post-qpkv8 broad sweep
thad0ctor May 29, 2026
a0fb2e2
docs: record SM120 S4096 forward rejections
thad0ctor May 29, 2026
8320cf4
cute: route SM120 qpkv5 S4096 noncausal off TMA
thad0ctor May 29, 2026
1ca5ca7
docs: record SM120 qpkv5 non-TMA sweep
thad0ctor May 29, 2026
6507984
docs: record SM120 qpkv4 pack-off rejection
thad0ctor May 29, 2026
1f1667d
docs: record SM120 qpkv8 noncausal rejections
thad0ctor May 29, 2026
f4bf650
cute: skip full causal masks for SM120 D256 bwd rows
thad0ctor May 29, 2026
e448d3e
cute: extend SM120 D256 causal mask skip to qpkv2
thad0ctor May 29, 2026
9078c7a
cute: reject SM120 varlen block sparsity on SM80 path
thad0ctor May 29, 2026
29ad06c
docs: reject SM120 D256 m-load predicate elision
thad0ctor May 29, 2026
65b4b5d
docs: update SM120 qpkv6 bwd profile baseline
thad0ctor May 29, 2026
fb21d97
docs: reject SM120 PackGQA row-map probe
thad0ctor May 29, 2026
a7c754a
docs: record SM120 qpkv8 H16 bwd profile
thad0ctor May 29, 2026
682a020
docs: reject SM120 D256 non-alias schedule
thad0ctor May 29, 2026
e09d6a2
docs: reject SM120 D256 cp.async cache-always
thad0ctor May 29, 2026
1a4a7ab
docs: reject SM120 B1 qpkv6 mask skip
thad0ctor May 29, 2026
9ed3b49
docs: reject SM120 TMA no-inf-check probe
thad0ctor May 29, 2026
9f29cce
tune SM120 qpkv5 S16384 B1 hooks
thad0ctor May 29, 2026
8ed047f
tune SM120 qpkv5 S16384 qregs
thad0ctor May 29, 2026
51a3c5b
docs: reject SM120 qpkv2 split probe
thad0ctor May 29, 2026
d6bf449
tune SM120 qpkv5 S16384 B2 qregs
thad0ctor May 29, 2026
d6dc1e9
tune SM120 qpkv5 S16384 qregs all batches
thad0ctor May 29, 2026
1278426
tune SM120 qpkv8 S65536 causal
thad0ctor May 29, 2026
83d9968
tune SM120 D256 qpkv8 qpkv16 noncausal
thad0ctor May 29, 2026
246a798
tune SM120 qpkv8 long noncausal
thad0ctor May 29, 2026
4f7e0f4
tune SM120 qpkv6 long hooks
thad0ctor May 29, 2026
2b988f5
limit SM120 qpkv6 hooks to stable rows
thad0ctor May 29, 2026
3db93aa
docs: reject SM120 qpkv5 long nc probes
thad0ctor May 29, 2026
fcb6352
tune SM120 qpkv6 causal block bounds
thad0ctor May 29, 2026
2fedf02
docs: record SM120 qpkv8 causal probe results
thad0ctor May 29, 2026
8f02987
tune SM120 qpkv8 D256 causal qregs
thad0ctor May 29, 2026
517282c
docs: reject SM120 qpkv8 D256 hook probe
thad0ctor May 29, 2026
77a7cb4
tune SM120 qpkv6 D256 long qregs
thad0ctor May 29, 2026
fcc906b
tune SM120 qpkv8 D256 causal qregs
thad0ctor May 29, 2026
8d7c388
docs: update SM120 win ledger after qregs probes
thad0ctor May 29, 2026
1d2d944
tune SM120 qpkv16 D256 causal qregs
thad0ctor May 29, 2026
fd8ddd6
docs: record current SM120 long sweep
thad0ctor May 29, 2026
e430ad2
docs: reject SM120 qpkv5 S8192 nonTMA probe
thad0ctor May 29, 2026
93d200b
docs: record SM120 qpkv8 D128 profile
thad0ctor May 29, 2026
3960316
docs: record post-qpkv16 broad sweep
thad0ctor May 29, 2026
43f1ea9
tune SM120 qpkv6 B2 qregs rows
thad0ctor May 29, 2026
641a895
docs: record qpkv6 B2 broad sweep
thad0ctor May 29, 2026
cf0a7f0
docs: record rejected SM120 forward gap probes
thad0ctor May 29, 2026
5cbf8fc
docs: record SM120 pause-point forward sweep
thad0ctor May 29, 2026
3f7b69c
docs: record rejected SM120 D128 forward probes
thad0ctor May 29, 2026
6125775
optimize SM120 packed GQA valid rows
thad0ctor May 29, 2026
af5a57d
record SM120 pause benchmark
thad0ctor May 29, 2026
d49655e
tune SM120 qpkv6 S8192 noncausal
thad0ctor May 29, 2026
b782823
tune SM120 qpkv4 backward mask skip
thad0ctor May 29, 2026
5dc126d
docs: record SM120 rejected probes
thad0ctor May 29, 2026
cd1b3e3
docs: record SM120 S2048 backward pause point
thad0ctor May 29, 2026
dfb7a24
tune SM120 qpkv4 S2048 backward
thad0ctor May 29, 2026
7a6e8c8
tune SM120 D128 forward tiles + qpkv2 backward split for RTX 6000
thad0ctor Jun 2, 2026
a787c10
tune SM120 D256 forward qpkv6 causal + gemma local for RTX 6000
thad0ctor Jun 2, 2026
0f2c962
docs: record RTX 6000 overnight backward lever sweep (all rejected)
thad0ctor Jun 2, 2026
7452f90
tune SM120 gemma-e2b qpkv8 S2048 backward split for RTX 6000
thad0ctor Jun 2, 2026
a8027b6
tune SM120 B=1 / large-S causal backward splits for RTX 6000
thad0ctor Jun 2, 2026
729d69c
tune SM120 B=1 S1024 causal backward splits for RTX 6000
thad0ctor Jun 2, 2026
cbf1108
tune SM120 B=1 qpkv4 S2048 causal backward split for RTX 6000
thad0ctor Jun 2, 2026
eb76554
tune SM120 B=1 qpkv4 S4096 causal backward split for RTX 6000
thad0ctor Jun 2, 2026
d8e6524
docs: record multi-agent across-the-board pass (fwd tuned; bwd kernel…
thad0ctor Jun 2, 2026
b71bc13
speed: SM120 D128 long-seq backward asymmetric pipeline stage (RTX 6000)
thad0ctor Jun 2, 2026
878083f
docs: sm_120 has no tcgen05/TMEM (D256 backward wall is a hardware li…
thad0ctor Jun 2, 2026
d73a6d5
speed: enable qpkv6 D256 S16384 causal static block bounds (RTX 6000)
thad0ctor Jun 2, 2026
114de65
docs: fused-dKV broadening re-test flat (mining pass complete)
thad0ctor Jun 2, 2026
c410897
docs: double-check correctness audit + flag pre-existing local-bwd bug
thad0ctor Jun 2, 2026
c29cc0e
fix: SM120/SM80 local/sliding-window backward gradients (was garbage)
thad0ctor Jun 2, 2026
50cc3b6
speed: windowed m-block range for SM120/SM80 local backward
thad0ctor Jun 2, 2026
09be437
docs: record local-window backward fix (correctness + windowed m-rang…
thad0ctor Jun 2, 2026
ea9770c
docs: sibling-bug hunt — local fix robust; flag bidirectional-window …
thad0ctor Jun 2, 2026
21d8159
test: add SM120 D256 local/sliding-window BACKWARD regression test
thad0ctor Jun 2, 2026
318eccb
fix: non-causal symmetric sliding-window forward (block re-processing…
thad0ctor Jun 2, 2026
9515d12
test: add SM120 non-causal bidirectional sliding-window regression (f…
thad0ctor Jun 2, 2026
2506f42
docs: record bidirectional sliding-window forward fix
thad0ctor Jun 2, 2026
254f78d
docs: "sm_120 feature gaps" are a pre-existing test-batching artifact…
thad0ctor Jun 2, 2026
d27ebd0
fix: varlen + GQA forward produced garbage for sequences after the first
thad0ctor Jun 2, 2026
58a2114
docs: correct the "feature gaps" conclusion — real varlen+GQA bug, no…
thad0ctor Jun 2, 2026
8f6bfb3
test: relative tolerance for qpkv16 D256 backward (was mis-scaled abs…
thad0ctor Jun 2, 2026
1de4caa
fix: varlen+GQA backward dK/dV for non-block-aligned cu_seqlens
thad0ctor Jun 2, 2026
de61afa
docs: sweep 'losses' are a clock-boost measurement artifact, not kern…
thad0ctor Jun 2, 2026
0069fd9
perf: SM120 D128 qpkv5 S4096 causal fwd tile 64x128->128x64 (+2.8% vs…
thad0ctor Jun 2, 2026
e040276
docs: true bwd-d128 standing is parity at S>=4096 (in-process); 0.966…
thad0ctor Jun 2, 2026
305e623
docs: S1024 bwd-d128 resolved as parity-to-win (1.03-1.05); no real b…
thad0ctor Jun 2, 2026
728c4bf
perf: SM120 general D256 forward wide tile 64x64->128x64+Qregs+256t a…
thad0ctor Jun 3, 2026
357b524
perf: SM120 D128 qpkv4 S1024 causal fwd tile 64x64->64x96 (+5-6%, fli…
thad0ctor Jun 3, 2026
ea5b06a
fix: support learnable_sink on the SM80-base forward kernel (SM120 D2…
thad0ctor Jun 3, 2026
527f58d
docs: post-fix fwd sweep 1.044 (D256 1.072); D128 laggards are bias, …
thad0ctor Jun 3, 2026
a7b8d01
perf: SM120 gemma-local D256 forward wide tile 64x16/32 -> 128x{32,64…
thad0ctor Jun 3, 2026
30fa0f7
docs: final forward standing 1.053 geomean (was 1.015); gemma-local l…
thad0ctor Jun 3, 2026
68e86b0
perf: extend SM120 D256 wide tile to S2048 non-causal (num_head>=16, …
thad0ctor Jun 3, 2026
640debe
docs: D256 backward is parity in-process (0.996, 13/28 wins); the 'oc…
thad0ctor Jun 3, 2026
315c5e4
perf: extend SM120 D256 wide tile to S2048 causal qpkv16 (num_head>=3…
thad0ctor Jun 3, 2026
4d8c32b
docs: backward deep-profiling — reg-bound 255/1-CTA (D128 too, w/ spi…
thad0ctor Jun 3, 2026
c4077ac
docs: backward ncu profiling — D128 compute-bound, D256 global-reload…
thad0ctor Jun 3, 2026
b0bd28a
docs: backward redesign de-risk — dK/dV split infeasible (~137 reg); …
thad0ctor Jun 3, 2026
98cc0e2
docs: REJECT L2-residency bwd scheduler on SM120 (1.5-2.5x slower; de…
thad0ctor Jun 3, 2026
7d27475
perf: extend SM120 D256 wide tile to varlen forward (+7-11% packed-seq)
thad0ctor Jun 3, 2026
5bfc7c1
perf: extend SM120 gemma-local D256 wide tile to varlen forward
thad0ctor Jun 3, 2026
e5e18d0
perf: SplitKV (FlashDecoding) for SM120 forward — decode 2-4x (was di…
thad0ctor Jun 3, 2026
512254c
perf: D128 decode tile 128x64 -> 16x64/1-warp (+50-68% on SplitKV dec…
thad0ctor Jun 3, 2026
b3f807a
perf: custom sm_120 GEMV decode kernel (FlashAttentionDecodeSm120, ga…
thad0ctor Jun 3, 2026
2268f09
docs: decode occupancy-crack is a validated NEGATIVE — kernel is memo…
thad0ctor Jun 3, 2026
5b80257
docs: decode coalescing NEGATIVE + correction — gmem already coalesce…
thad0ctor Jun 3, 2026
86f0ee5
perf: paged-KV D128 forward tile 128x128 -> 64x64/128t (~1.8x, infere…
thad0ctor Jun 3, 2026
6bc1ff9
docs: creative opportunity-hunt outcome — paged-KV D128 1.84x banked;…
thad0ctor Jun 3, 2026
6e17038
feat: fp8 (e4m3) KV-cache decode for sm_120 — 1.6-1.85x at R<=4 (gated)
thad0ctor Jun 3, 2026
078fd08
perf: fp8 decode R8 two-level reduction — +10-13% at GQA R8 (gated)
thad0ctor Jun 3, 2026
f9e7c3b
feat: auto-enable fp8 KV-cache decode + unsupported-shape guard + pytest
thad0ctor Jun 3, 2026
efe7aef
perf: D128 GQA-4 S2048 causal tile 64x96 -> 128x64+ns2 (stabilizes vs…
thad0ctor Jun 3, 2026
5b7aab1
docs: forward re-sweep outcome — 1 win banked, otherwise at floor
thad0ctor Jun 3, 2026
f0c91b9
perf: wire up LPT scheduler for causal/local forward — closes D128 MH…
thad0ctor Jun 3, 2026
1647701
docs: causal-MHA large-S residual is intrinsic (255-reg/1-CTA occupan…
thad0ctor Jun 3, 2026
4e8b02a
docs: document sm_120 (consumer Blackwell) support, fp8 KV decode, an…
thad0ctor Jun 3, 2026
4e4a296
test: skip deterministic backward on sm_120 (SM80-base bwd lacks dQ-s…
thad0ctor Jun 3, 2026
7f6929e
refactor: remove experimental SM120 tuning env-flag hatches, hardcode…
thad0ctor Jun 4, 2026
bfad828
chore: drop internal campaign notes (win.md, SM120 perf log) from tra…
thad0ctor Jun 4, 2026
be2cecc
fix: two sm_120 correctness bugs (learnable_sink+SplitKV, negative-of…
thad0ctor Jun 4, 2026
5ff86ed
fix: address CodeRabbit review + fix two sm120 correctness bugs (sink…
thad0ctor Jun 4, 2026
eeccc8a
fix: lift the learnable_sink single-split guard (all SplitKV archs ga…
thad0ctor Jun 4, 2026
0763a09
perf: D128 S512 GQA forward -> small 2-CTA/SM tiles (+5-11%, from ups…
thad0ctor Jun 4, 2026
0d6889b
fix: include sm120_tma_kv_stages in the forward compile-cache key
thad0ctor Jun 4, 2026
34f2dec
refactor: strictly gate sm_120 shared-code changes to sm_120; PR cleanup
thad0ctor Jun 6, 2026
b6e5a47
perf: D256 GQA4 S512 dense backward -> M-split=2 for underfilled grid…
thad0ctor Jun 6, 2026
2d25e27
perf: 5 more B=1 D256 backward M-split wins for underfilled grids (+1…
thad0ctor Jun 6, 2026
7c46d81
fix: sm120 varlen forward TypeError (decode-tile guard ordering)
thad0ctor Jun 8, 2026
e416d77
fix: strictly gate two shared-forward changes to sm120 (non-regression)
thad0ctor Jun 8, 2026
c7e9464
fix: sm120 paged-KV SplitKV wrote all splits to partial-slot 0 (NaN/w…
thad0ctor Jun 8, 2026
1a9d81d
fix: sm120 pack_gqa + SplitKV + varlen scattered partial slots (NaN/g…
thad0ctor Jun 8, 2026
05b0720
fix: sm120 block-sparse forward WAR race on single-stage smem K/V (ma…
thad0ctor Jun 8, 2026
4d24a30
fix: sm120 block-sparse dispatch omitted q_subtile_factor (wrong outp…
thad0ctor Jun 8, 2026
3864c8e
test: arch-skip sm120 documented-unsupported cases (clean green suite)
thad0ctor Jun 8, 2026
902f7e6
chore: PR-prep cleanups (ruff format, copyright header, drop dev benc…
thad0ctor Jun 8, 2026
3db79aa
fix: guard sm120 fp8 KV-cache decode against the cutlass-dsl 4.5.2 re…
thad0ctor Jun 8, 2026
be3040f
chore: de-serialize sm120 dispatch comments for upstream readability
thad0ctor Jun 8, 2026
772ff18
perf: pack-gqa-aware sm120 SplitKV partial epilogue (re-enable pack_g…
thad0ctor Jun 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions flash_attn/cute/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,45 @@ from flash_attn.cute import flash_attn_func, flash_attn_varlen_func
out = flash_attn_func(q, k, v, causal=True)
```

## Consumer Blackwell (sm_120 / RTX PRO 6000, RTX 50-series)

FA4 runs on consumer Blackwell (compute capability 12.x), which exposes SM80-class
`mma.sync` tensor cores (no WGMMA/tcgen05/TMEM). Dispatch and tile selection are
auto-tuned for this arch; no environment variables are required for normal use.

**Supported:** forward and backward for dense, causal, and local/sliding-window
attention; MHA / GQA / MQA; variable-length (`flash_attn_varlen_func`); paged-KV;
block sparsity; `score_mod` / `mask_mod`; learnable sink. Head dims 64/96/128/192/256.

**fp8 KV-cache decode (e4m3/e5m2):** for decode (`seqlen_q == 1`) with a quantized
K/V cache and a bf16/fp16 query, pass fp8 `k`/`v` plus per-`(batch, kv_head)` fp32
`k_descale`/`v_descale`. This auto-routes to a memory-efficient GEMV decode kernel
(no env var needed) and is ~1.6–1.9× faster than bf16 at GQA ratios ≤ 4 while halving
KV-cache bandwidth. Accuracy is within ~2e-3 of an fp8-quantized reference.

**Environment flags:**
- `FLASH_ATTENTION_SM120_DECODE_KERNEL=1` — opt into the experimental **bf16** GEMV
decode kernel for `seqlen_q == 1` (the fp8 decode path above is always on when fp8
K/V is supplied). Off by default.
- `FLASH_ATTENTION_ARCH` — override the detected compute capability (testing/compile).

**Known performance floors vs FA2 on sm_120** (hardware-bound, not bugs):
- Causal *MHA* (`qhead_per_kvhead == 1`) at `seqlen ≥ 8192` is ~0.95× FA2 — a register/
occupancy wall (255 regs/thread → 1 CTA/SM). GQA (the common case) is at parity or faster.
- fp8 KV-cache decode regresses below bf16 at GQA ratio ≥ 8 (the GEMV loop becomes
compute-bound); it still halves KV memory, so it remains the only fp8-cache path.
- Backward is at ~parity with FA2; fp8 is forward/decode-only (no fp8 backward).

**Feature limitations on sm_120:**
- `learnable_sink` is incompatible with SplitKV (each split would double-count the sink
in the combine step), so SplitKV is disabled when a sink is present — attention runs
in a single split (correct, but without the decode SplitKV speedup).
- Negative-offset sliding windows (`window_size` with a negative bound, e.g. `(None, -X)`
or `(-X, None)`) are forward-only: the backward raises `NotImplementedError` (its
dK/dV are incorrect for these offset windows). Non-negative windows are fully supported.
- Deterministic backward (`deterministic=True`) is not supported (the SM80-base backward
lacks the dQ-semaphore path).

## Development

```sh
Expand Down
109 changes: 109 additions & 0 deletions flash_attn/cute/block_sparse_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) 2025, Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, Pradeep Ramani, Tri Dao.
"""
Block-sparse runtime utilities for CUTE DSL kernels.

Expand Down Expand Up @@ -705,6 +706,114 @@ def produce_block_sparse_loads_sm100(
return kv_producer_state, q_producer_phase


@cute.jit
def run_block_sparse_mainloop_sm80(
blocksparse_tensors: BlockSparseTensors,
batch_idx,
head_idx,
m_block,
mma_one_n_block,
mask_fn,
mask_mod,
fastdiv_mods,
qhead_per_kvhead: cutlass.Constexpr[int] = 1,
q_subtile_factor: cutlass.Constexpr[int] = 1,
):
"""Block-sparse mainloop iteration for SM80/SM120.

NOTE: This implementation hard-codes the non-varlen 4D indexing pattern
(lines below this docstring access blocksparse_tensors with 3D indices into
batch/head/m_block_sparse). Varlen + block-sparse on SM80/SM120 would
require routing through get_curr_blocksparse_tensors(...) (which handles
both 2D varlen and 4D non-varlen layouts) and threading seqlen_info into
this function. The SM120 dispatcher in interface.py currently does not
support varlen + block-sparse together, so this is intentionally narrow;
if you lift that restriction, update this function accordingly.

Processes mask blocks first (applying mask_mod), then full blocks (seqlen masking only).
The first full block always receives seqlen masking regardless of whether mask blocks
preceded it, since full blocks may be at higher n positions than mask blocks.

Mirrors the non-intra-wg-overlap path of consume_block_sparse_loads for SM90/SM100.

Args:
mma_one_n_block: callable with signature
(n_block, mask_fn, is_first_n_block) -> None
mask_fn: partial of mask.apply_mask with batch/head/m_block/thr_mma already bound.
Called as mask_fn(acc_S, n_block=n, mask_mod=..., mask_seqlen=...,
fastdiv_mods=...)
mask_mod: the user mask_mod constexpr (None → no mask_mod application)
fastdiv_mods: fast-division helpers when mask_mod is not None

Returns:
processed_any: True if at least one block was processed.
"""
# SM80/SM120 only need the first 4 fields; trailing fields are SM100/backward-only.
mask_block_cnt, mask_block_idx, full_block_cnt, full_block_idx, *_ = blocksparse_tensors

m_block_sparse = sparse_tensor_m_block(m_block, qhead_per_kvhead, q_subtile_factor)

curr_mask_block_cnt = mask_block_cnt[batch_idx, head_idx, m_block_sparse]
curr_mask_block_idx = mask_block_idx[batch_idx, head_idx, m_block_sparse, None]

if const_expr(full_block_cnt is not None):
curr_full_block_cnt = full_block_cnt[batch_idx, head_idx, m_block_sparse]
curr_full_block_idx = full_block_idx[batch_idx, head_idx, m_block_sparse, None]
else:
curr_full_block_cnt = Int32(0)
curr_full_block_idx = None

processed_any = curr_mask_block_cnt + curr_full_block_cnt > 0

# Process mask blocks: first gets is_first=True and seqlen masking; rest get is_first=False.
if curr_mask_block_cnt > 0:
n_block = curr_mask_block_idx[curr_mask_block_cnt - 1]
mma_one_n_block(
n_block=n_block,
mask_fn=partial(
mask_fn,
mask_mod=mask_mod,
mask_seqlen=True,
fastdiv_mods=fastdiv_mods if const_expr(mask_mod is not None) else None,
),
is_first_n_block=True,
)
for i in cutlass.range(1, curr_mask_block_cnt):
n_block = curr_mask_block_idx[curr_mask_block_cnt - 1 - i]
mma_one_n_block(
n_block=n_block,
mask_fn=partial(mask_fn, mask_mod=mask_mod, mask_seqlen=False),
is_first_n_block=False,
)

# Process full blocks: first full block always gets seqlen masking (it may be at the
# highest n position even when mask blocks were present). No mask_mod applied.
if const_expr(full_block_cnt is not None):
if curr_full_block_cnt > 0:
n_block = curr_full_block_idx[curr_full_block_cnt - 1]
if curr_mask_block_cnt == 0:
mma_one_n_block(
n_block=n_block,
mask_fn=partial(mask_fn, mask_mod=None, mask_seqlen=True),
is_first_n_block=True,
)
else:
mma_one_n_block(
n_block=n_block,
mask_fn=partial(mask_fn, mask_mod=None, mask_seqlen=True),
is_first_n_block=False,
)
for j in cutlass.range(1, curr_full_block_cnt):
n_block = curr_full_block_idx[curr_full_block_cnt - 1 - j]
mma_one_n_block(
n_block=n_block,
mask_fn=partial(mask_fn, mask_mod=None, mask_seqlen=False),
is_first_n_block=False,
)

return processed_any


@cute.jit
def get_total_block_count(
blocksparse_tensors: BlockSparseTensors,
Expand Down
Loading