Skip to content

fix: count amdgpu devices across every PCI domain - #1224

Open
fengshaoyi-amd wants to merge 1 commit into
mainfrom
fix/amdgpu-count-all-pci-domains
Open

fix: count amdgpu devices across every PCI domain#1224
fengshaoyi-amd wants to merge 1 commit into
mainfrom
fix/amdgpu-count-all-pci-domains

Conversation

@fengshaoyi-amd

Copy link
Copy Markdown
Contributor

Problem

The platform record globbed 0000:* under /sys/bus/pci/drivers/amdgpu, hardcoding PCI
domain 0000. A host with more devices than one domain can address enumerates its GPUs
under 0002:, 0003: and so on — the normal layout on an MI300/MI350-class node — so the
count came back empty and the run report read:

- accelerators   : ?× gfx950 on the host, amdgpu 6.14.14

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 injectable root convention
the rest of platform_probe documents — the hardcoded absolute path is also why no test
could cover it. Match *:*:*.*, the shape that separates a PCI address from the driver's
own bind/unbind/module siblings in the same directory.

Test coverage

Four cases in test_platform_probe.py: GPUs outside domain 0000 are counted, the ordinary
single-domain host still counts, driver control entries are not mistaken for devices, and an
absent driver directory reports None rather than a count of zero.

Verified on an 8-GPU gfx950 host: amdgpu_device_count() returns 8 where the old glob
returned None.

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>
@fengshaoyi-amd
fengshaoyi-amd requested a review from a team as a code owner August 18, 2026 12:19
@github-actions

Copy link
Copy Markdown

CI E2E report — ✅ Succeeded

item value
result ✅ Succeeded
model Qwen/Qwen3-0.6B (dense)
resources 1× GPU, TP=1
PR branch fix/amdgpu-count-all-pci-domains
commit d89ac210bd965bc8d6ceb9f3c8488381c87b6eb2
session_id 85375e6b-b206-4ea3-a246-1a6b4866d9eb
queue → dispatch 0s
run time 163m 20s
total 163m 20s

details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant