Skip to content

[ROCm] Count Windows ROCm GPUs with hipInfo - #193594

Closed
chinmaydk99 wants to merge 5 commits into
pytorch:mainfrom
chinmaydk99:ck-windows-nightly-fix
Closed

chinmaydk99 wants to merge 5 commits into
pytorch:mainfrom
chinmaydk99:ck-windows-nightly-fix

Conversation

@chinmaydk99

@chinmaydk99 chinmaydk99 commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

PR #188593 sets IS_ROCM from torch.version.hip. Import of tools/testing/test_selections.py then runs rocminfo to set NUM_PROCS. The Windows nightly job in ROCm/TheRock#7155 does not have rocminfo on PATH. subprocess.check_output raises FileNotFoundError, and test/run_test.py stops before any test starts.

This change keeps the current count method: count output lines that contain " gfx". On Windows the first command is hipInfo. Each HIP device prints a gcnArchName line that contains " gfx", so the count uses the same rule as Linux. If hipInfo is missing or returns a non-zero exit code, the code runs rocminfo. On Linux the code runs rocminfo only. If the command is missing or returns a non-zero exit code, NUM_PROCS is set to 1 and import continues.

This change does not disable GPU counting on Windows when hipInfo is present. This change does not use torch.cuda.device_count() for NUM_PROCS.

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

@pytorch-bot

pytorch-bot Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ You can merge normally! (4 Unrelated Failures)

As of commit 95dcc53 with merge base f07882e (image):

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

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 added module: rocm AMD GPU support for Pytorch topic: not user facing topic category labels Aug 14, 2026
@jithunnair-amd jithunnair-amd added ciflow/trunk Trigger trunk jobs on your pull request keep-going Don't stop on first failure, keep running tests until the end ci-no-td Do not run TD on this PR labels Aug 14, 2026
@chinmaydk99
chinmaydk99 force-pushed the ck-windows-nightly-fix branch from bd4d0f7 to 81aaffc Compare August 14, 2026 16:20
@pytorch-bot

pytorch-bot Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

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

@chinmaydk99
chinmaydk99 force-pushed the ck-windows-nightly-fix branch from 81aaffc to c4e257a Compare August 18, 2026 14:49
Comment thread tools/testing/test_selections.py Outdated
Comment on lines +49 to +50
if IS_ROCM and not IS_MEM_LEAK_CHECK and os.name == "nt":
NUM_PROCS = 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@chinmaydk99 chinmaydk99 Aug 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you for sharing this. I'll go through this and check whether there exists a suitable alternative to the current approach

@chinmaydk99 chinmaydk99 changed the title [ROCm] Skip rocminfo probing for Windows ROCm tests [ROCm] Count Windows ROCm GPUs with hipInfo Aug 19, 2026
@jithunnair-amd jithunnair-amd added ciflow/rocm-mi300 Trigger "default" config CI on ROCm MI300 ciflow/periodic-rocm-mi300 Trigger "distributed" config CI on ROCm MI300/MI325 ciflow/inductor-rocm-mi300 Trigger "inductor" config CI on ROCm MI300/MI325 labels Aug 19, 2026
@chinmaydk99
chinmaydk99 marked this pull request as ready for review August 25, 2026 14:56
@liangel-02
liangel-02 requested a review from jeffdaily August 26, 2026 14:54
@liangel-02 liangel-02 added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Aug 26, 2026
chinmaydk99 and others added 3 commits August 31, 2026 23:52
Windows ROCm test discovery fails at import because rocminfo is not available. Use the safe serial worker count on Windows while preserving rocminfo GPU discovery on other ROCm runners.

Test Plan:
```
wsl.exe -d Ubuntu -- ssh -o BatchMode=yes smci355-1b112-b12-23.mnb.dcgpu "docker exec -w /tmp/ck-windows-nightly-lint-644154d cdk-rocm-10 /opt/venv/bin/spin lint"
```

This commit was prepared with assistance from an AI coding assistant.

Co-authored-by: Cursor <[email protected]>
Windows ROCm test discovery crashes at import because rocminfo is
absent and FileNotFoundError was uncaught. Query hipInfo first on
Windows; gcnArchName lines match the existing " gfx" GPU count.
Fall back to rocminfo, then to serial NUM_PROCS=1 if the tool is
missing or fails.

Test Plan:
```
wsl.exe -d Ubuntu -- ssh -o BatchMode=yes smci355-1b112-b12-23.mnb.dcgpu "docker exec -w /tmp/ck-windows-probes cdk-rocm-10 /opt/venv/bin/spin lint"
```

This commit was prepared with assistance from an AI coding assistant.
@chinmaydk99
chinmaydk99 force-pushed the ck-windows-nightly-fix branch from 619faa2 to 9a6375b Compare August 31, 2026 23:52
@jithunnair-amd jithunnair-amd added ciflow/rocm-mi200 Trigger "default" config CI on ROCm MI200 ciflow/periodic-rocm-mi200 Trigger "distributed" config CI on ROCm MI200 ciflow/inductor-rocm-mi200 Trigger "inductor" config CI on ROCm MI200 labels Aug 31, 2026
Three fixes to the hipInfo/rocminfo loop: a command that runs but yields
zero gfx lines now advances to the next command instead of raising
mid-chain (which reproduced the import crash this PR fixes and skipped
rocminfo); the loud there-must-be-a-GPU health check fires only after
every available tool ran and saw nothing, with the serial default
reserved for no tool being present; output decoding is utf-8 with
errors=replace since hipInfo prints driver marketing names that need not
be ASCII. Also drops the stale common.yml.j2 comment (that template no
longer carries rocminfo logic).

@jeffdaily jeffdaily left a comment •

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.

Approving. The hipInfo-then-rocminfo chain is the right stopgap until rocminfo ships on Windows via TheRock.

I pushed two maintainer commits: a viable/strict merge, and a hardening of the fallback chain. The count == 0 AssertionError previously sat inside the per-command try but was not caught, so a hipInfo that ran and printed no gfx lines crashed run_test.py at import (the exact failure this PR fixes) without ever trying rocminfo. Now a zero-yield command advances the chain, the there-must-be-a-GPU health check fires only after every available tool ran and saw nothing, the serial default applies when no tool exists, and decoding is utf-8 with errors=replace since hipInfo prints driver marketing names. Validated locally: a real rocminfo host counts correctly, and all fallback paths were exercised standalone.

The four previous red CI shards are unrelated (trunk-matched or no causal path from this change). But viable/strict push is rerunning CI anyway.

Analysis assisted by AI.

@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: periodic-rocm-mi200 / linux-jammy-rocm-py3.10-mi200 / test (distributed, 3, 3, linux.rocm.gpu.mi210.2, module:rocm, oncall:distributed)

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

Sanskaaar1 pushed a commit to Sanskaaar1/pytorch that referenced this pull request Sep 8, 2026
PR pytorch#188593 sets `IS_ROCM` from `torch.version.hip`. Import of `tools/testing/test_selections.py` then runs `rocminfo` to set `NUM_PROCS`. The Windows nightly job in ROCm/TheRock#7155 does not have `rocminfo` on PATH. `subprocess.check_output` raises `FileNotFoundError`, and `test/run_test.py` stops before any test starts.

This change keeps the current count method: count output lines that contain `" gfx"`. On Windows the first command is `hipInfo`. Each HIP device prints a `gcnArchName` line that contains `" gfx"`, so the count uses the same rule as Linux. If `hipInfo` is missing or returns a non-zero exit code, the code runs `rocminfo`. On Linux the code runs `rocminfo` only. If the command is missing or returns a non-zero exit code, `NUM_PROCS` is set to `1` and import continues.

This change does not disable GPU counting on Windows when `hipInfo` is present. This change does not use `torch.cuda.device_count()` for `NUM_PROCS`.

Pull Request resolved: pytorch#193594
Approved by: https://github.com/jeffdaily

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Jeff Daily <[email protected]>
jeffdaily added a commit to ROCm/pytorch that referenced this pull request Sep 30, 2026
…93594) (#3661)

PR pytorch#188593 sets `IS_ROCM` from `torch.version.hip`. Import of
`tools/testing/test_selections.py` then runs `rocminfo` to set
`NUM_PROCS`. The Windows nightly job in ROCm/TheRock#7155 does not have
`rocminfo` on PATH. `subprocess.check_output` raises
`FileNotFoundError`, and `test/run_test.py` stops before any test
starts.

This change keeps the current count method: count output lines that
contain `" gfx"`. On Windows the first command is `hipInfo`. Each HIP
device prints a `gcnArchName` line that contains `" gfx"`, so the count
uses the same rule as Linux. If `hipInfo` is missing or returns a
non-zero exit code, the code runs `rocminfo`. On Linux the code runs
`rocminfo` only. If the command is missing or returns a non-zero exit
code, `NUM_PROCS` is set to `1` and import continues.

This change does not disable GPU counting on Windows when `hipInfo` is
present. This change does not use `torch.cuda.device_count()` for
`NUM_PROCS`.

Pull Request resolved: pytorch#193594
Approved by: https://github.com/jeffdaily

Co-authored-by: Chinmay Kuchinad <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Jeff Daily <[email protected]>
Co-authored-by: Artem Kuzmitckii <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-no-td Do not run TD on this PR ciflow/inductor-rocm-mi200 Trigger "inductor" config CI on ROCm MI200 ciflow/inductor-rocm-mi300 Trigger "inductor" config CI on ROCm MI300/MI325 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 keep-going Don't stop on first failure, keep running tests until the end Merged module: rocm AMD GPU support for Pytorch open source topic: not user facing topic category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants