Skip to content

[ROCm] Clear MI200 test gates after root-causing each one - #196674

Closed
pablo-garay wants to merge 6 commits into
pytorch:mainfrom
ROCm:jeffdaily/rocm-mi200-unskips
Closed

pablo-garay wants to merge 6 commits into
pytorch:mainfrom
ROCm:jeffdaily/rocm-mi200-unskips

Conversation

@pablo-garay

@pablo-garay pablo-garay commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Clears six MI200 (gfx90a) test gates and widens one tolerance. Each was root-caused on a 4x gfx90a host first; the two MI200 skips that turned out to be real library bugs stay, now with issue links.

The DDP fp16 grad-layout tolerance is the one real numerics change. On gfx90a the fp16 case fails deterministically at 3.0e-3, always the same 1-of-512 element at 3.067e-3 absolute, reproducing byte for byte across machines and builds. It is not fp16 arithmetic: a CPU fp16 run tracks fp64 to 7e-6 while the MIOpen GPU run is off by 2.5e-3 on a gradient whose maximum magnitude is 5.4e-3. Per-op bisection localizes it to conv1's data and weight gradients amplified through conv0's 1568-term reduction, and MIOPEN_DEBUG_CONV_IMPLICIT_GEMM=0 drops the error ~70x; the solvers are ConvHipImplicitGemmGroup{Bwd,Wrw}Xdlops, which MIOpen picks for these shapes only on gfx90a. Filed as ROCm/rocm-libraries#11938. The 8.0e-3 bound is measured, not fitted: over a 31-seed sweep the worst DDP versus full-batch difference is 3.8e-3 with each side up to 4.7e-3 from an fp64 reference, bounding the comparison at ~7.4e-3. It applies only to fp16 on gfx90a; CUDA and every other ROCm architecture keep 3.0e-3.

Test plan: on a 4x gfx90a (MI250X) host with ROCm 7.14, each affected test x25 in isolation, then its class, then the full file, plus lintrunner on every touched file. Every unskipped test is 25/25; the DDP fp16 case is 25/25 with the new tolerance and 0/10 without. Residual full-file failures reproduce identically on the unmodified files on that box. Cross-architecture coverage comes from the ciflow labels.

This description and the changes were authored with the assistance of Claude, an AI assistant, and reviewed by me.

cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @naromero77amd @pragupta @jerrymannil @xinyazhang @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben

test_tcp constructed _WorkerServer("", 1234) and then fetched http://localhost:1234/handler/. The empty host is resolved with AI_PASSIVE, which on the ROCm CI runners binds IPv6-only: [::1] answers 200 while 127.0.0.1 is connection-refused. Python's getaddrinfo("localhost") returns only 127.0.0.1 there, so requests.get raised ConnectionError and the test failed. curl passed on the same box because happy-eyeballs falls back to ::1, which is why this looked like a runner setup problem rather than a test bug, matching the note in DISABLED pytorch#144689 about the self-hosted runner setup blocking the port. The hardcoded port 1234 was a second, latent failure mode: shared runners can already have it bound.

Binding to ("127.0.0.1", 0) and reading the assigned port back through the existing _WorkerServer.port property removes both the address-family mismatch and the port-collision risk on every platform, so the skipIfRocmArch(MI200_ARCH) gate and its now-orphaned imports go away with it. Nothing here is gfx90a-specific; the arch gate was hiding an environment bug.

Test Plan:

Run on a 4x gfx90a (MI250X) host, ROCm 7.14.

x25 isolated, 25/25 pass:

```
for i in $(seq 1 25); do python test/distributed/elastic/test_control_plane.py WorkerServerTest.test_tcp; done
```

Class and full file, 12 tests:

```
python test/distributed/elastic/test_control_plane.py WorkerServerTest
python test/distributed/elastic/test_control_plane.py
```

The one failure there, WorkerServerTest.test_fr_dump_file_without_rank, is unrelated to this change and reproduces identically on the unmodified file on the same box.

This change was authored with the assistance of Claude, an AI assistant, and reviewed by me.
Both MI200 gates in TestExternKernelCaller were introduced without a root cause: test_extern_kernel_benchmark_valid_timing came from pytorch#170205 ("Get MI200 CI green again") and test_extern_kernel_caller_hash_key_deduplication from pytorch#162803. Neither test has a gfx90a-specific failure mode on record, and the autotune-counter assertion that would be the obvious ROCm hazard is already gated on torch.version.hip inside the test. Stress runs on a gfx90a host are clean, so the gates are removed and the now-orphaned imports go with them.

The DISABLED issue pytorch#188668 for test_extern_kernel_benchmark_valid_timing is not MI200 evidence: it postdates the MI200 skip, so the flakiness it tracks was observed on the ROCm architectures that still run the test. That test is separately flaky on gfx942 for a Triton codegen reason that is being handled on its own; this commit only removes the MI200 architecture gate and does not touch that path.

Test Plan:

Run on a 4x gfx90a (MI250X) host, ROCm 7.14.

x25 isolated for each test, 25/25 pass each:

```
for i in $(seq 1 25); do python test/inductor/test_select_algorithm.py TestExternKernelCaller.test_extern_kernel_benchmark_valid_timing; done
for i in $(seq 1 25); do python test/inductor/test_select_algorithm.py TestExternKernelCaller.test_extern_kernel_caller_hash_key_deduplication; done
```

Class, 5 tests, and full file, 48 tests:

```
python test/inductor/test_select_algorithm.py TestExternKernelCaller
python test/inductor/test_select_algorithm.py
```

The class run is clean. The two errors in the full-file run are in TestGetInputsAddmmBias and TestTemplateRender, which this change does not touch, and are unrelated to it.

This change was authored with the assistance of Claude, an AI assistant, and reviewed by me.
test_fully_shard_training_overlap was gated on MI200 by pytorch#164390 on the strength of DISABLED pytorch#134139, which dates to the ROCm 6.1 era, and test_fully_shard_backward_comm_overlap was born with the gate in pytorch#186335 without ever having been observed failing on gfx90a. Both are clean under stress on a current ROCm stack, so the gates are removed.

The two TestFullyShardPerParamMeshOverlap gates stay. Those tests hang on gfx90a reproducibly and at a 100% rate: three process groups wedge concurrently with matching per-rank sequence numbers, all communicator initialization completed, and the stuck ranks show HSA queues whose read pointer is frozen behind partially written packets. That is a RCCL host-callback launch-tracking deadlock rather than anything PyTorch enqueues incorrectly, filed as ROCm/rccl#2191, and the skip comments now cite it so the next reader does not have to rediscover the reason.

Test Plan:

Run on a 4x gfx90a (MI250X) host, ROCm 7.14, at the CI world size.

x25 isolated for each unskipped test, 25/25 pass each:

```
for i in $(seq 1 25); do python test/distributed/_composable/fsdp/test_fully_shard_overlap.py TestFullyShardOverlap.test_fully_shard_training_overlap; done
for i in $(seq 1 25); do python test/distributed/_composable/fsdp/test_fully_shard_overlap.py TestFullyShardOverlap.test_fully_shard_backward_comm_overlap; done
```

Full file, 6 tests, clean, with the two per-param-mesh tests and one pre-existing unrelated test still skipped:

```
python test/distributed/_composable/fsdp/test_fully_shard_overlap.py
```

This change was authored with the assistance of Claude, an AI assistant, and reviewed by me.
_test_grad_layout compares a DDP model against a full-batch reference, so on gfx90a the fp16 half of the parametrization fails at the current 3.0e-3 tolerance. The failure is deterministic, not flaky: both ranks report the same 1 of 512 mismatched element with an absolute difference of 0.0030670166015625 at the same index, and it reproduces byte for byte across machines, images and builds. The relative tolerance never engages because the element is near zero.

The cause is not fp16 arithmetic. A CPU fp16 run of the same four-layer network tracks fp64 to 7e-6, while the MIOpen GPU run is off by 2.5e-3 on a gradient whose maximum magnitude is only 5.4e-3. Per-op bisection with identical fp16 inputs puts the loss in conv1's data and weight gradients, which is then amplified across conv0's 1568-term reduction, and MIOPEN_DEBUG_CONV_IMPLICIT_GEMM=0 drops those errors by about 70x and makes the test pass. The solvers responsible are ConvHipImplicitGemmGroupBwdXdlops and ConvHipImplicitGemmGroupWrwXdlops, which MIOpen's heuristics select for these shapes on gfx90a but not on newer architectures, which is why only MI200 sees this. It is filed as ROCm/rocm-libraries#11938.

The new tolerance is measured rather than fitted to the observed failure: over a 31 seed sweep of the DDP versus full-batch pair, the worst pair difference is 3.8e-3 and each side is up to 4.7e-3 away from a fp64 reference, so the bound on what the comparison can legitimately see is roughly 7.4e-3, rounded to 8.0e-3. It applies only when the parametrization is fp16 and only on gfx90a, so CUDA and every other ROCm architecture keep the 3.0e-3 tolerance. The architecture query is done inside the test body: this file asserts in its main block that the parent process has not initialized CUDA, so a decorator that probes the device at import time would break every distributed shard.

Test Plan:

Run on a 4x gfx90a (MI250X) host, ROCm 7.14, at the CI world size.

x25 isolated for each test, 25/25 pass each; before this change the one-device case fails 10 out of 10 with the difference quoted above:

```
for i in $(seq 1 25); do python test/distributed/test_c10d_nccl.py DistributedDataParallelTest.test_grad_layout_1devicemodule_1replicaperprocess; done
for i in $(seq 1 25); do python test/distributed/test_c10d_nccl.py DistributedDataParallelTest.test_grad_layout_2devicemodule; done
```

Full file, 287 tests:

```
python test/distributed/test_c10d_nccl.py
```

DistributedDataParallelTest is clean there. The remaining errors are all in NCCLTraceTest and ProcessGroupNCCLGroupTest, are unrelated to this change, and reproduce identically on the unmodified file on the same box.

This change was authored with the assistance of Claude, an AI assistant, and reviewed by me.
test_deleted_mempool_not_used_on_oom carries both an unconditional Linux skip for pytorch#176145 and an MI200 architecture skip from pytorch#170205 ("Get MI200 CI green again"). The Linux gate subsumes the architecture gate on every configuration that runs this test in CI, so the MI200 line has never had an effect; removing it changes no test selection and leaves one fewer unexplained ROCm gate behind. Stress runs on gfx90a with both gates bypassed are clean, so nothing is being papered over.

The Linux gate stays as is. pytorch#176145 tracked flakiness on CUDA Linux as well, so re-enabling it is not a ROCm call to make.

Test Plan:

Run on a 4x gfx90a (MI250X) host, ROCm 7.14, with both gates bypassed locally so the test actually executes.

x25 isolated, 25/25 pass:

```
for i in $(seq 1 25); do python test/test_cuda.py TestMemPool.test_deleted_mempool_not_used_on_oom; done
```

Class, 32 tests, clean, and full file, 440 tests:

```
python test/test_cuda.py TestMemPool
python test/test_cuda.py
```

The three failures in the full-file run are test_host_memory_stats_active_after_event_drain, test_host_memory_stats_active_after_free_no_events and test_mempool_ctx_multithread. All three reproduce identically with the test still skipped, so they are pre-existing and unrelated; test_mempool_ctx_multithread in particular passes in the class-only run, which makes it an ordering artifact rather than fallout from letting this test execute.

This change was authored with the assistance of Claude, an AI assistant, and reviewed by me.
@pytorch-bot

pytorch-bot Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⏳ 1 Pending, 1 Unrelated Failure

As of commit 8717774 with merge base 0929b23 (image):

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

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

@pytorch-bot

pytorch-bot Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

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

@jithunnair-amd jithunnair-amd added ciflow/trunk Trigger trunk jobs on your pull request ciflow/rocm-mi200 Trigger "default" config CI on ROCm MI200 ciflow/rocm-mi300 Trigger "default" config CI on ROCm MI300 ciflow/periodic-rocm-mi200 Trigger "distributed" config CI on ROCm MI200 ciflow/periodic-rocm-mi300 Trigger "distributed" config CI on ROCm MI300/MI325 labels Sep 11, 2026
@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: Command git -C /home/runner/work/pytorch/pytorch merge --squash __pull-request-196674__init__ returned non-zero exit code 1

Auto-merging test/inductor/test_select_algorithm.py
CONFLICT (content): Merge conflict in test/inductor/test_select_algorithm.py
Auto-merging test/test_cuda.py
Squash commit -- not updating HEAD
Automatic merge failed; fix conflicts and then commit the result.
Details for Dev Infra team Raised by workflow job

# Conflicts:
#	test/inductor/test_select_algorithm.py
@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

jeffdaily added a commit to ROCm/pytorch that referenced this pull request Sep 14, 2026
This test is the third member of the gfx950 CI-runner failure family already skipped on that arch in this PR (test_mempool_large_alloc_barrier and test_mempool_recycled_alloc_signal_pad). It rendezvouses a MemPool-allocated tensor and then calls one_shot_all_reduce, whose first device-side atomic on the peer's signal pad never completes on the SR-IOV virtual functions the mi350 distributed runners expose. The test hangs until the 600s per-test timeout and both retries then hang for a further 30 minutes each, so a single test burned 90 minutes of the shard.

Root cause is the same unresolved runner P2P path, not the test: the same code passes on gfx950 outside those runners and on the mi300 runners running the same image. Skipping on gfx950 keeps the ROCm coverage this PR restores on mi200/mi300 while removing the hang.

The alternative was to leave the test unskipped and rely on the timeout, but a consistently hanging test provides no signal and makes the shard's wall-clock unpredictable, so the targeted arch skip is preferable.

Test Plan:

The gfx950 path cannot be exercised locally (this host is gfx90a), so the skip itself is verified in CI; the mi350 log already shows the sibling tests reporting `skip_if_rocm_arch_multiprocess: test skipped on ('gfx950',)`.

Locally on gfx90a, confirming the suite still collects and the non-gfx950 behavior is unchanged:

```
python test/distributed/test_symmetric_memory.py -k SymmMemPoolTest -v
```

Also confirmed the mi200 failure reported on this PR is fixed by merging main (the MI200 fp16 grad tolerance bump from pytorch#196674), not by any change here:

```
python test/distributed/test_c10d_nccl.py DistributedDataParallelTest.test_grad_layout_1devicemodule_1replicaperprocess
```

Lint:

```
lintrunner -a test/distributed/test_symmetric_memory.py test/distributed/test_c10d_nccl.py test/distributed/checkpoint/_experimental/test_checkpointer.py
```

This commit was authored with the assistance of Claude.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/periodic-rocm-mi200 Trigger "distributed" config CI on ROCm MI200 ciflow/periodic-rocm-mi300 Trigger "distributed" config CI on ROCm MI300/MI325 ciflow/rocm-mi200 Trigger "default" config CI on ROCm MI200 ciflow/rocm-mi300 Trigger "default" config CI on ROCm MI300 ciflow/trunk Trigger trunk jobs on your pull request Merged module: inductor module: rocm AMD GPU support for Pytorch open source topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants