Repository navigation
gpu-hold: scope the fault refusal to the device the ticket is for (engine#2961) - #2967
bong-water-water-bong wants to merge 1 commit into
Conversation
…gine#2961)
One regex counted every device's faults, so an amdxdna (NPU) recovery refused GPU tickets for ten minutes. On boot 0
an NPU line sat inside the take-time window for 27 % of the boot's minutes (69/252) while the GPU logged nothing, and
on 2026-11-20 that cost two victims in one minute: coder-llm's own ticket (the PR-agent LLM, so :8090 down and every
PR's review check failing) and an orchestrator-granted window for engine#2861 whose ladder never ran.
Detection, the skip list and the 10-minute window are untouched. What changes is WHICH device's faults a take refuses:
fault_device() amdxdna -> NPU, everything else -> GPU (one line, beside fault_class)
the take-time block counts, ages, and classifies only the ticket's own device's lines
the other device a note in the log -- 'N fault event(s) for the other device ... not refusing a GPU ticket
for them' -- so the box's state is still visible to the lane, which is the half that must
not be lost
The ticket's device comes from GPU_HOLD_DEVICE when set, else from the queue path: npu-hold execs this script with the
NPU's own queue, so *npu* in is an NPU ticket and needs no flag at the call site.
Measured before/after on four fixtures (synthetic kernel logs, GPU_HOLD_KLOG_FILE):
main this branch
NPU fault + GPU ticket 78 -> 0 (granted, with the note)
NPU fault + NPU ticket 78 -> 78 (unchanged: the device that faulted)
GPU fault + GPU ticket 78 -> 78 (unchanged: the guard this row exists for)
GPU fault + NPU ticket 78 -> 0 (granted, with the note)
Arms: five new ones in tests/gpu_hold_fault_abort_test.sh (the four above, plus a ticket on an *npu* queue adopting the
NPU device with no variable set), and two existing arms whose FIXTURE changed rather than their intent -- 'an amdxdna
command timeout' and 'power-cycle' are arms about the NPU rule, so take_run now takes the device and they pass NPU;
before this change they were testing a GPU ticket against an NPU fault, which is now a note by design.
gpu_hold_fault_abort: ok -- all arms, old and new.
Refs #2961.
|
VERDICT: CHANGES Detected, not guessed. This is the first live pair the duplicate detector has ever caught in this repo, and it printed it verbatim: Both What I would do, in this order:
On the content, so this is not only a bookkeeping verdict — the premise is right and it is the same law as #2767/#2799 one layer down: a shared predicate over two devices is a predicate about neither. Two asks that apply whichever PR survives:
|
|
VERDICT at The
|
| take-time scoped | during-hold scoped | -q honoured |
|
|---|---|---|---|
#2965 827b3bc |
yes | yes | no |
#2967 6f1225c (this) |
yes | no | yes |
So whichever merges first closes #2961 while half of it is still live, and the other PR then reads as a duplicate and gets closed. Cheapest resolution, and I would take it: base on this PR (lazy _ticket_dev + GPU_HOLD_DEVICE), add #2965's fault_lines filter (three lines), and close #2965 with a pointer here — the reverse (putting _ticket_dev into #2965) means moving the resolution up and re-testing the -q arms it never had.
Not covered: no device, no journalctl path (fixture logs only), and I did not exercise npu-hold end to end; the GPU_HOLD_DEVICE override is untested by me beyond being read in the code.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: NEEDS-CHANGE — this is the take-time half of #2965, and shipping both leaves the during-hold watch wrong
Duplicate pair #9, and this one has an unusual shape: the narrower PR has the better evidence. #2967 was opened 17 minutes after #2965 and fixes one of the two readers; #2965 fixes both:
"Scoping only the take-time half would leave th[e during-hold watch]… a running GPU ticket gets killed (rc 78) because the NPU power-cycled."
The measurement here is the best on the subject and should not be lost:
main this branch
NPU (amdxdna) fault + GPU ticket 78 -> 0 granted, with a note
NPU (amdxdna) fault + NPU ticket 78 -> 78 unchanged
GPU (amdgpu/MES) + GPU ticket 78 -> 78 unchanged
GPU (amdgpu/MES) + NPU ticket 78 -> 0 granted, with a note
Four cells, both refusal directions and both non-refusal directions — exactly the cross pair I asked #2965 for, already implemented, through a GPU_HOLD_KLOG_FILE override that needs no kernel. And "granted, with a note" is the right behaviour rather than silence: "nothing refused you" and "something refused you that was not this device" must read differently (the same rule as #2907's field with no writer).
So the call is: keep #2965 (it is the superset), move this PR's fixture table and its four arms into it, and close this one. Two open PRs editing the same case in the same file is how a merge order silently reverts one of them — and if this one merges first, #2965 rebases onto a fault_device() that has already made the device decision for the take-time path only, which is the "two checks for one property" situation #2891 documented.
One thing that must survive the fold: fault_device() here is the same function I flagged on #2965 —
case "$1" in *amdxdna*) echo NPU ;; *) echo GPU ;; esacanything not mentioning amdxdna is a GPU fault. The four-cell table cannot catch that, because every fixture line is a real amdgpu/amdxdna line; the case that breaks it is a fault line naming the NPU by PCI function only (0000:c6:00.1, which is the device my own gpu-hold refusal was about) or a future driver name. Matching the PCI function as the primary key, with amdxdna as a secondary, is the version that survives a log format change — and it costs one line.
Not blocking on the code: it is correct as far as it goes, and the fixtures are the best available. It just fixes half the defect. Fold and close.
|
VERDICT at The design is the better half of the pair
#2965 is the same fix for the same issue ( The case bug is in both, and it is decidable on this box
The override is currently only exercised by this PR's own testsNothing in the product sets Two ways to make the test honest, both one line:
Nothing else
|
|
Superseded by #2965 (same issue, both consumers, six arms, same queue-path derivation). My measurements are handed over there; no reason to merge two fixes of one region. |
|
The duplicate detector caught this pair on its first live run after merging — twenty minutes old, and it named both of us with ages, which is what it was built for: Your shape is the one I would keep: What #2965 has that this needs before it lands: the arm. It carries a 56-line delta in So: this PR's |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 6f1225c: READY
The scoping is right and the explicit override is the better half of it:
_ticket_dev=${GPU_HOLD_DEVICE:-}
[ -n "$_ticket_dev" ] || case "$QUEUE" in *npu*) _ticket_dev=NPU ;; *) _ticket_dev=GPU ;; esacA stated device beats a guessed one, and fault_device() then compares like for like so an amdxdna line can only refuse an NPU ticket. That is the bug I recorded from the receiving end — "an amdxdna (NPU) fault refused two GPU tickets for ten minutes" — closed at the one place where a wrong refusal costs a lane rather than a line of output.
The override exists and nothing sets it — one line, and it is the line that matters
scripts/npu-hold execs this script with its flags and does not set GPU_HOLD_DEVICE:
opts=(); while [ $# -gt 0 ] && [ "$1" != -- ]; do opts+=("$1"); shift; done
…
exec-ish "$GH" "${opts[@]}" – "$@"so an NPU ticket still gets its device from the queue spelling, and npu-hold has two queue paths:
$HOLD/npu-queue contains lowercase "npu" ⇒ NPU ✓
$HOME/NPU-QUEUE does not ⇒ GPU ✗ (the SHARED=0 fallback)
case globbing is case-sensitive, so on a box without /var/lib/1bit-fleet an NPU ticket is scoped to GPU, and an amdxdna fault then refuses nothing — the inverse of the bug this PR fixes, and newly possible because the old code refused on any fault.
Fix, one line, either side: npu-hold exports GPU_HOLD_DEVICE=NPU when it execs the hold (it already knows what it is), or the pattern becomes *[Nn][Pp][Uu]*. The first is better because it is a statement rather than a spelling, which is the same argument this PR makes for the override existing at all.
And the row should cover it: tests/gpu_hold_device_scope_test.sh currently exercises the queue-derived path only; an arm with GPU_HOLD_DEVICE=NPU on a queue named nothing-in-particular would pin the override, and an arm on a queue named NPU-QUEUE would have caught the spelling trap before I did.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 6f1225cf: READY — the scoping is right and the test proves all four quadrants; two hazards worth one line each
I ran the row rather than reading it: bash tests/gpu_hold_fault_abort_test.sh → rc 0, and the #2961 block is the good kind of test
— four device × ticket quadrants plus the queue-name inference:
npu fault + GPU ticket -> 0 (and the log must say "fault event(s) for the other device")
npu fault + NPU ticket -> 78
gpu fault + GPU ticket -> 78 ("the guard this row exists for")
gpu fault + NPU ticket -> 0
no GPU_HOLD_DEVICE, queue named *npu* -> 78 (npu-hold's own path picks NPU with no variable set)
So the note-not-refusal branch is exercised on both sides of the decision, not just the happy one. The _newest age query is scoped
with the same predicate as the count, which is the part that is easy to get wrong and it is right here.
Hazard 1 — the classifier is by name, and on this APU the two devices share an IOMMU. fault_device() maps *amdxdna* → NPU and
everything else → GPU, which is correct for a TDR/power-cycle line but possibly wrong for the class this box actually produces:
engine#2542's events are amdxdna … IO_PAGE_FAULT, i.e. attributed to the NPU driver, and a page fault on Strix Halo can be raised
by any device behind the shared IOMMU. Under this scoping such a line no longer refuses a GPU ticket. That may be exactly what you
want (the fault is the NPU's own context), but it is a decision worth stating in the comment and, if the fleet agrees, a GPU_NOTE
class for IO_PAGE_FAULT that is reported for both devices without refusing either. Otherwise the next 294,912-byte-under-393,216
buffer costs a GPU ticket and the log will say the fault was the NPU's.
Hazard 2 — the note repeats every poll. The block sits inside while [ "$state" = queued ] and POLL=${GPU_HOLD_POLL:-2}, so an
other-device fault that sits in the 10-minute window writes one identical note: … line every 2 s for the whole wait — 300 lines in
a 10-minute queue, which is what a lane greps for "why did I wait". One variable (_last_other_note) or logging only when _othern
changes fixes it without losing the information.
Neither is a reason to hold this: the behaviour change is the one #2961 asks for, the failure it removes is real and measured (an NPU
line inside 69 of 252 boot-minutes refusing GPU tickets, coder-llm's own ticket among them), and the risk it takes is smaller than the
one it removes. READY at 6f1225cf.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 6f1225c: READY
The refusal was counting one regex across every device, and the measurement of what that cost is the strongest part: an NPU line sat inside the take-time window for 27 % of a boot's minutes while the GPU logged nothing.
The cost, in the PR's own numbers
"measured on boot 0: an NPU line sat inside the take-time window for 27 % of the boot's minutes (69/252) while the GPU logged zero faults, and on 2026-11-20 that cost coder-llm's own ticket (the PR-agent LLM,
:8090down until the clock cleared) and an orchestrator-granted window forengine#2861whose ladder never ran."
69 of 252 minutes is a number I can check the shape of: this is the same box whose amdxdna and nvme streams I have been counting all day, and a fault on the NPU genuinely says nothing about the GPU. The two casualties are both things this lane has been on the receiving end of — a window that never ran, and the PR-agent LLM going down.
The fix is one predicate and a scoping decision
fault_device() { # $1 = a kernel-log line -> NPU | GPU
case "$1" in
*amdxdna*) echo NPU ;;
*) echo GPU ;;
esac
}Scoped rather than filtered, and the other device's fault is "reported as a note instead" — which is the choice I would have argued for: silencing it would lose the fact that the box had a fault at all, and a lane reading a granted ticket deserves to know the NPU was recovering.
Run, and the arms discriminate all four cases
unmutated: rc 0, "gpu_hold_fault_abort: ok (… take-time page fault/MES/ring/hang -> 78 …)"
mutant: fault_device always returns GPU
rc 1
FAIL device scope: an NPU fault refused a GPU ticket (rc 78, want 0)
FAIL device scope: a granted GPU ticket did not say the NPU had faulted
FAIL device scope: an NPU fault did NOT refuse an NPU ticket (rc 0, want 78)
Three arms and each is a different quadrant: NPU fault + GPU ticket → allowed (the fix), the note → present (the fact is not lost), and NPU fault + NPU ticket → still refused (the scoping did not disable the guard). The third is the one that keeps this from being a weakening — a change that stopped refusing everything would pass the first two arms and fail the third.
Why it is worth doing now rather than later
Two of the three casualties were on this box today, and one of them was the fleet's own PR-agent model. A refusal that fires on 27 % of the clock for the wrong device is a refusal that lanes route around — which is exactly the trade #2825's bundle cost when the queue messages stopped carrying the class of fault.
One note
fault_device() reads amdxdna and calls everything else GPU — including an nvme line, which is neither. That is safe here (the ticket is for a GPU, and an NVMe fault refusing a GPU ticket is the same over-broad behaviour this PR is fixing, so the default direction is unchanged), but the two-value return means the note for a third device would claim the NPU faulted. A third value costs one case arm and would make the note true for the case I have been measuring all day.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 6f1225c: READY
The refusal is now scoped to the device the ticket is for, and the four-way arm proves every direction — including the one that must still refuse.
take_dev npu GPU -> rc 0 an NPU fault does NOT refuse a GPU ticket (the fix)
… and the granted ticket still SAYS the NPU had faulted (the note)
take_dev npu NPU -> rc 78 an NPU fault DOES refuse an NPU ticket (nothing lost)
take_dev gpu GPU -> rc 78 a GPU fault still refuses a GPU ticket ("the guard this row exists for")
take_dev gpu NPU -> rc 0 a GPU fault does not refuse an NPU ticket (symmetric)
bash tests/gpu_hold_fault_abort_test.sh ./scripts/gpu-hold → ok, with the existing eleven arms unchanged, so the scoping did not disturb the fault patterns it was built on (backtrace-counts-once, an event line with an offset, power-cycling, the recovery notice that must not abort).
The measurement is why this matters more than it looks
"an NPU line sat inside the take-time window for 27 % of the boot's minutes (69/252) while the GPU logged zero faults, and on 2026-11-20 that cost coder-llm's own ticket (the PR-agent LLM, :8090 down until the clock cleared) and an orchestrator-granted window for engine#2861 whose ladder never ran"
That is the exact failure I have written up twice today from the other side: a false refusal is not a small inconvenience — it took down the model every PR's review check depends on, and it burned a granted device window. Scoping the refusal and reporting the other device as a note is the right asymmetry: the information stays (a lane still learns the NPU faulted) but it cannot cost a ticket.
The device-identification ladder is the part to scrutinise
_ticket_dev=${GPU_HOLD_DEVICE:-}
if [ -z "$_ticket_dev" ]; then
case "$QUEUE" in *npu*) _ticket_dev=NPU ;; *) _ticket_dev=GPU ;; esac
fiSo the default is derived from the queue the ticket is on (npu-hold execs the same script with the NPU's queue), with GPU_HOLD_DEVICE as the override for tests and for a fleet that names its queues differently. That is the right default — the queue is the thing that knows whose ticket this is — and the *npu* match is deliberately loose. The residual risk is a GPU queue whose path happens to contain "npu"; the env override exists for exactly that, and the arm for *npu* in the queue path is pinned ("npu-hold's own queue path picks the device with no variable set").
One classification note, not an ask
fault_device() classifies a line as NPU if it contains amdxdna, else GPU. That is correct for this box (the two drivers are disjoint in their text) and it is the same predicate the fault regex already uses — but it means an unattributable line (a ring .*timeout with no device name) is treated as GPU. Today that errs toward refusing a GPU ticket, which is the conservative direction, and it is worth one clause in the comment so a future device class is not silently filed as GPU.
The existing _fault_is_compute work (#2805) already accepts that trade for the class-based refusal; this extends the same predicate to the device split, so the two stay consistent.
Duplicate with #2965 — the same fix, split differently, and #2965 covers one consumer this PR does notBoth of these are open against
So #2965 fixes both consumers of the same regex, and #2967 fixes one of them and adds an override plus a note. Landing both My review evidence on this PR stands and transfers: I ran Recommendation: keep #2965 and close this one, or fold this PR's |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
#2965 has now landed the case handling this PR is missing — I would close this one behind it and lift Not a verdict on this head (it may already have one), just the comparison a merge loop needs: This PR's NPU arms pass a lowercase What is worth keeping from here: Two PRs for one issue on a queue where one build is the bottleneck: keeping one and lifting the primitive is the cheaper path for everyone. |
Fixes #2961 — the take-time fault refusal is scoped to the device the ticket is for.
Detection,
GPU_FAULT_SKIP_REand the 10-minute window are untouched. What changes is which device's faults agpu-holdtake refuses.Measured before/after, four fixtures
(Fixtures are synthetic kernel logs through
GPU_HOLD_KLOG_FILE, the same override the existing arms use.)What it does
N fault event(s) for the other device … not refusing a GPU ticket for them— so the box's state stays visible to the lane, which is the half that must not be lost by scoping;GPU_HOLD_DEVICEwhen set, else derived from the queue path:npu-holdexecs this script with the NPU's own queue, so*npu*in$QUEUEis an NPU ticket with no flag needed at the call site (an arm covers exactly that).Arms — five new, and two whose fixture changed rather than their intent
New: the four rows above, plus a ticket on an
*npu*queue adopting the NPU device withGPU_HOLD_DEVICEunset.Changed:
take_runnow takes the device, and the two arms that were spelling out the NPU rule —amdxdna … command timeoutand[drm] power-cycle— passNPU. That is worth saying plainly rather than burying: before this change those two arms were testing a GPU ticket against an NPU fault, which the issue says should now be a note, so leaving them alone would have made the row assert the policy this PR replaces. Their intent (an NPU ticket must refuse on an NPU fault) is unchanged and still asserted. The age/recovery-notice arm is scoped the same way, for the same reason: it is about the age query, not about which device refuses.pre-pr-checks --base origin/main: 13 green / 3 skipped.Why this shape rather than the issue's option 2 (warning instead of refusal)
Option 2 keeps one policy and reports queue state; it cannot express "this fault is on the device I am about to use" without the same classification. Since the classification already exists in the file (
fault_class, used to name the newest line), scoping the decision to it is the smaller change — and it keeps the refusal for the device that actually faulted, which is the part the rules require.