Skip to content

[ROCm] Re-enable FSDP2+TP 2D MLP tests on MI200 - #205508

Closed
albmalamd wants to merge 2 commits into
pytorch:mainfrom
ROCm:albmalamd/mi200-enable-2d-mlp-tests
Closed

albmalamd wants to merge 2 commits into
pytorch:mainfrom
ROCm:albmalamd/mi200-enable-2d-mlp-tests

Conversation

@albmalamd

@albmalamd albmalamd commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Linked issue or supporting maintainer

Fixes #168404
Fixes #168405
Fixes #168406
Fixes #168407

BC-breaking?

No

Summary (human written only)

The MI200 skips on test_2d_mlp_with_nd_mesh and test_train_parity_2d_mlp (added in #164390)
were covering a GPU-side RCCL deadlock in the ROCm 10.0 user-space stack, not a PyTorch bug
(ROCm/rccl#2191). With ROCm 10.1, which trunk CI now uses (#196753), both tests pass on gfx90a,
so this removes the skips. test_fully_shard_training_overlap is unchanged: its ROCm >= 10.1 skip
is still needed because of the reduced hardware-queue count, not because of this hang.

Agent details (if applicable)

AI-generated (Claude, via Cursor), reviewed by the submitter.

  • Root cause: the hang is on the GPU with the ROCm 10.0 user-space stack. RCCL kernels run concurrently on several communicators (FSDP2's priority=-1 streams plus TP on the current stream) and deadlock. All GPUs stay 100% busy while the host threads, including RCCL's proxy threads, sit idle. It matches Multi-communicator concurrent collectives deadlock on gfx90a (FSDP2+TP); NCCL_LAUNCH_ORDER_IMPLICIT=1 rescues 2-comm case but not 3-comm ROCm/rccl#2191.
  • Not PyTorch: torch 2.15 and 2.16 behave identically on ROCm 10.0, and the same stream pattern without RCCL never stalls.
  • Fixed in ROCm 10.1: trunk already runs ROCm 10.1 ([ROCm] Bump trunk ROCm version to 10.1 #196753). The fix holds with DEBUG_HIP_IGNORE_STREAM_PRIORITY=0 or DEBUG_CLR_AQL_BARRIER_OPT=0, so neither of those 10.1 default changes is the fix. ROCr 10.1 alone does not fix it, which leaves CLR and/or RCCL. The exact commit was not isolated.
  • Test plan (8x MI250X, with the skips removed):
    • ROCm 10.1: test_2d_mlp_with_nd_mesh 7/7 pass, plus 3/3 with DEBUG_HIP_IGNORE_STREAM_PRIORITY=0; test_train_parity_2d_mlp 3/3 pass.
    • ROCm 10.0: test_2d_mlp_with_nd_mesh fails 5/5 at the 300s timeout.
  • Rejected workarounds: forcing normal priority in FSDP2 on ROCm, or setting DEBUG_HIP_IGNORE_STREAM_PRIORITY=1 or GPU_MAX_HW_QUEUES=16.
  • Lint: not run locally (no spin/lintrunner in the environment).

cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @naromero77amd @pragupta @jerrymannil @xinyazhang

test_2d_mlp_with_nd_mesh and test_train_parity_2d_mlp were skipped on
MI200 (gfx90a) in pytorch#164390 because they hang. The hang is not in PyTorch:
with the ROCm 10.0 user-space stack, RCCL collective kernels issued
concurrently on several communicators (FSDP2 on its priority=-1 streams,
TP on the current stream) deadlock on the GPU. All GPUs stay 100% busy
while the host threads, including RCCL's proxy threads, sit idle. The
same stream pattern without RCCL does not hang, and torch 2.15 and 2.16
behave identically on ROCm 10.0.

The ROCm 10.1 user-space stack fixes it, and trunk CI already runs ROCm
10.1 (pytorch#196753). The fix holds when 10.0 behavior is restored on 10.1
via DEBUG_HIP_IGNORE_STREAM_PRIORITY=0 (high-priority hardware queues)
or DEBUG_CLR_AQL_BARRIER_OPT=0, so neither of those 10.1 defaults is the
fix. Swapping in ROCr 10.1 alone does not fix it, which leaves CLR
and/or RCCL. This matches ROCm/rccl#2191. The exact ROCm commit was not
isolated, because prebuilt HIP and RCCL from different versions cannot
be mixed.

This change drops the two arch skips and the imports they leave unused.
Not taken: forcing normal-priority streams in FSDP2 on ROCm, or setting
DEBUG_HIP_IGNORE_STREAM_PRIORITY=1 / GPU_MAX_HW_QUEUES=16. Each of these
avoids the trigger on ROCm 10.0 without fixing the underlying bug.

Test Plan

On 8x MI250X (gfx90a), nothing else running on the node, with the
nightly torch 2.16.0.dev20261117+rocm10.1 (test sources at cc63375)
and with the skips removed:

```
python -m pytest distributed/_composable/fsdp/test_fully_shard_training.py -q -s --timeout 800 -k "TestFullyShardNDTraining and test_2d_mlp_with_nd_mesh"
python -m pytest distributed/_composable/test_composability/test_2d_composability.py -q -s --timeout 800 -k "TestFullyShard2DTraining and test_train_parity_2d_mlp"
```

ROCm 10.1: 7/7 and 3/3 pass. test_2d_mlp_with_nd_mesh also passes 3/3
with DEBUG_HIP_IGNORE_STREAM_PRIORITY=0. ROCm 10.0 (torch
2.15.0.dev20260926): test_2d_mlp_with_nd_mesh fails 5/5 at the 300s
timeout. The only FSDP2 changes between cc63375 and this base
(pytorch#204750, pytorch#204942) affect size-1 shard meshes, which neither test uses.

Lint was not run locally: spin and lintrunner are not available in this
environment.

This change and description were authored with an AI assistant.

Co-authored-by: Cursor <[email protected]>
@pytorch-bot

pytorch-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/205508

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit dbcde37 with merge base 42d36d3 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot Bot added module: rocm AMD GPU support for Pytorch topic: not user facing topic category labels Nov 18, 2026
@jithunnair-amd jithunnair-amd added ciflow/trunk Trigger trunk jobs on your pull request ciflow/periodic-rocm-mi350 Trigger "distributed_4gpu" config (only runs distributed tests that need >2GPUs) CI on ROCm MI350 ciflow/periodic-rocm-mi300 Trigger "distributed" config CI on ROCm MI300/MI325 ciflow/periodic-rocm-mi200 Trigger "distributed" config CI on ROCm MI200 ciflow/rocm-preview Trigger unit tests CI on a preview build of ROCm from theRock on MI300 labels Nov 18, 2026
)

@skip_if_lt_x_gpu(4, allow_cpu=True)
@skip_if_rocm_arch_multiprocess(MI200_ARCH)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

based on your pr description, it seems we'd want these to convert to skip if rocm <= 10.0

@jeffdaily

Copy link
Copy Markdown
Collaborator

My agent came up with this analysis, but I've read and approved it.

Two things before this can land.

  1. +1 to @pragupta's request. The body says test_2d_mlp_with_nd_mesh hangs 5/5 on ROCm 10.0, and ROCm 10.0 wheels are still built, so removing the skip outright turns it into a 300 s hang for anyone on 4+ MI200 GPUs with a 10.0 build. Note that stacking a version skip on top of the arch skip would not work (stacked skips OR together). Replacing @skip_if_rocm_arch_multiprocess(MI200_ARCH) with @skip_if_rocm_ver_lessthan_multiprocess((10, 1)) on both tests is the one-line form. The four Fixes lines can stay: CI is on 10.1 and will not hit that gate again.

  2. CI does not run either test on MI200, so the green periodic-rocm-mi200 run here is not evidence. Its distributed runners are linux.rocm.gpu.mi210.2 (2 GPUs), both tests are skip_if_lt_x_gpu(4), and they are deselected at collection: on this head, shard 1 ran test_fully_shard_training.py with 50 items and test_2d_mlp_with_nd_mesh is not one of them, and shard 2 ran test_2d_composability.py with "Running 0 items in this shard". Please say this in the test plan and include the literal commands for your 8x MI250X runs. test_train_parity_2d_mlp has only 3 runs listed; a few more, plus its ROCm 10.0 result, would help.

Body cleanup: drop the stray Title: first line and unwrap the summary paragraph.

@jeffdaily

Copy link
Copy Markdown
Collaborator

My agent came up with this analysis, but I've read and approved it.

Independent check on 4x gfx90a (MI200), ROCm 10.1.0, torch nightly 2.16.0.dev20261117+rocm10.1 with this PR's test files (01a0b27), each run in a fresh process:

python test/distributed/_composable/fsdp/test_fully_shard_training.py -v -k test_2d_mlp_with_nd_mesh
python test/distributed/_composable/test_composability/test_2d_composability.py -v -k test_train_parity_2d_mlp

test_2d_mlp_with_nd_mesh 10/10 passed and test_train_parity_2d_mlp 10/10 passed, world size 4, no hangs. The same files from main skip both tests on this host. This covers ROCm 10.1 only; I have no 10.0 stack to check the hang, so the version gate is still needed.

…right

test_2d_mlp_with_nd_mesh hangs on MI200 with ROCm 10.0 (5/5 per the PR's measurements) and passes with 10.1, so the MI200 arch skip becomes skip_if_rocm_ver_lessthan_multiprocess((10, 1)) on both tests rather than being removed. A version skip stacked on the arch skip would not work, because stacked skips OR together.

Test Plan: on 4x gfx90a (fleet mi200), ROCm 10.1.0, torch nightly with these test files:

```
python test/distributed/_composable/fsdp/test_fully_shard_training.py -v -k test_2d_mlp_with_nd_mesh
python test/distributed/_composable/test_composability/test_2d_composability.py -v -k test_train_parity_2d_mlp
```

Authored with Claude.
@pytorch-bot

pytorch-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Workflows were awaiting approval. CI has now been triggered for the ciflow labels on this PR.

@jeffdaily

Copy link
Copy Markdown
Collaborator

My agent came up with this analysis, but I've read and approved it.

I pushed a maintainer commit (dbcde37) that replaces the removed MI200 arch skip with @skip_if_rocm_ver_lessthan_multiprocess((10, 1)) on both tests, as requested in review, so a ROCm 10.0 build skips them and 10.1+ runs them. On 4x gfx90a with ROCm 10.1.0 both tests still run and pass with the gate (5/5 each), and the gate skips when the version reads 10.0.x.

@jeffdaily
jeffdaily marked this pull request as ready for review November 18, 2026 17:48
@jeffdaily
jeffdaily dismissed pragupta’s stale review November 19, 2026 03:37

The requested ROCm version gate was added in dbcde37: both tests now carry @skip_if_rocm_ver_lessthan_multiprocess((10, 1)).

@jeffdaily

Copy link
Copy Markdown
Collaborator

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: Auto Request Review

Details for Dev Infra team

Raised by workflow job

@jeffdaily

Copy link
Copy Markdown
Collaborator

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

This branch was previously deployed

1 inactive deployment
bedrock — dbcde371 Deployed Nov 18, 2026 by jeffdaily via analyze #35182
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/periodic-rocm-mi200 Trigger "distributed" config CI on ROCm MI200 ciflow/periodic-rocm-mi300 Trigger "distributed" config CI on ROCm MI300/MI325 ciflow/periodic-rocm-mi350 Trigger "distributed_4gpu" config (only runs distributed tests that need >2GPUs) CI on ROCm MI350 ciflow/rocm-preview Trigger unit tests CI on a preview build of ROCm from theRock on MI300 ciflow/trunk Trigger trunk jobs on your pull request Merged module: rocm AMD GPU support for Pytorch open source topic: not user facing topic category

Projects

None yet

6 participants