Repository navigation
[PyTorch][CP] Support D=256 THD metadata with FA4 b33 - #3540
Merged
sudhakarsingh27 merged 10 commits intoOct 12, 2026
Merged
sudhakarsingh27 merged 10 commits into
sudhakarsingh27 merged 10 commits into
Conversation
Contributor
|
sudhakarsingh27
force-pushed
the
sudhakars/compact-fa-metadata-no-load-balance
branch
from
September 17, 2026 21:24
1b363bb to
fd8b678
Compare
Member
Author
|
/te-ci pytorch L3 |
1 similar comment
Member
Author
|
/te-ci pytorch L3 |
sudhakarsingh27
force-pushed
the
sudhakars/compact-fa-metadata-no-load-balance
branch
from
September 28, 2026 18:12
e2f2d2f to
ee0265a
Compare
sudhakarsingh27
force-pushed
the
sudhakars/compact-fa-metadata-no-load-balance
branch
from
September 28, 2026 18:38
ee0265a to
f4655fb
Compare
Member
Author
|
/te-ci pytorch L3 |
This was referenced Sep 30, 2026
FA4 b31 added seqused_q/k forward support for the SM100 D=256 kernel, while b33 added backward support. Select FA4 by the installed release and actual backward eligibility, retain the deterministic backward guard, and exercise the released b33 dependency stack in L3. Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
Protect the release boundary with focused selector cases and extend the existing no-load-balance CP test to run D=256. This verifies the existing all-gather metadata path without adding strategy-specific production plumbing. Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
sudhakarsingh27
force-pushed
the
sudhakars/compact-fa-metadata-no-load-balance
branch
from
October 6, 2026 23:08
72241c0 to
1afbbc2
Compare
FA4 b33 treats TE's -1 unbounded window sentinel as a literal offset, so the D=256 coverage in this PR needs the adapter from NVIDIA#3532 at all four FA4 entry points. Bring that final adapter change into this branch instead of leaving the new FA4 path dependent on another open PR. Keep the regression tests in test_attention_backend_selection.py alongside the focused FA4 tests. Cover both window argument forms and preserved negative offsets, compare every batch and head with a float64 reference, and run these cases under the FA4 b33 L3 lane. Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
Keep the adapter comment focused on the sentinel contract and the FA4-only boundary. Name the numerical test for its independent reference and remove the redundant all-zero assertion, which singled out one symptom already caught by the full-output comparison. Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
The standalone D=128 BSHD comparison does not exercise the D=256 THD path added by this PR. Keep the direct window-sentinel regression in L3; existing attention tests provide numerical comparisons. Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
The argument-only sentinel test cannot prove the adapted FA4 call produces correct attention; generic cross-backend comparisons may skip. Restore the independent reference check and keep only representative left, right, and non-sentinel cases for both window argument forms. Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
Member
Author
|
/te-ci pytorch L1 L3 |
cyanguwa
reviewed
Oct 8, 2026
cyanguwa
reviewed
Oct 8, 2026
cyanguwa
reviewed
Oct 8, 2026
cyanguwa
reviewed
Oct 8, 2026
cyanguwa
reviewed
Oct 8, 2026
cyanguwa
reviewed
Oct 8, 2026
cyanguwa
reviewed
Oct 8, 2026
cyanguwa
reviewed
Oct 8, 2026
cyanguwa
reviewed
Oct 8, 2026
CUTLASS DSL 4.8.0 recognizes SM107 while the previous pin does not, so keep the FA4 L3 dependency and installation guidance aligned. Running the small backend-selection module directly covers its eligibility and window-sentinel cases without a bespoke node list. Clarify that non-all-gather THD metadata depends on pad_between_seqs. Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
A dedicated D=256 model preserves separate QK and V dimensions without a one-off runner override. Exclude it from the broad CP matrix because the no-load-balance test already exercises the intended path. The L3 causal cross-backend cases cover numerical behavior, so retain the sentinel unit test and remove the redundant standalone reference test. Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
Query backend availability before deciding whether to skip the D=256 case. Supported FA4 b33 configurations should fail when FA4 is unexpectedly unavailable, while unsupported configurations still skip. Keep the general no-Flash skip separate from the D=256 assertion. Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
The earlier D=256 broad-matrix exclusion kept cp_2_4 in the essential FlashAttention catalog solely for the focused no-load-balance case. That mixes model availability with test selection. Keep the full FlashAttention and FusedAttention catalogs available to the runner and focused tests, and narrow only the essential broad CP parametrizations. Non-essential broad runs continue to use the full catalog. Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
cyanguwa
approved these changes
Oct 9, 2026
Member
Author
|
/te-ci pytorch L1 L3 |
yueming-yuan
added a commit
to radixark/TransformerEngine
that referenced
this pull request
Oct 31, 2026
… FA4 (#3) FA4 treats -1 as a literal window offset, so TE's causal (-1, 0) became a local window: wrong attention at every head dim and an assert in the SM100 head_dim=256 backward.
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.
Summary
FlashAttention 4 b33 adds backward support for D=256 THD attention with per-sequence length metadata on SM100/SM110. This PR selects FA4 only when the installed version supports the requested direction: b31–b32 for forward, b33+ for forward and backward. Earlier versions fall back, and deterministic D=256 backward remains excluded.
Transformer Engine uses
-1for an unbounded attention window, while FA4 expectsNone. This PR translates that sentinel at the FA4 entry points without changing other negative window offsets.The SM100+ L3 test lane uses FA4 b33 with CUTLASS DSL 4.8.0. It covers D=256 no-load-balance context parallelism and window handling, and runs the full backend-selection test module for FA4.
Validation
H100 FA3 and B200 FA4 b33 L3 tests passed. The expanded B200 CP run (
NVTE_TEST_ESSENTIAL=0) recorded 1,389 passes, 54,489 skips, and no failures. Focused reruns passed the backend-selection module and D=128/D=256 no-load-balance cases. The final test-only skip/assertion edit passed Python 3.12 compilation andgit diff --check; it has not had another GPU run.