Skip to content

fix(apu-memory-tuner): detect GPU when rocminfo lists Name before Device Type - #111

Open
urbantech wants to merge 1 commit into
amd:mainfrom
urbantech:fix/rocminfo-agent-block-field-ordering
Open

fix(apu-memory-tuner): detect GPU when rocminfo lists Name before Device Type#111
urbantech wants to merge 1 commit into
amd:mainfrom
urbantech:fix/rocminfo-agent-block-field-ordering

Conversation

@urbantech

Copy link
Copy Markdown

Problem

apu-memory-tuner's detect_platform.py misclassifies a supported AMD APU as "No AMD APU detected" (exit 2) on the exact hardware the skill targets.

Root cause is in _gfx_target_from_rocminfo(). It only captures the agent's Name: and Marketing Name: after it has already seen a Device Type: GPU line (in_gpu_agent gate). But rocminfo prints those two lines before Device Type: inside each agent block, so the gate is never satisfied for the lines that matter and the function returns ("", ""). Detection then falls through to is_apu = False.

Reproduction (Ryzen AI MAX+ 395 / Strix Halo, gfx1151 — RDNA3.5)

rocminfo field order within the GPU agent block:

Agent 2
  Name:                    gfx1151
  Marketing Name:          Radeon 8060S Graphics
  Vendor Name:             AMD
  Device Type:             GPU        <-- comes AFTER Name / Marketing Name

Before this change:

GFX target:        unknown
Generation:        unknown
APU:               False
Supported by skill: NO
  - No AMD APU detected. ...
# exit 2

Fix

Buffer the current agent block's candidate gfx target + marketing name, and commit them the moment a Device Type: GPU line confirms the block is a GPU. Reset the buffer on each Agent N header. The startswith("gfx") guard still skips the ISA sub-block Name: lines (amdgcn-amd-amdhsa--gfx1151).

After:

GPU:               Radeon 8060S Graphics
GFX target:        gfx1151
Generation:        rdna35
APU:               True
Supported by skill: YES
# exit 0

No behavior change on hardware that already detected correctly (the sysfs fallback and all other fields are untouched); this only fixes the rocminfo path that was silently returning empty.

…ice Type

_gfx_target_from_rocminfo() only captured the agent's `Name:` and
`Marketing Name:` after it had already seen a `Device Type: GPU` line.
But rocminfo prints those two lines *before* `Device Type:` within each
agent block, so the capture guard was never satisfied and the function
returned ("", "").

The knock-on effect: detect_platform.py then classified the machine as
"No AMD APU detected" and exited 2 on hardware that is squarely in scope
-- reproduced on a Ryzen AI MAX+ 395 (Strix Halo, gfx1151), the exact
RDNA3.5 target this skill is written for.

Fix: buffer the current agent block's candidate gfx target + marketing
name and commit them the moment a `Device Type: GPU` line confirms the
block is a GPU; reset the buffer on each `Agent N` header. The
startswith("gfx") guard still skips the ISA sub-block Names
("amdgcn-amd-amdhsa--gfx1151").

Before: GFX target: unknown / APU: False / Supported: NO  (exit 2)
After:  GFX target: gfx1151 / APU: True  / Supported: YES (exit 0)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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