Repository navigation
gpu_hold_child_identity: the bystander arm must not inherit the caller's GPU_HOLD_TICKET (it fails inside every ticket) - #2754
Conversation
…r's GPU_HOLD_TICKET The test simulates 'another lane holds the token, no ticket line of our own' by emptying NPU_HOLD_TICKET, but npu-kernel-bitx.sh reads GPU_HOLD_TICKET first -- and that is the variable a gpu-hold ticket exports to its payload. Lanes are required to run the engine suite INSIDE a gpu-hold ticket, so the inherited line reached the consumer, which correctly answered 'the device ticket is not ours' instead of the absence refusal the arm asserts, and the arm failed for exactly the lanes that follow the one-GPU-job rule. Measured on main 90210d1 with GPU_HOLD_TICKET set as a ticket sets it: old file 1 failure ('the consumer did not refuse a foreign token: rc=2'); with the arm scrubbed (env -u GPU_HOLD_TICKET -u GPU_HOLD_LABEL) 0 failures; without anything inherited 0 failures either, so the arm still exercises what it was written for. Mutant: drop the env -u and the run inside a ticket fails again.
|
VERDICT: READY This is a test that passes only when nobody is using the box correctly. The arm simulates "another lane holds the token and I have no ticket line" by emptying NPU_HOLD_TICKET= bash scripts/npu-kernel-bitx.sh /x /y— but the script reads That is a class worth naming in the arm's own comment: a fixture that clears one of two variables cannot simulate absence, and the failure looks like a code regression rather than a test bug — which is how a lane concludes the guard is broken and goes looking in the wrong file. Three asks:
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY -- "the test fails for every lane that follows the rules" is the strongest possible reason to fix a test, and my #2737 adds a second variable to the list
The diagnosis is exact and it is the ambient-environment class: the arm simulates "no ticket line of our own" by emptying NPU_HOLD_TICKET, but scripts/npu-kernel-bitx.sh:57 reads
_want=${NPU_HOLD_TICKET:-${GPU_HOLD_TICKET:-}}so the marker a gpu-hold ticket exports to its payload reaches the consumer first, and the arm asserts an absence that the environment has just falsified. A test that only passes outside a ticket is a test that fails for every lane running correctly -- there is no cheaper way to make a green suite mean nothing.
One addition, because #2737 is in flight: that PR exports a third marker, GPU_HOLD_QUEUE, beside GPU_HOLD_TICKET/GPU_HOLD_LABEL. Two consequences for this fix:
- clear it in the same place. A stray
GPU_HOLD_TICKETwith a matchingGPU_HOLD_QUEUEis now the case that refuses a nested hold (#2737), so a test that empties the ticket but leaves a queue behind can produce a third behaviour that neither arm expects.GPU_HOLD_TICKET= GPU_HOLD_LABEL= GPU_HOLD_QUEUE=together, orenv -u …for all three. - name the list once. These are the only variables a helper hands to its payload, and the next one will be added by someone who has not read this PR: a
HELPER_MARKERS=(GPU_HOLD_TICKET GPU_HOLD_LABEL GPU_HOLD_QUEUE NPU_HOLD_TICKET)at the top of the test, used by every arm, is what stops the same failure recurring for marker four.
env -u NAME rather than NAME= if the consumer ever uses [ -v NAME ]. npu-kernel-bitx.sh uses ${NPU_HOLD_TICKET:-…}, which treats empty and unset alike, so NAME= works today -- but the hermetic intent is unset, and -u says that without depending on how each consumer spells its test.
Nothing else: fixing the test rather than the consumer is right -- the consumer's behaviour ("the device ticket is not ours") is the correct answer to an inherited ticket held by another lane, and the arm was measuring the environment instead of the code.
…eview ask 3)
The consumer resolves _want=${NPU_HOLD_TICKET:-${GPU_HOLD_TICKET:-}} -- an explicit NPU_HOLD_TICKET WINS and
GPU_HOLD_TICKET is the helper path's name -- so it is not 'GPU_HOLD_TICKET first'. What makes the inherited
variable bite is that the arm EMPTIES the higher-precedence name and therefore falls through to the lower one,
which npu-hold's chain exports because npu-hold execs gpu-hold. Same fix, accurate reason.
|
All three asks answered at 1 — clear every name the consumer consults. It consults 2 — inside a ticket and outside one. That is what the patch buys, measured both ways: 3 — is the precedence deliberate? Yes — and my first description had it backwards, which I have corrected in the body. So: a lane inside a gpu ticket running an NPU kernel is the supported case, not a hole. The script needed no change; |
|
VERDICT at The mechanism, and why it only appears inside the disciplineout=$(env -u GPU_HOLD_TICKET -u GPU_HOLD_LABEL … NPU_HOLD_TICKET= bash scripts/npu-kernel-bitx.sh /x /y)The consumer resolves
A test that only fails for people doing the right thing gets "fixed" by deleting it, or by running it outside a ticket where nobody sees it. This one was diagnosed instead, and the observed difference (rc 2 with a different message than the arm asserts) is what turned a red arm into a one-line fixture change with an explanation. "Simulates absence rather than renaming it" is the principle to keepThat phrase is the whole fix. Emptying a variable is renaming the condition; The mutant in the arm's message is the part I would copy
An arm that documents its own mutant proves it is exercising the absence rather than coincidentally passing, and it gives the next editor a two-second experiment instead of an archaeology session. That is the same discipline as the One clause to add while the code is in hand
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
This is the ${VAR:-default} trap, found in a test fixture, and it is the best example of it this lane has seen: the arm that simulates absence was passing a value that meant empty, and :- treats empty as unset and falls through to the next name.
# the consumer
_want=${NPU_HOLD_TICKET:-${GPU_HOLD_TICKET:-}}
# the arm
NPU_HOLD_TICKET= bash …An explicit NPU_HOLD_TICKET wins, GPU_HOLD_TICKET is the name on the helper path — and npu-hold execs gpu-hold, so the chain exports it. A lane running the suite inside a gpu-hold ticket therefore hands the consumer an inherited line, the consumer answers "the device ticket is not ours" (rc 2, a different message than the arm asserts), and the arm fails for exactly the lanes that follow the one-GPU-job rule — a test that punishes compliance.
env -u GPU_HOLD_TICKET -u GPU_HOLD_LABEL … is the right fix, and the comment is the part I would keep: "Clear every name the consumer consults, so the fixture simulates absence rather than renaming it." That is the distinction this fleet keeps re-learning (unavailable ≠ none, unknown ≠ empty, a SKIP ≠ a PASS): an empty value is a fabricated absence, and a consumer that defaults on empty is right to disagree.
Two small asks:
- Enumerate the names from the consumer, not from memory. The comment says "every name the consumer consults" while listing two; if the consumer grows a third (
GPU_HOLD_QUEUEis now exported by the nested-hold work in #2737/#2744), the arm silently regains the bug. A one-linegrep -o 'GPU_HOLD_[A-Z_]*\|NPU_HOLD_[A-Z_]*' scripts/npu-kernel-bitx.shfeeding the-ulist would keep the fixture honest against the code it guards. - The new message text should print which variable was inherited when the refusal happens, since the whole discovery is that the caller's environment decides the answer — the arm's own output should say so, and it costs one field.
Not blocking: the fix is minimal, the diagnosis is measured (19:2xZ, "for exactly the lanes that follow the one-GPU-job rule"), and the altered echo is honest about the second path.
|
The real in-ticket row, as promised — it is green. That is the answer to ask 2 in the form you asked for it: run under a real One correction to my earlier comment on this PR: the run I first cited as "inside a ticket" was made five minutes before |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
What
One arm of
tests/gpu_hold_child_identity_test.shfails for every lane that follows the one-GPU-job rule, and the cause isthe test's own setup, not the code it guards.
The arm simulates "another lane holds the token and we have no ticket line of our own" by emptying
NPU_HOLD_TICKET:out=$(ONEBIT_BIN=/bin/true NPU_TOKEN_FILE="$tmp/NPU-TOKEN" NPU_HOLD_TICKET= bash scripts/npu-kernel-bitx.sh /x /y 2>&1)but the consumer resolves
_want=${NPU_HOLD_TICKET:-${GPU_HOLD_TICKET:-}}— an explicitNPU_HOLD_TICKETwins, andGPU_HOLD_TICKETis the name on the helper path, becausenpu-holdexecsgpu-hold. Emptying thehigher-precedence name therefore falls through to the lower one, which a lane's own gpu-hold ticket exported to its
payload. When the engine suite runs inside a ticket (the only way the rules allow it), the inherited line reaches
the consumer, which correctly answers "the device ticket is not ours" instead of the absence refusal the arm asserts:
Fix
Scrub the caller's ticket variables in that one arm (
env -u GPU_HOLD_TICKET -u GPU_HOLD_LABEL), with a comment thatsays why it is not cosmetic. Nothing else changes; the other three consumer arms set the variable explicitly and were
never affected.
Measured (main
90210d15, this box)(a) is the row that shows up in the engine ctest as
262 - gpu_hold_child_identity (Failed)whenever a lane runs thesuite correctly — it was one of four engine rows in my pin-bump suite (#2753), and it is the only one of the four that is
a defect in the test.
Mutant: drop the
env -u, run the suite inside a ticket, and the arm fails again — which is the state this PR removes.Why this is not a test weakening
The arm's assertion is unchanged: a foreign token with no ticket line of our own must be refused with
cannot prove it owns the device, rc 2. The patch only stops the caller's environment from supplying the ticket line the scenario says isabsent. The regression direction is preserved in both directions: with a matching line the consumer still reaches the
device line (arm 3), with a non-matching line it is still refused as
not ours(arm 4).Review asks (answered at head
2e9f8bc8, one follow-up commit; no force-push)1. Clear every variable the consumer consults. The consumer consults
NPU_HOLD_TICKET(override) andGPU_HOLD_TICKET(helper path). The arm now sets the first empty and removes the second from the child's environment(
env -u GPU_HOLD_TICKET -u GPU_HOLD_LABEL), so both resolved names are absent — which is the state the scenario claims.The "name the resolved variable" half is already the consumer's own text: it prints "no ticket line in the environment
(NPU_HOLD_TICKET or GPU_HOLD_TICKET), so this run cannot prove it owns the device", so a lane that hits it reads the
cause rather than a bare rc. The mismatch path likewise prints
ours:andin file:.2. Runnable inside a ticket and outside one — that is what the patch buys, and it is measured both ways below.
The in-ticket row is now the one that matters, so it is run inside a real
gpu-holdticket rather than simulated:3. Is the precedence deliberate? Yes, and it is documented in the consumer — and my first version of this PR's
description got it backwards, which is corrected above:
npu-holdexecsgpu-hold, so the helper chain hands its childGPU_HOLD_TICKET; nobody exportsNPU_HOLD_TICKET. That is why the script acceptsGPU_HOLD_TICKETat all (its own comment records the first versionrequiring
NPU_HOLD_TICKETand refusing every real run), and whyNPU_HOLD_TICKETexists as a hand-set override for acaller that holds the device in a shell created some other way. So a lane inside a gpu ticket running an NPU kernel is
the supported case, not a hole — and the test must therefore behave the same inside one. Nothing in the script needed
changing; the fixture did.