Skip to content

Select FA4 varlen attention on Blackwell - #4012

Merged
ezyang merged 3 commits into
mainfrom
gh/ezyang/4/head
Jul 29, 2026
Merged

ezyang merged 3 commits into
mainfrom
gh/ezyang/4/head

Conversation

@ezyang

@ezyang ezyang commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

ezyang added 2 commits July 29, 2026 09:44
[ghstack-poisoned]
[ghstack-poisoned]
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 29, 2026

@tianyu-l tianyu-l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

Comment thread torchtitan/tools/utils.py Resolved
@ezyang

ezyang commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

flagging this will need numerics upgrade

@ezyang

ezyang commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

in fact it's a master problem

…eat future archs as FA4

Rework `get_cuda_flash_attention_impl()` to build on the existing
`has_cuda_capability()` helper rather than reimplementing the CUDA/HIP
availability and device-capability checks inline. `has_cuda_capability`
already handles the "no CUDA / ROCm build" cases, so the explicit
`torch.cuda.is_available()` and `torch.version.hip` guards are dropped.

This also changes the selection logic from exact major-version matches to
lower-bound checks: SM 10.0+ (Blackwell and newer) now maps to FA4, and
SM 9.0 (Hopper) maps to FA3. As a result, hypothetical future
architectures (SM 11.0+) fall through to the newest known implementation
(FA4) instead of returning None. The unit test is updated accordingly so
that the (11, 0) case now expects "FA4".

[ghstack-poisoned]
ezyang added a commit that referenced this pull request Jul 29, 2026
ghstack-source-id: f9e8f88
Pull-Request: #4012
@ezyang

ezyang commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorch-bot

pytorch-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

Mergebot is not configured for this repository. Please use the merge button provided by GitHub.

@ezyang
ezyang changed the base branch from gh/ezyang/4/base to main July 29, 2026 18:31
@ezyang
ezyang merged commit 4bed502 into main Jul 29, 2026
8 of 11 checks passed
saforem2 added a commit to saforem2/torchtitan that referenced this pull request Jul 29, 2026
pytorch#4008 float8 filter_fqns -> replayed onto ezpz/moe (2db11d1).
pytorch#4012 FA4 Blackwell varlen -> CUDA-gated, XPU-inert, no replay.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/rl ciflow/8gpu CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants