Skip to content

tools: a signalled spec-decode run must EXIT, not walk into the next arm and start a new server (closes the hole #1509 left) - #1516

Merged
bong-water-water-bong merged 1 commit into
mainfrom
npu/amd-drafters-3
Nov 8, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
npu/amd-drafters-3

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

pi-verify's CHANGES verdict on #1509 was right, and #1509 merged before I could act on it — so the hole is in main today. This closes it.

The hole

trap cleanup EXIT INT TERM HUP

A handler for INT/TERM/HUP runs and then execution continues. A signalled run therefore killed the current llama-server, walked the rest of the arm loop against a dead port, and then started the next arm's server — with the gpu-hold ticket already ended. That is exactly the orphan the trap exists to prevent (the 14 h / 51 GiB server that took the PR-agent LLM off the iGPU on 11-08), just moved one arm later.

The fix (the two lines the review asked for)

trap 'cleanup; exit 130' INT TERM HUP      # a signal must not return into the arm loop
trap cleanup EXIT                          # normal exit / early return

arm() already sets CUR_PID after waitup and clears it on both the failure path and a successful arm, so cleanup at EXIT is a no-op for a completed run: the only behaviour change is that a signalled run stops.

Proven on the signal path, not by reading it

servers during arm A       1
kill -TERM <script pid>    script exit = 130
servers 5 s later          0
arm B started?             0        <- the merged version started it, with no ticket left

Doc correction the review also checked

warp_model.bin is 33.6 MB for PARD2-Qwen3-8B, 41.9 MB for PARD2-Qwen3-14B, 70 MB for PARD2-Llama-3.1-8B — the page said "34-70 MB", a hair optimistic at the lower bound for the 8B repo. Now stated per repo.

Verified

bash -n tools/spec_decode_speedup.sh        -> ok
tools/copyright.py --check (tree staged)    -> rc 0
git add <paths> only                        -> two files
no server left running after the test       -> pgrep on 18120/18121 = 0

closes the CHANGES on #1509, refs #1423, TAMDCOL.

…arm and start a new server (closes the hole #1509 left)

pi-verify's CHANGES verdict on #1509 was right and the PR merged before I could act on it, so the hole is in main today:

  trap cleanup EXIT INT TERM HUP

A handler for INT/TERM/HUP runs and then execution CONTINUES. So a signalled run killed the current llama-server, walked the
rest of the arm loop against a dead port, and then started the NEXT arm's server -- with the gpu-hold ticket already ended. That
is the exact orphan the trap exists to prevent (the 14 h / 51 GiB server that took the PR-agent LLM off the iGPU on 11-08), just
moved one arm later.

The two-line shape the reviewer asked for:

  trap 'cleanup; exit 130' INT TERM HUP      # a signal must not return into the arm loop
  trap cleanup EXIT                          # normal exit / early return

Proven on the signal path, not by reading it:

  servers during arm A                         1
  kill -TERM <script pid>                      script exit = 130
  servers 5 s later                            0
  arm B started?                               0    <- the merged version started it, with no ticket left

Also corrects the warp_model.bin range the review checked: it is 33.6 MB for PARD2-Qwen3-8B, 41.9 MB for PARD2-Qwen3-14B and
70 MB for PARD2-Llama-3.1-8B (the doc said "34-70 MB", a hair optimistic at the lower bound for the 8B repo).

closes the CHANGES on #1509, refs #1423, TAMDCOL.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

#1516 ready for review at 0dd6a2d — fixes the CHANGES pi-verify raised on #1509 (merged before I could act on it, so the hole is in main): a signalled run now exits 130 instead of walking into the next arm and starting a server with no ticket. Proven: 1 server during arm A → exit 130 → 0 servers → arm B never started.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY at 0dd6a2db492430561ab5346976733f984330702c

The right fix for a real orphan path. In bash, a handler on INT/TERM/HUP that doesn't exit returns into the script, so the merged trap cleanup EXIT INT TERM HUP killed the current server and carried on into the next arm. Splitting it into trap 'cleanup; exit 130' INT TERM HUP plus trap cleanup EXIT makes a signal end the run.

Checked at this head:

  • cleanup() is safe to run twice, which matters because exit 130 inside the signal trap fires the EXIT trap as well: it kills CUR_PID only when it's set, then clears it.
  • The exact trap pattern, exercised with sleep as the stand-in server, two arms, and kill -TERM on the script during arm A: exit=130, 1 arm started, and arm A's stub PID is gone (kill -0 fails). The merged form would have started arm B.
  • bash -n tools/spec_decode_speedup.sh passes. The warp_model.bin sizes per repo replace an optimistic range, which is fine.

Cosmetic, not blocking: 130 is the conventional status for INT (128 + 2). TERM and HUP are usually 143 and 129. Separate traps (trap 'cleanup; exit 143' TERM, and so on) would let a caller tell a ticket-end TERM from a Ctrl-C.

@bong-water-water-bong
bong-water-water-bong merged commit f4a6a1a into main Nov 8, 2026
8 of 9 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the npu/amd-drafters-3 branch November 8, 2026 17:44
bong-water-water-bong added a commit that referenced this pull request Nov 8, 2026
…1x, and the correction missed #1516's merge (#1523)

* tools+docs: the HRX speedup I published was a warm-up artefact — SKIP_FIRST, and the corrected 1.01x

The 1.50x on HRX that this branch's page and engine#1423 carried is WRONG, and the measurement that contradicts it came from the
same harness inside the same ticket discipline:

  first run (one warm-up discarded):  baseline 40.646 / 51.942 / 46.849 tok/s  (still climbing), draft 71.990 / 70.259 / 57.009
                                      -> "1.50x"
  settled runs (two warm-ups, four samples each):
                                      baseline 75.462 / 76.240 / 76.107 / 74.844  (median 75.785)
                                      draft    77.357 / 77.050 / 76.263 / 75.642  (median 76.656)   -> 1.012x
                                      (the run before it, same shape: 75.785 vs 76.997 -> 1.03x)

So ~50 % of the published "speedup" was an unsteady baseline: an HRX first-touch/compile warm-up does not finish inside one
request, and the draft arm was measured after the baseline arm. The honest verdict for Qwen3-4B <- PARD-Qwen3-0.6B on this iGPU is
BREAK-EVEN at ~75 tok/s, not a win — and docs/amd-drafters.md now says that, including why PARD's own published 1.78x/4.08x
come from its tuned runtime rather than from driving its weights through our server in AR mode.

What changes:
- tools/spec_decode_speedup.sh gains SKIP_FIRST (default 1, with this exact failure written next to it) so the warm-up length is
  a knob; the arm loop discards SKIP_FIRST samples and prints every kept one.
- docs/amd-drafters.md: the table now carries the settled 1.012x with the sample counts, a paragraph on how the 1.50x happened,
  and the statement that acceptance is NOT measured on HRX (that build echoes neither draft_n_accepted nor the acceptance-rate
  line) rather than implying it explains the ratio.

Verified: bash -n; copyright --check rc 0 with the tree staged; git add <paths> only. Both runs were gpu-hold tickets that
released the token (576 s and 25 s holds), no server survived either (the trap from this branch).

(cherry picked from commit 97d3f2c)

* tools+docs: all five review points — per-row warm-up counts, a cited vendor claim, SKIP_FIRST=2 by default, and wording that matches the numbers

Fixes pi-verify's CHANGES on #1523, all five, each small and each right:

1. The line introducing the table still said "the first request of each arm discarded" while the HRX row underneath said two.
   The warm-up/sample count is now a column of its own ("4 (2)" / "3 (1)"), because the two rows were taken on different days
   with different settled states, and the script header says SKIP_FIRST arms rather than "the first request".
2. "PARD's published 1.78x/4.08x" is now cited instead of asserted: the amd/PARD-Qwen3-0.6B model card claims "an average
   inference speedup of 1.78x" over pure-AR drafts and "up to a 4.08x speedup" in "Transformers+ PARD" -- different drafters and a
   different runtime from the pair measured here, which is exactly why they are quoted as the vendor's claim and not as our
   result. (A PR whose purpose is an unchecked number should not add one.)
3. SKIP_FIRST now defaults to 2 -- one was the setting that produced the artefact -- SKIP_FIRST=0 still degrades cleanly to REQS
   samples, and the page prints the exact command that reproduces the corrected HRX row.
4. Wording made to match the numbers beside it: the baseline is "unsettled" (40.646 -> 51.942 -> 46.849 rises and then falls, so
   not a ramp), and the artefact is "~98 % of the published speedup" / "50 points of ratio", not "50 % of the gain" (claimed +0.50,
   settled +0.012).
5. "up to 4 (k = 4) draft decodes per round" instead of "~4", since k is an upper bound and acceptance is unmeasured on HRX.

Verified: bash -n clean; SKIP_FIRST default is 2; grep for the old wording ("climbing", "50 % of", "~4 decodes") returns only the
corrected sentence that quotes it; copyright --check rc 0 with the tree staged; git add <paths> only.

---------

Co-authored-by: bong-water-water-bong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant