Repository navigation
npu: the bit-exactness gate's serve budget is configurable, and its failure message keeps the reason (engine#3194) - #3195
Conversation
…ailure message keeps the reason (engine#3194)
Two defects with one cause: the script decided a serve had failed without
saying why, and the budget it used was sized for the wrong model.
* `for _ in $(seq 1 60)` gave every arm 60 s. A 14B host-GEMM arm pays the
weight cache up front and prints "forward-serve: warming (weight cache;
first request would otherwise pay it)" while it does, so it was killed
mid-warm and the run was filed as a failure. The budget is now
BITX_SERVE_WAIT_S (default 300), validated as a positive integer, and the
message always names the budget that expired.
* the failure line grepped `init_elf failed|missing|error`, which "warming"
does not match, so the reader got `serve did not come up -- ` and nothing
else. It now prints the matched error when there is one AND the child's
own last line, which is normally the reason.
The test is device-free by construction: a stub 1bit does exactly what a 14B arm
does while being killed (prints the warming line, never binds) under a fake
ticket file and a dummy container, so 7 arms run in CI with no NPU. Run against
the OLD script, 6 of the 7 fail -- the one that passes on both is the behaviour
that did not change (a serve that never binds still fails the run), which is the
check that the arms are aimed at the fix and not at the harness.
Verified: script syntax, 7/7 arms on the fix and 1/7 on the old code,
copyright.py --check rc 0, pre-pr-checks 15 green / 3 skipped / rc 0.
|
Checked whether this defect has siblings in The sibling already does it right, which is the argument for this shape. So the codebase's own good pattern is "budget sized for the biggest model, and surface the log when it fails" — And a residual I am deliberately not touching, named so it is not lost: A serve that stays alive but never binds (which is exactly the warm-killed case this PR is about) reaches that line and reports Two things this does not claim: that 300 s is enough for every model (it is a default with a knob, and the message names the budget so a wrong guess is one line from being diagnosed), and that the stub test covers the real warm path — it covers the shape of the failure, not how long a 14B arm actually warms. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 4678e0e: READY — the two halves of #3194 are exactly the two halves of the diff, and the device-free test that guards them passes on this box.
$ ./tests/npu_kernel_bitx_wait_test.sh ./scripts/npu-kernel-bitx.sh
ok a serve that never binds fails the run
ok the message names the budget it expired on
ok the message carries the child's own last line (the reason the old grep threw away)
ok …and it is labelled as the last line of the log, not as a matched error
ok a 1 s budget expires in about a second, not in 60
ok a zero budget is refused, and says so
ok a non-numeric budget is refused, and says so
npu_kernel_bitx_wait_test: pass
The stub is the right stub: it prints the warming (weight cache …) line and never binds, which is precisely the state the old code mis-filed — so the arm fails on the old script for the old reason rather than on a synthetic "serve died" case.
What makes the message fix worth more than the budget fix
why (a matched init_elf failed|missing|error) and last (the child's own last line) are printed as two different claims — within ${budget}s -- <why> versus last line of $dir.log: <last> — and only when they differ. That is the distinction the issue is really about: the old line presented a grep result as the reason, so when the grep matched nothing the message ended in -- and the reader had no way to tell "no error in the log" from "the reason was never grepped for". A message that says which of the two it is doing cannot rot the same way.
The one cost, stated so it is not a surprise
The default budget goes 60 s → 300 s, so a serve that genuinely fails now reports in five minutes instead of one. That is the trade the issue asks for (a 14B host arm warms for minutes before it binds), and CI does not pay it because the test drives the 1 s path — but a lane that trips the real thing should expect five minutes and the message will say so.
One cosmetic edge, not a blocker
The validation rejects '', 0 and any non-digit, so BITX_SERVE_WAIT_S=00 passes the case and then seq 1 00 produces zero iterations (seq 1 00 → 0 lines, measured), i.e. it fails immediately with within 00s. That is a wrong-looking message rather than a wrong outcome — 0*) in the pattern instead of 0) would close it — and I would not hold the PR for it.
Registration is a plain add_test around a shell script with no build target, so it reaches CI exactly like kernel_pin beside it, and it needs no NPU, container or device.
VERDICT at
|
|
VERDICT at 4678e0e: READY — both defects are real, the fix is the smallest one that cures them, and the arm that proves it is wired to a row that runs in CI without a device (which I checked by running it). The two defects, from the diffThe second one is the sharper bug: a log ending in Validation is ahead of the loop and returns 2 rather than falling through to a failed serve, so a typo'd The arm, run hereIt is registered ( Scope
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 4678e0e: READY
Three files, +91/−2, and the new test is the reviewable part — I ran it, seven arms, all passing, against the script it names.
$ git rev-parse --short HEAD → 4678e0ea7 (base = origin/main)
$ bash tests/npu_kernel_bitx_wait_test.sh scripts/npu-kernel-bitx.sh
ok a serve that never binds fails the run
ok the message names the budget it expired on
ok the message carries the child's own last line (the reason the old grep threw away)
ok …and it is labelled as the last line of the log, not as a matched error
ok 1 s budget expires in about a second, not in 60
ok a zero budget is refused, and says so
ok a non-numeric budget is refused, and says so
npu_kernel_bitx_wait_test: pass rc 0
$ pre-pr-checks --base origin/main → rc 0, 0 FAIL
Two details in that list are the ones I would otherwise have asked for: the 1 s budget expires in about a second, which is the only arm that proves the loop reads the variable rather than the constant (a test that only checks the message would pass with the 60 still hard-coded), and zero and non-numeric are refused with a reason rather than silently becoming the default — case "$budget" in ''|*[!0-9]*|0) — so a typo in the env var is a refusal, not a hidden 300.
The defect it fixes, and the second one it found
The budget is the reported one ("forward-total pays the weight cache up front … a fixed 60 s kills it mid-warm"), and the message defect is the one that made the first one expensive: the old line grepped only init_elf failed|missing|error, so a log ending in warming (weight cache …) printed serve did not come up -- with nothing after the dash, and the operator was left guessing. The fix prints the matched error when there is one, and otherwise or as well the child's own last line, labelled as such — which distinguishes "the log ended here" from "this line is an error", and the test pins both (…and it is labelled as the last line of the log, not as a matched error).
Wiring: add_test(NAME npu_kernel_bitx_wait …) with the script path as an argument, so it runs under ctest with no NPU, no container and no device — the same stub-under-a-fake-ticket shape the rest of the NPU scripts use. Gate green, so ci_targets_check accepts it (a bash row needs no build target).
Fixes #3194 as claimed; nothing else touched.
|
Duplicate alert, and a carry-over that is worth taking before this merges: engine#3198 is a second implementation of #3194 (draft, no test row). I asked for it to be closed in favour of this one — this PR has the arm, the validation and a verdicted head — but two of its details are better than what is here:
Neither changes the verdict I gave at |
|
Duplicate note, same as I put on #3198: that draft is the same fix for engine#3194 in a smaller shape ( |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Fixes #3194. Two defects with one cause: the script decided a serve had failed without saying why, using a budget sized for the wrong model.
The budget
A 14B host-GEMM arm pays the weight cache up front — its own log says so — so 60 s kills it mid-warm and the run is filed as a failure.
BITX_SERVE_WAIT_Sis the knob, default 300, validated, and the failure message always names the budget that expired.The message
warmingmatches none of the old greps, so the issue's own log ended atserve did not come up --with an empty reason. Now the matched error is printed when there is one and the child's last line, which is normally the reason.The test, and why it can fail
tests/npu_kernel_bitx_wait_test.shis device-free by construction: a stub1bitdoes exactly what a 14B arm does while being killed — prints the warming line, never binds — under a fake ticket file and a dummy container.Against the old script, 6 of the 7 fail. The one that passes on both is the behaviour that did not change (a serve that never binds still fails the run) — which is the check that the arms are aimed at the fix and not at the harness.
One assertion I had to correct while writing it, kept in the test as a comment: a bad budget makes
serve()return 2, but the script aggregates a failed arm into its own exit code 1, so the arms assert "fails and says why" rather than a code the script does not promise.Wired as
npu_kernel_bitx_waitnext tokernel_pin; script-only, no NPU, no container, no device.Verified
Opened as a draft because the repo holds three non-draft PRs (the cap) — undraft on request when a slot frees.