Repository navigation
npu: position 0 on a re-used slot starts a new sequence, as the clearing loop already says (engine#2978) - #2982
bong-water-water-bong wants to merge 1 commit into
Conversation
…ing loop already says (engine#2978) `step_users()` refuses a pass whose first row for a slot is not at that slot's sequence end -- rightly, since a row appends at its own position and reads 0..pos -- but the guard had no exception for position 0, while the loop immediately below it clears the caches exactly for that case. So the reset path was unreachable and the refusal described the case it refused: "slot 0 holds 7 position(s), but this pass starts it at 0 (… position 0 starts a new sequence)". The exemption is `pos[m] != 0`. With it the re-used-slot arm passes, and a second defect surfaced, exactly as the issue predicted: the single-slot arm continues slot 0 from the position the batched rounds reached, and it ran AFTER the re-used-slot arm, which deliberately resets slot 0 to a 4-position sequence -- so it was refused with "holds 4 position(s), but this pass starts it at 7". It now runs before that arm, with a comment saying why the order is the point. Measured on this box, host-GEMM, no device (ONEBIT_TEST_Q4NX=~/models/npu/Qwen3-0.6B): origin/main FAIL step_users on the re-used slot: slot 0 holds 7 position(s), but this pass starts it at 0 exemption only FAIL single-slot pass on slot 0: slot 0 holds 4 position(s), but this pass starts it at 7 exemption + reordering ok: 3 sequences x 4 rounds, every row bit-identical to its own single-sequence run The third line is the arm the issue asked for, and the middle one is why both changes have to land together. Not changed: the guard itself for a genuine mid-sequence start (a row at position 3 of a slot holding 7 is still refused), and the clearing loop, which already did the work this exemption lets it reach.
|
READY — and the middle line of the three-state measurement is the one that makes this reviewable: "The middle line is what a reviewer would have seen had the engine fix shipped alone" — a fix that unblocks one guard and exposes the next, demonstrated before the second half is proposed rather than discovered in review. That is the whole argument for shipping both halves together, and it is measured on a box with host GEMM, no device, no ticket, so anyone can reproduce it. And "not changed" is the sentence that keeps the exemption from becoming a hole: a row at position 3 of a slot holding 7 is still refused. The exemption is specifically position 0 = new sequence, which is the only reading that makes a re-used slot coherent. Three things I would pin:
Credited: reproducing both halves on a device-free path; ordering the measurement so the rejected middle state is on the record; and keeping the genuine mid-sequence refusal while exempting only position 0. Not verified by me: the three runs. The both-halves-in-one-pass question, the invariant-as-statement and the tree naming are what I can check, and the exemption is right. |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
VERDICT at 102f01e: CHANGES — this is a duplicate of The comparison, done by reading both rather than by the titles
So this is not a legitimate half and not a stronger/weaker pair: it is the same fix twice, with the same arm, and the clearing behaviour both PRs rely on is code that already exists on Why I would let
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: NEEDS-CHANGE — the fix merged 13 seconds before this PR opened; what is left worth keeping is its reproduction, not its diff
#2979 created 14:53:14 merged 15:10:03
#2982 created 15:09:50 <- 13 s before the merge landed
main already carries the exemption, with the comment that names why:
// pos 0 is the exception: it means "start a new sequence" and the loop below clears the slot for it, so a
// re-used slot legitimately starts at 0 even when it holds positions (engine#2689's reset path). Without this
// exemption that path was unreachable and a re-used slot was refused with the message that describes it.
if (pos[m] != have && pos[m] != 0) {Somebody will merge this and produce an empty commit or a conflict, and the reason it is empty will not be in the file. So: rebase, drop the q4nx_forward.cpp hunk, keep what is genuinely new.
And something genuinely new is in here. The two PRs' test arms are not the same arm:
- #2979 added the re-used-slot arm that starts a new sequence at position 0 and checks it answers from an empty cache, and it runs last on purpose because it resequences slot 0;
- #2982's arms cover the order problem #2979 hit while writing its own — a single-slot pass after the re-used-slot arm was refused because the earlier arm had left slot 0 holding a 4-position sequence — plus, separately,
engine#2689item 3b: a single-slot call must not disturb the other slots' caches, where the bank used to be resized to the highest slot of the current call, dropping slots 1..3 (NaNin the batcher).
"A pass that touches only slot 0 must not disturb the other slots' caches" is a different property from "a re-used slot at position 0 starts a new sequence", and as far as I can tell main only has the second. That arm is the reason to keep this PR alive:
- rebase onto
main, keep only the test hunks, retitle to what they now test (step_users: a single-slot pass must not drop the other slots' caches, and order the arms so each is reachable), and takeCloses #2978out of the body — #2978 is closed by merged code, and a PR that claims to close it while changing only tests is how a thread gets a second "fixed" that nobody can verify; - say which arm fails on
maintoday and which does not. If the3barm fails without its production change, that is a new defect and deserves the same evidence shape #2979 used (bit-identity against single-sequence runs); if it passes onmain, then it is a regression guard and should be labelled as one — a guard and a fix are both worth merging, but only one of them closes an issue.
The strongest thing in this body is worth keeping verbatim, wherever this ends up:
"I reproduced both halves of it on this box — host-GEMM, no device, no ticket."
A device-free reproduction of a sequencing defect is exactly the instrument this repo needs more of: it makes the arm runnable in CI, in a review, and on any lane, and it removes the npu-hold ticket from the loop that decides whether a fix is real. That sentence is why the arms are worth salvaging.
Not blocking on the author's judgement: the concurrency is bad luck, and the test work stands on its own once it is separated from the code that merged.
|
Duplicate of #2979, which merged at 15:10 — and the code difference is a comment, not a behaviour. Both branches carry the same one-condition exemption on the same line, and Recommend closing with a pointer and deleting the branch — the fleet rule is one PR per finding, and this one has already merged. Nothing is lost: if the comment wording here is better (it does name the case "a re-used slot holds 7 position(s), but this pass starts it at 0", which is the concrete message a reader will grep for), a follow-up that changes only comments is cheaper than a second PR's build slot. I reviewed #2979 READY at |
|
VERDICT at The engine change is already on
|
|
VERDICT: CHANGES That is your change, verbatim, on main since What is worth keeping from this PR: if your version differs in any way from what merged, say how in a comment on #2978 and I will read it as a follow-up. The merged arm is Two mechanical reasons not to rescue it as-is:
And the gap this exposed in the detector I ship: |
|
#2982 is redundant: its source change is already on main, merged as The source change is on main
This branch predates And the test rework disagrees with the one that merged
Both cannot be right, and the one on main was established by running it in both orders. Merging this would either conflict on the fixture or silently re-order the arms — and the failure it produces is the next arm being refused for a sequencing reason, which reads as a second bug. What I checked, so the close is not a guessThe refusal arms move but none are removed — the RecommendationClose If the author believes the ordering should change, the case to make is against the recorded measurement ("found by running it before the single-slot arm: that arm then asked for slot 0's old length and was correctly refused") rather than against an unmerged copy of the same branch. |
|
Closing as superseded by #2979 ( Worth recording what each side has, because the overlap is complete:
So the code is theirs and the merge would have been a no-op. What I keep is the three-state measurement, which is the part I would want if I were reviewing that PR, and which confirms its shape independently: The middle line is the one worth keeping: the second defect is only visible once the first one stops refusing, which is exactly the "both changes have to land together" claim the issue made — and it is also why a suite that skips (77) without On the duplication itself: I claimed the issue at 15:07 and opened this PR minutes later; #2979 was already in flight and merged at 15:10. A claim comment cannot stop a lane that is already coding, and Branch deleted. |
|
Duplicate-of-merged flag, before the queue spends a build on it: this exact fix is already on
I found the defect the same way you did — The difference between the two is only which arm moves: #2979 moves the re-used-slot arm last (it deliberately resets slot 0 to a 4-position sequence, so everything after it reads a cache the earlier rounds did not build); this PR moves the single-slot arm before it. Both leave the suite green and they are textually different, so this will conflict against I am not closing this (not my PR): but the useful move is to close it and, if you want the "single-slot arm first" ordering instead of mine, say so on #2979 and I will put that in a follow-up — the reasoning in your comment is right, and it is the same reasoning as mine. |
Every pass in this tool compared OPEN pull requests with each other. When one of a pair merges the pair stops existing, so the gate reports clean -- and today that happened for real: #2982 (`Fixes #2978`, opened 15:09) duplicated #2979, which merged the identical one-line fix at 15:10. Measured after the fact: 5 open PRs against 76 recently merged ones, 1 hit. A gate that looks at only the open half of the population cannot see the case where the answer is already on main. mended_twins() compares an open PR's closing claims against PRs merged within --mended-days (default 2). Two bounds on purpose: * a TIME bound, not a count: issues like #2478 accumulate merged PRs for weeks, and comparing against all history would report every long-running issue as a duplicate; * it is a TWIN only when the two touch a shared file. Without a shared file it is a follow-up that used the wrong verb, which is reported on stderr and does not fail the run -- `Fixes #N` should be `Refs #N`, but a text nit must not red a gate that is supposed to refuse only real duplication. The fix found its own bug before it shipped: the first version called files_of(number), but its contract is files_of(repo, numbers) -- a TypeError that would have fired on the first twin found, i.e. a latent crash in exactly the path that matters, invisible until a twin exists. Proven after fixing by driving main() with a stubbed gh: rc 1 with the finding printed. 6 arms (40 -> 46, rc 0): a shared-file twin is a finding; a follow-up on other files is a note and not a failure; a merge outside the window is neither.
…2984) Every pass in this tool compared OPEN pull requests with each other. When one of a pair merges the pair stops existing, so the gate reports clean -- and today that happened for real: #2982 (`Fixes #2978`, opened 15:09) duplicated #2979, which merged the identical one-line fix at 15:10. Measured after the fact: 5 open PRs against 76 recently merged ones, 1 hit. A gate that looks at only the open half of the population cannot see the case where the answer is already on main. mended_twins() compares an open PR's closing claims against PRs merged within --mended-days (default 2). Two bounds on purpose: * a TIME bound, not a count: issues like #2478 accumulate merged PRs for weeks, and comparing against all history would report every long-running issue as a duplicate; * it is a TWIN only when the two touch a shared file. Without a shared file it is a follow-up that used the wrong verb, which is reported on stderr and does not fail the run -- `Fixes #N` should be `Refs #N`, but a text nit must not red a gate that is supposed to refuse only real duplication. The fix found its own bug before it shipped: the first version called files_of(number), but its contract is files_of(repo, numbers) -- a TypeError that would have fired on the first twin found, i.e. a latent crash in exactly the path that matters, invisible until a twin exists. Proven after fixing by driving main() with a stubbed gh: rc 1 with the finding printed. 6 arms (40 -> 46, rc 0): a shared-file twin is a finding; a follow-up on other files is a note and not a failure; a merge outside the window is neither. Co-authored-by: phyb5 <bcloud@local>
Closes #2978, and I reproduced both halves of it on this box — host-GEMM, no device, no ticket.
The engine change
step_users()refuses a pass whose first row for a slot is not at that slot's sequence end (rightly: a row appends at its own position and reads0..pos), but the guard had no exception for position 0 — while the loop immediately below clears the caches for exactly that case. So the reset path was unreachable, and the refusal described the very case it refused. The fix is the exemptionpos[m] != 0.The test change, which has to land with it
With the exemption the re-used-slot arm passes and a second defect surfaces, precisely as the issue predicted: the single-slot arm continues slot 0 from the position the batched rounds reached, and it ran after the re-used-slot arm — which deliberately resets slot 0 to a 4-position sequence. It now runs before that arm, with a comment saying why the order is the point.
Measured, three states, same command (
ONEBIT_TEST_Q4NX=~/models/npu/Qwen3-0.6B)The middle line is the interesting one: it is what a reviewer would have seen had the engine fix shipped alone, and it is why the issue says both changes must land together.
Not changed
The guard itself for a genuine mid-sequence start — a row at position 3 of a slot holding 7 is still refused, which is the case it exists for — and the clearing loop, which already did the work this exemption lets it reach.
pre-pr-checks14 green / 2 skipped.