Skip to content

Stabilize FlashAttention CI environments - #3341

Merged
sudhakarsingh27 merged 8 commits into
NVIDIA:mainfrom
sudhakarsingh27:sudhakars/gate-fa4-sm8x-test-utils
Aug 13, 2026
Merged

Stabilize FlashAttention CI environments#3341
sudhakarsingh27 merged 8 commits into
NVIDIA:mainfrom
sudhakarsingh27:sudhakars/gate-fa4-sm8x-test-utils

Conversation

@sudhakarsingh27

@sudhakarsingh27 sudhakarsingh27 commented Aug 11, 2026

Copy link
Copy Markdown
Member

Summary

Stabilize attention CI when moving PyTorch images install multiple FlashAttention generations and CUTLASS packages.

Changes

  • Keep PyTorch L0 on FA2 while retaining fused and unfused attention coverage.
  • Run H100 L3 with FA3 and context parallelism; run B200 L3 with non-CP FA4.
  • Isolate each L3 FlashAttention distribution and backend flag.
  • Keep L1 context-parallel comparisons on FA2/FA3 until separate FA4 CP integration lands.
  • Give repository-local test utilities precedence over installed top-level utils packages.
  • Gate FA4 selection and dedicated tests on backend enablement and supported architectures/shapes.
  • Reject FA4 b24 with an older CUTLASS DSL and treat a broken optional FA4 interface import as unavailable instead of failing Transformer Engine import.

Why

The FlashAttention distributions share a Python namespace, and the moving image can make an unintended generation available to otherwise generic tests. Explicit suite ownership keeps L0 stable, makes L3 labels truthful, and prevents unsupported FA4 paths from obscuring other CI results.

An installed FA4 distribution is not necessarily usable when a later package installation changes its transitive CUTLASS stack. Checking the known b24 minimum and guarding the public FA4 interface import prevents that optional dependency failure from breaking unrelated test collection.

Validation

  • Bash syntax checks for the changed QA scripts.
  • Python compile check and clean diff check.
  • Focused FA4 import-guard checks cover absent FA4, an older CUTLASS DSL, a valid stack, and a nested dependency import failure.
  • Directed GPU validation on the preceding revision passed H100 FA2, FA3, and FA3 CP, and B200 FA4; follow-up validation is pending for this revision.
  • Full pre-commit bootstrap is blocked by the configured package mirror lacking setuptools>=80; relevant syntax and behavior checks pass independently.

@sudhakarsingh27 sudhakarsingh27 self-assigned this Aug 11, 2026
@greptile-apps

greptile-apps Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR stabilizes FlashAttention CI by assigning backend generations to specific suites and architectures, isolating conflicting distributions, and making optional FA4 loading resilient to incompatible CUTLASS installations.

  • Pins L0 attention coverage to FA2 and keeps context-parallel L1 coverage on FA2/FA3.
  • Assigns H100 L3 to FA3 with context parallelism and newer architectures to FA4 without context parallelism.
  • Adds FA4 architecture, shape, enablement, and dependency compatibility guards.
  • Ensures repository-local test utilities take precedence over installed top-level packages.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
qa/L3_pytorch_FA_versions_test/test.sh Isolates FlashAttention distributions and assigns one backend generation and context-parallel policy to each supported architecture.
transformer_engine/pytorch/attention/dot_product_attention/backends.py Guards FA4 loading against an incompatible CUTLASS DSL version and nested optional-interface import failures.
transformer_engine/pytorch/attention/dot_product_attention/utils.py Refines FA4 architecture and unsupported head-dimension filtering before backend dispatch.
transformer_engine/pytorch/attention/dot_product_attention/context_parallel.py Recognizes FA3 as supporting sliding-window attention in all-gather and all-to-all context-parallel paths.
tests/pytorch/attention/test_attention.py Gates dedicated FA4 tests on backend enablement, installation status, architecture, and supported shapes.
qa/L0_pytorch_unittest/test.sh Pins the general L0 PyTorch suite to FA2 while preserving fused and unfused attention coverage.
qa/L1_pytorch_distributed_unittest/test.sh Explicitly disables FA4 for context-parallel comparisons in both parallel and sequential CI execution.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  CI[Attention CI suite] --> L0[L0 PyTorch]
  CI --> L1[L1 distributed]
  CI --> L3[L3 FA versions]
  L0 --> FA2[FlashAttention 2]
  L1 --> CP[Context parallel tests]
  CP --> FA23[FlashAttention 2 or 3]
  L3 --> Arch{GPU architecture}
  Arch -->|SM90| FA3[FlashAttention 3 + CP]
  Arch -->|Above SM90| FA4[FlashAttention 4, non-CP]
  FA4 --> Guard{FA4 interface and CUTLASS compatible?}
  Guard -->|Yes| Enabled[Enable FA4 backend]
  Guard -->|No| Fallback[Mark FA4 unavailable]
Loading

Reviews (9): Last reviewed commit: "Guard FA4 against incompatible CUTLASS i..." | Re-trigger Greptile

cyanguwa
cyanguwa previously approved these changes Aug 11, 2026
@sudhakarsingh27
sudhakarsingh27 force-pushed the sudhakars/gate-fa4-sm8x-test-utils branch from b4ba75d to f0f4d3d Compare August 12, 2026 03:31
@sudhakarsingh27 sudhakarsingh27 changed the title Gate FA4 and stabilize attention test imports Stabilize PyTorch test utility imports Aug 12, 2026
sudhakarsingh27 and others added 5 commits August 11, 2026 22:50
FA4 can be installed on SM8x even though its current implementation rejects those GPUs. Disable selection and skip dedicated FA4 tests there so A100 and L40 use supported attention backends.

FA4 and CUTLASS can also expose a generic utils package on sys.path. Prepend the Transformer Engine test helper directory in the context-parallel test so collection resolves the intended utilities.

Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
Moving images can install FA4 alongside older FlashAttention generations, which mixes a shared Python namespace and can make context-parallel reference runs compile an unsupported backend. Isolate the L3 version matrix, keep current CP comparisons on FA2/FA3, and temporarily reject symmetric D512 FA4 on Blackwell until upstream kernel support is complete.

Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
FA4 and its CUTLASS dependency expose a top-level utils module after Transformer Engine imports. Appending the test root can therefore bind these late imports to the installed module and fail collection. Give the repository helper precedence in the four test files that exhibited this ordering.

Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
The all-gather and a2a guards use the FA2 package version check to recognize FlashAttention support, so an isolated FA3 run is rejected even though FA3 implements sliding-window attention. Accept the explicit FA3 backend in both guards.

Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
@sudhakarsingh27
sudhakarsingh27 force-pushed the sudhakars/gate-fa4-sm8x-test-utils branch from f0f4d3d to c88114d Compare August 12, 2026 05:51
@sudhakarsingh27 sudhakarsingh27 changed the title Stabilize PyTorch test utility imports Stabilize FlashAttention CI environments Aug 12, 2026
The CP runner must honor an explicit generation selected by its caller, particularly the existing B200 L3 FA4 lane. Remove its internal V4 override, restore the L3 SM100 selection changed in 0f6c71e, and disable V4 only for the L1 suite that still targets FA2/FA3. This keeps per-generation L3 isolation intact without making the shared runner silently override directed coverage.

Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
Comment thread qa/L1_pytorch_distributed_unittest/test.sh
Comment thread qa/L3_pytorch_FA_versions_test/test.sh
Keep L0 on the mature FA2 path while L3 owns newer-generation coverage. Restrict H100 L3 to FA3 and B200 L3 to non-CP FA4 so unsupported H100 FA4 kernels and mislabeled Blackwell CP results do not obscure the intended signal. Make FA4-specific tests honor backend enablement to prevent silent fallback under an FA4 label.

Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
@sudhakarsingh27

Copy link
Copy Markdown
Member Author

/te-ci pytorch L3

Package metadata can report FA4 present even when a later dependency install leaves its transitive CUTLASS stack unusable. Reject the known b24/CUTLASS combination below the stable 4.6.2 release and treat a nested interface ImportError as an unavailable optional backend so unrelated Transformer Engine imports can continue.

Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
@sudhakarsingh27
sudhakarsingh27 force-pushed the sudhakars/gate-fa4-sm8x-test-utils branch from 0ab272f to c048682 Compare August 13, 2026 07:19
@sudhakarsingh27
sudhakarsingh27 merged commit 7d0365b into NVIDIA:main Aug 13, 2026
10 of 14 checks passed
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.

2 participants