Repository navigation
recipes_route: the "nothing on cpu" arm asks for cpu by name (it was auto, which is hrx on an HRX box) - #2358
Conversation
The arm ran serve with --device auto. On a box with an HRX build, auto resolves to hrx, so the hrx-scoped qwen4exp recipes applied and two checks failed: "hrx-scoped: nothing on cpu" and "no -ub on cpu". The log said "q4exp on hrx". CI has no HSA runtime, so auto is cpu there and main stays green. The arm now passes SERVE_DEVICE=cpu, which is what it means; the hrx arm below already names hrx. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
ready for review at 8b3ecf1 |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 8b3ecf1
One line, and it converts two arms from "passes only where the feature is absent" into "passes everywhere for the right reason".
-SERVE_DEVICE=cpu run "$scratch/q4exp.gguf" "$scratch/q4exp.json"
+SERVE_DEVICE=cpu run "$scratch/q4exp.gguf" "$scratch/q4exp.json" # cpu by name: on a box with HRX, auto is hrxThe mechanism is the recipe's own match clause, which I read rather than inferred:
{ "id": "hrx-graph-program-cache-128", "match": { "device": ["hrx"], "architecture": ["qwen4exp"] } }so the recipe only applies on --device hrx. The arm then asserts ! grep -q "hrx-graph-program-cache-128" "$scratch/q4exp.json.log" -- and on a box where auto resolves to hrx the recipe applies, the log names it, and the arm fails. Which makes it the shape worth fixing: a test that can only pass where the backend is missing, sitting in the one repo where the backend is the point.
And it fixes a second arm with the same flag: line 126's "the qwen4exp -ub 2048 recipe is hrx-scoped too: no -ub on cpu" reads the same q4exp.json record, so both assertions now run against a cpu launch on every box.
What I could not demonstrate here, and am not claiming: the A/B. On this tree --device auto does not resolve to hrx (no add-on), so both the fixed and the unfixed script pass --
with the flag: ctest -R '^recipes_route$' -> 100% passed, 2.83 sec
without the flag: bash tests/recipes_route.sh build1336/1bit -> rc 0, no FAIL
-- which is exactly the degenerate case the PR is about: the arm cannot distinguish the two on a box without HRX, because nothing applies either way. So the evidence for the fix is the condition (the match clause and the grep), not a red-to-green transition I can produce locally. Whoever runs this suite on gfx1151 with the add-on sees the difference; the change is right in both places.
One thing worth a clause in the comment, since the comment is where the next reader looks: SERVE_DEVICE=cpu is an environment variable on a prefix assignment, so it applies to that one run and not to the ones above it -- which is the intent, and worth saying because a reader who thinks it is a global could "simplify" it to a SERVE_DEVICE=cpu at the top and silently move every arm in the file onto cpu.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 8b3ecf1: READY
The defect is one word — auto — and the fix restores a convention the file already had.
- run "$scratch/q4exp.gguf" "$scratch/q4exp.json"
+ SERVE_DEVICE=cpu run "$scratch/q4exp.gguf" "$scratch/q4exp.json"
I checked that the helper honours it rather than assuming: run() at line 99 ends in --device "${SERVE_DEVICE:-auto}", so the arm now asks for cpu by name and the two checks beneath it —
the qwen4exp graph-program-cache recipe is hrx-scoped: nothing on cpu
the qwen4exp -ub 2048 recipe is hrx-scoped too: no -ub on cpu
— are now statements about a run that actually involved cpu. Before this, on any box with an HRX build, the arm asserted nothing about cpu and could not fail, while on the one environment where it would have caught a leak there is no HSA runtime to look at. The assertion was about the environment, and the environment that mattered is the one nobody can inspect.
And the neighbouring arms are what make this the right fix rather than a new convention: lines 131 and 136 already do SERVE_DEVICE=hrx run …. So the file had named its device everywhere except the arm whose subject is cpu — the one place the name was load-bearing.
One note, not a change, because it is the same defect one step smaller: lines 179 and 183 still use --device auto for the bad/badk rejection arms. Those should be device-independent (they assert a malformed config is refused before a backend matters), so auto is probably harmless there — but an auto in a test is a decision made by the environment, and the next person to copy an arm will copy what is next to it. One word in a comment — "device-irrelevant: refusal happens before backend selection" — would stop the pattern from being re-introduced by imitation, which is exactly how this one arrived.
The comment you left on line 121 is the right shape too: it says why cpu by name and what auto would resolve to here, so removing the prefix now has to be an argument rather than a cleanup.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
tests/recipes_route.shfails on any box with an HRX build. On this box it failed at main50b68e76and again with #2357 applied, while CI is green.Cause: the arm that checks the qwen4exp recipes stay off cpu ran serve with
--device auto. Where HRX is present,autoresolves to hrx. The serve log saysq4exp on hrxand names both recipes (hrx-graph-program-cache-128,qwen4exp-hrx-ub2048). That fails two checks:the qwen4exp graph-program-cache recipe is hrx-scoped: nothing on cputhe qwen4exp -ub 2048 recipe is hrx-scoped too: no -ub on cpuCI runners have no HSA runtime, so
autois cpu there.Fix: that one
runpassesSERVE_DEVICE=cpu, which is what the arm means. The hrx arm below it already names hrx.Tested: before the change,
ctest -R '^recipes_route$'failed both checks. After it, the test passes (2.2 s). Both runs used the same build.🤖 Generated with Claude Code