fix(apu-memory-tuner): detect GPU when rocminfo lists Name before Device Type - #111
Open
urbantech wants to merge 1 commit into
Open
fix(apu-memory-tuner): detect GPU when rocminfo lists Name before Device Type#111urbantech wants to merge 1 commit into
urbantech wants to merge 1 commit into
Conversation
…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>
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
apu-memory-tuner'sdetect_platform.pymisclassifies 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'sName:andMarketing Name:after it has already seen aDevice Type: GPUline (in_gpu_agentgate). Butrocminfoprints those two lines beforeDevice Type:inside each agent block, so the gate is never satisfied for the lines that matter and the function returns("", ""). Detection then falls through tois_apu = False.Reproduction (Ryzen AI MAX+ 395 / Strix Halo, gfx1151 — RDNA3.5)
rocminfofield order within the GPU agent block:Before this change:
Fix
Buffer the current agent block's candidate gfx target + marketing name, and commit them the moment a
Device Type: GPUline confirms the block is a GPU. Reset the buffer on eachAgent Nheader. Thestartswith("gfx")guard still skips the ISA sub-blockName:lines (amdgcn-amd-amdhsa--gfx1151).After:
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.