Skip to content

Draft: add SM120/SM121 CpAsync forward path - #14

Draft
ZYC99 wants to merge 1 commit into
demonatic:mainfrom
ZYC99:sm121-cpasync-forward
Draft

ZYC99 wants to merge 1 commit into
demonatic:mainfrom
ZYC99:sm121-cpasync-forward

Conversation

@ZYC99

@ZYC99 ZYC99 commented Jun 6, 2026

Copy link
Copy Markdown

Summary

Add an initial inference-only forward path for NVIDIA Blackwell GeForce / GB10
(sm120 / sm121) to flash_attn_cute.

The current SM100 path uses tcgen05 instructions, which are not available on
GB10. This draft instead reuses the existing SM80-style CpAsync + warp-level
mma.sync forward implementation, matching the instruction strategy validated
by NVIDIA/cutlass#3030.

Initial scope

  • BF16 / FP16 forward
  • head dimensions 64 and 128
  • fixed-length full, causal, local, score-mod, mask-mod, and arbitrary-mask attention
  • dense traversal when arbitrary/mask-mod calls also provide block-sparse metadata
  • explicit SM12.x dispatch without routing through the SM100 tcgen05 kernel

Not supported yet

  • backward
  • varlen / seqused
  • SplitKV
  • paged KV
  • learnable sink
  • block-sparse-only semantics
  • performance tuning

Changes

  • add FlashAttentionForwardSm120, selecting the CpAsync / warp MMA implementation
  • add SM12.x forward dispatch with conservative SM120 configuration
  • fix optional LSE handling in the reused SM80-style forward path
  • add SM120-family FP16/BF16 full/causal and arbitrary-mask correctness tests against PyTorch SDPA

Validation

  • python -m compileall -q flash_attn/cute tests/cute/test_flash_attn_sm120.py
  • git diff --check

The SM120/SM121 tests require real hardware and have not been executed in the
Windows authoring environment. I have access to a GB10 system for follow-up
validation. This is intentionally a draft until it compiles and passes
correctness tests on GB10.

Related implementation reference: NVIDIA/cutlass#3030

Related downstream: SandAI-org/MagiAttention FFA_FA4 and NVIDIA LocateAnything-3B inference

@ZYC99

ZYC99 commented Jun 6, 2026

Copy link
Copy Markdown
Author

Downstream tracking issue: SandAI-org/MagiAttention#321

SM120 implementation-reference follow-up: NVIDIA/cutlass#3030 (comment)

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