fix: count amdgpu devices across every PCI domain - #1224
Open
fengshaoyi-amd wants to merge 1 commit into
Open
Conversation
The platform record globbed `0000:*` under the amdgpu driver directory, hardcoding PCI domain 0000. A host with more devices than one domain can address puts its GPUs under `0002:`, `0003:` and so on -- the normal layout on an MI300/MI350-class node -- so the count came back empty there and the run report read `accelerators: ?x gfx950` on an 8-GPU host. The field failed on exactly the hardware it exists to describe. Move the count into `amdgpu_device_count()` so it follows the injectable `root` convention the rest of this module documents, which is also why the hardcoded absolute path had no test covering it. Co-authored-by: Cursor <cursoragent@cursor.com>
CI E2E report — ✅ Succeeded
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The platform record globbed
0000:*under/sys/bus/pci/drivers/amdgpu, hardcoding PCIdomain
0000. A host with more devices than one domain can address enumerates its GPUsunder
0002:,0003:and so on — the normal layout on an MI300/MI350-class node — so thecount came back empty and the run report read:
on an 8-GPU gfx950 host. The field fails on exactly the hardware it exists to describe.
Approach
Move the count into
amdgpu_device_count()so it follows the injectablerootconventionthe rest of
platform_probedocuments — the hardcoded absolute path is also why no testcould cover it. Match
*:*:*.*, the shape that separates a PCI address from the driver'sown
bind/unbind/modulesiblings in the same directory.Test coverage
Four cases in
test_platform_probe.py: GPUs outside domain 0000 are counted, the ordinarysingle-domain host still counts, driver control entries are not mistaken for devices, and an
absent driver directory reports
Nonerather than a count of zero.Verified on an 8-GPU gfx950 host:
amdgpu_device_count()returns 8 where the old globreturned
None.