Repository navigation
Commit aa58996
[Pytorch][Attention][CP][CI] Make 3221 changes robust (#3438)
* Support no-load-balance THD with FlashAttention
FlashAttention 2 backward needs zeroed gradient outputs for deterministic grouped-query attention in this path. Permit unpadded FlashAttention backends because inter-sequence padding requires no backend-specific handling, and align the autograd return arity with the forward inputs.
Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Clarify no-load-balance backend constraints
Document why FA2 initializes backward gradient buffers and why inter-sequence padding remains limited to FusedAttention. This makes the supported backend matrix explicit without changing behavior.
Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
* Add no-load-balance FlashAttention regression coverage
Reuse the focused CP test across supported FlashAttention generations and force FA2 from L1 in a fresh process. Backend controls are read at import time, so a separate invocation covers deterministic FA2 GQA backward without adding runner plumbing.
Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
* Use backend selection for FlashAttention CP test
Query the existing backend selector for the exact THD context-parallel configuration instead of duplicating architecture and version gates in pytest. This keeps capability decisions in one place while allowing version-forced test invocations to exercise production selection logic.
Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
* Clarify forced FA2 regression coverage
Document why the focused deterministic case runs in a fresh process and how the version flags force FA2, while the full runs retain normal backend selection.
Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
* Rely on existing L1 attention runs
The general context-parallel test is already collected by both L1 attention invocations. Since this suite selects FA2, a separate forced deterministic invocation duplicates coverage without exercising a distinct path.
Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
---------
Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>1 parent ace1873 commit aa58996
2 files changed
Lines changed: 29 additions & 12 deletions
File tree
- tests/pytorch/attention
- transformer_engine/pytorch/attention/dot_product_attention
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
739 | 739 | | |
740 | 740 | | |
741 | 741 | | |
742 | | - | |
743 | | - | |
744 | | - | |
745 | | - | |
746 | | - | |
747 | | - | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
748 | 758 | | |
749 | 759 | | |
750 | 760 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4184 | 4184 | | |
4185 | 4185 | | |
4186 | 4186 | | |
| 4187 | + | |
| 4188 | + | |
| 4189 | + | |
| 4190 | + | |
| 4191 | + | |
| 4192 | + | |
| 4193 | + | |
4187 | 4194 | | |
4188 | 4195 | | |
4189 | 4196 | | |
| |||
4563 | 4570 | | |
4564 | 4571 | | |
4565 | 4572 | | |
| 4573 | + | |
4566 | 4574 | | |
4567 | 4575 | | |
4568 | 4576 | | |
| |||
5452 | 5460 | | |
5453 | 5461 | | |
5454 | 5462 | | |
5455 | | - | |
| 5463 | + | |
5456 | 5464 | | |
5457 | 5465 | | |
5458 | 5466 | | |
| |||
5540 | 5548 | | |
5541 | 5549 | | |
5542 | 5550 | | |
| 5551 | + | |
| 5552 | + | |
5543 | 5553 | | |
5544 | | - | |
5545 | | - | |
5546 | | - | |
5547 | | - | |
5548 | | - | |
| 5554 | + | |
| 5555 | + | |
5549 | 5556 | | |
5550 | 5557 | | |
5551 | 5558 | | |
| |||
0 commit comments