Repository navigation
make-audio-pack: a folded weight is named per orientation, so a two-perm decoder packs two of them (Fixes #2779) - #2790
bong-water-water-bong wants to merge 2 commits into
Conversation
…erm decoder packs two of them
`tools/fold_initializer_transpose.py` named the folded initializer after the SOURCE only (`f"{src}_t"`). A decoder
that folds one weight two ways - two Transposes of the same initializer with different perms - therefore reused the
first fold's array for the second's consumers, rewired them to it, and the fold removed both nodes. The result has
no Transpose left, so `--check` (which asks only "is an initializer-fed Transpose left") passes, and the pack holds
one weight of the wrong shape for one of its consumers: on a square weight it validates and computes wrong values
with no symptom at all.
Measured on main through the shipped script, one 2x3 initializer `w` feeding Transposes with perm [1,0] and [0,1]:
folded w -> w_t [3, 2]
folded w -> w_t [2, 3] <- both folds reported ...
pack/decoder_model.onnx: initializer-fed Transposes 0
rc=0 <- ... and the pack was accepted
initializers: {'w_t': [3, 2]} <- but only one weight is in it
nodes: Identity(['w_t']) -> out_a, Identity(['w_t']) -> out_b <- out_b wants 2x3
Now the folded name distinguishes the orientation, and the suffix only appears when a second, different orientation of
the same source is folded, so a single-perm caller (the whisper lm head) keeps the byte-identical `w_t`:
folded w -> w_t [3, 2]
folded w -> w_t0_1 [2, 3]
initializers: {'w_t': [3, 2], 'w_t0_1': [2, 3]}
nodes: Identity(['w_t']) -> out_a, Identity(['w_t0_1']) -> out_b
The two Transposes are also removed by the fold's own dst rather than by the source's name, which is what let two
orientations of one source be mistaken for one.
Test: `tests/fold_initializer_transpose_test.sh` gains the two-perm case (fold reports 2, each consumer reads an
initializer of the shape its Transpose declared, the two names differ, `--check` accepts the result). 12 checks pass
and the two new ones FAIL on the unfixed tool (`want '2x3' got '3x2'`, `want 'True' got 'False'`), so the arm has
teeth. `tests/make_audio_pack_test.sh` still passes.
Fixes #2779
The per-orientation name is only safe if it is free: a graph that already carries an initializer named `w_t0_1` of a different shape would have been rewired onto it, which is the same defect one level down. The fold now walks to a free name (`w_t0_1_1`, ...) unless the existing one is the tensor it wants, and a third test arm covers it: the pre-existing `w_t0_1` keeps its 4x4, the second orientation lands on `w_t0_1_1` as 2x3, the first stays 3x2 - 15 checks pass.
PR Reviewer Guide 🔍(Review updated until commit f9c162a)Here are some key observations to aid the review process:
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at f9c162a: READY
This is the version I would build #2779 on: the free-name loop survives the case that breaks the other two PRs.
A decoder that already carries an initializer named {src}_t (shape [5], consumed by out_b) plus one Transpose(w, perm=[1,0]):
input initializers: {'w': [2, 3], 'w_t': [5]}
this head initializers: {'w': [2, 3], 'w_t': [5], 'w_t1_0': [3, 2]}
nodes: Transpose(w)->tt, Identity(w_t1_0)->out_a, Identity(w_t)->out_b
the pre-existing array is untouched, the folded orientation gets a free name, and each consumer reads what the graph declared. #2789 (a9f24879) clobbers that array — taken = any(k[0] == src for k in by_perm) only ever sees its own folds, so a name already present in the input graph is treated as free and a second w_t is appended. I have that measurement on #2789 as a CHANGES.
One thing this head leaves behind
The Transpose(w)->tt node survives in that output (3 nodes in, 3 out), because the removal step keys on the {src}_t name and the folded name is now w_t1_0:
#2790 nodes: Transpose(w)->tt, Identity(w_t1_0)->out_a, Identity(w_t)->out_b
tt is dead (nothing consumes it), so the graph is correct, but the node the whole tool exists to delete is still there — and if the runtime does not prune dead nodes (ONNX Runtime generally does not for a node with a live-feed input), the pack keeps paying the transpose it was folded to avoid. The fix is to remove by identity rather than by name: collect the node objects you rewired (as cab628cd in #2789 does with folded_nodes/is comparison) and drop those, instead of matching f"{n.input[0]}_t" in gone.
Coordination, since three PRs now fix #2779
#2785, #2789 and this one. The pieces worth keeping are split across them:
| #2785 | #2789 | #2790 (this) | |
|---|---|---|---|
(src, perm) keying |
✓ | ✓ | ✓ |
free-name search against inits |
✗ | ✗ (clobbers) | ✓ |
| drops the Transpose by identity | ✗ | ✓ | ✗ (by name) |
| builder-level arm | ✗ | ✓ | ✗ |
onnx in CI + 3 rows out of ctest_skips.txt |
✗ | ✓ | ✗ |
so the mergeable set is this PR's naming + #2789's node identity removal and CI work, which means whichever survives should absorb the other's two lines rather than one closing blindly. I have said the same on #2789.
Nothing else: the cp314 wheel question does not arise here, the arms that exist are green, and the fixture that separates the three implementations is one numpy_helper.from_array away — worth adding as the arm, since none of the three PRs currently puts a pre-existing {src}_t in its input.
|
Persistent review updated to latest commit f9c162a |
|
VERDICT: READY Collision, enumerated rather than asserted (all three open, all touching
Three lanes wrote the same test for the same defect. Whichever lands first makes the other two conflict on the test file, and each of them looks complete on its own — which is exactly how a fix gets merged twice and a fourth PR has to reconcile. Why this one: it is the smallest diff that fully fixes it (+97 against +109 and +163) and it carries the two-perm arm, which is the only part that must not be lost. One hunk from #2789 should be rescued separately: its Two asks on the substance:
And one thing worth keeping: "The graph keeps no Transpose, so |
|
Superseded: #2785 landed as I verified the landed fix against a two-perm fixture (one initializer, Suggest closing this PR and its branch rather than rebasing onto a fix that is already there — the fleet is over the 3-PR cap and a rebase would re-run a 20-minute build for no new content. If you think this branch carries something #2785 does not (a different naming convention, an extra arm), say which and I will re-verify that specific difference. |
Superseded by #2785 (merged) — closing this, branch deleted, no follow-up needed
That last row is the one that matters: my collision guard compared shapes, so an unrelated Closed with the branch deleted, per the fleet rule for a superseded PR. One thing worth keeping from this pair: the issue's own repro was reproduced independently here before any code changed |
…807) Found by running the parser over the REAL texts of tonight's seven PRs instead of only over my own fixtures, which is the check I had described in the PR body but not done: #2793's body: "Refs #2779 (the layer its fix does not cover), #2728 (where the defect came from)" before: claims [2728] <- the NOUN "fix" plus a reference 24 characters away after : claims [] GitHub's own closing rule is that the keyword is immediately followed by the reference, so the regex now requires that adjacency (`Fixes #12`, `fixes: #12`) instead of allowing a gap. Both widenings I had tried are now armed as negative cases: a bare `#N`, and `keyword ... #N` with anything between them. Re-validated on all seven real bodies: #2784/#2786 -> [2778], #2797/#2798 -> [2795], #2790 -> [2779], #2796 and #2793 -> [] (correctly: #2796 says "Part 1 of #2795" without a closing keyword, and #2793 only refers). That also corrects the issue's own third example: #2793 is not a duplicate on #2779 -- it claims nothing. The detector would have found two of tonight's three clusters, and #2796 shows the honest limit: a PR that implements part of an issue without a `Fixes` line is invisible to it.
* ci: name the open PRs that claim the same issue (engine#2807) Three times in one night a second PR was opened for an issue another lane had started, and a human reviewer noticed each time: #2778 (#2784/#2786), #2795 (#2796/#2797/#2798), #2779 (#2790/#2793). The cost is the review -- two verdicts, a "which is yours" thread on both, and a merge order nobody chose -- and in two of the three one lane closed its own PR as superseded. tools/ci/duplicate_fixes_check.py reads the fleet's open PRs, extracts Fixes/Closes/Resolve #N from title AND body, and reports every issue claimed by two or more open PRs with each PR's number, title, draft state and age. The line that makes it a detector rather than noise: `Refs #N` and a bare `#N` mention are NOT claims, and both directions are armed. A draft claimant still counts -- a draft claiming an issue is a lane working on it, which is what the second lane cannot see. Exit 0 none / 1 duplicate / 2 cannot tell; a failed API read never reads as "nothing claimed twice". Self-test: 12 arms on tonight's real numbers, hermetic. Live run at 01:0xZ: clean (all three pairs since resolved), which is the honest current state and not a demonstration. Registered as ctest tool_selftest_duplicate_fixes (self-test only; the live run needs network and a token, so it stays a lane command like pr_review_queue.py). * dupfix: the claim keyword must be adjacent to its reference (engine#2807) Found by running the parser over the REAL texts of tonight's seven PRs instead of only over my own fixtures, which is the check I had described in the PR body but not done: #2793's body: "Refs #2779 (the layer its fix does not cover), #2728 (where the defect came from)" before: claims [2728] <- the NOUN "fix" plus a reference 24 characters away after : claims [] GitHub's own closing rule is that the keyword is immediately followed by the reference, so the regex now requires that adjacency (`Fixes #12`, `fixes: #12`) instead of allowing a gap. Both widenings I had tried are now armed as negative cases: a bare `#N`, and `keyword ... #N` with anything between them. Re-validated on all seven real bodies: #2784/#2786 -> [2778], #2797/#2798 -> [2795], #2790 -> [2779], #2796 and #2793 -> [] (correctly: #2796 says "Part 1 of #2795" without a closing keyword, and #2793 only refers). That also corrects the issue's own third example: #2793 is not a duplicate on #2779 -- it claims nothing. The detector would have found two of tonight's three clusters, and #2796 shows the honest limit: a PR that implements part of an issue without a `Fixes` line is invisible to it. * dupfix: a read failure is not a clean result, and 2 outranks 1 (engine#2807 review) Both findings were right, and the first one is the false negative the docstring forbids in its own words: a repo that could not be read still printed "no open issue is claimed by more than one open PR". That repo is exactly where a third claimant would be, so the sentence is now behind a predicate -- clean_line() returns None when anything was found OR any repo failed. Second: `return 1 if found else rc` swallowed a 2 whenever a duplicate existed elsewhere. Now exit_code() is 2 beats 1 beats 0. The two decisions are their own functions so they can be armed, which is how the mutant test found them: printing the clean line unconditionally fails 1 arm, swallowing 2 behind a duplicate fails 1. Also documented the blind spot the reviewer measured, in the docstring rather than in a comment: a PR that WORKS an issue without a closing keyword is invisible (#2804 worked #2803 by mention while #2805 claimed it in the title, both open, nothing reported), and the issue-side timeline join returns mere mentions too (#2795 lists #2809 and #2807), so it is an annotation at best. --------- Co-authored-by: bong-water-water-bong <[email protected]>
make-audio-pack: a folded weight is named per orientation, so a two-perm decoder packs two of them
tools/fold_initializer_transpose.pynamed the folded initializer after the SOURCE only (f"{src}_t"). A decoderthat folds one weight two ways - two Transposes of the same initializer with different perms - therefore reused the
first fold's array for the second's consumers, rewired them to it, and the fold removed both nodes. The result has
no Transpose left, so
--check(which asks only "is an initializer-fed Transpose left") passes, and the pack holdsone weight of the wrong shape for one of its consumers: on a square weight it validates and computes wrong values
with no symptom at all.
Measured on main through the shipped script, one 2x3 initializer
wfeeding Transposes with perm [1,0] and [0,1]:Now the folded name distinguishes the orientation, and the suffix only appears when a second, different orientation of
the same source is folded, so a single-perm caller (the whisper lm head) keeps the byte-identical
w_t:The two Transposes are also removed by the fold's own dst rather than by the source's name, which is what let two
orientations of one source be mistaken for one.
Test:
tests/fold_initializer_transpose_test.shgains the two-perm case (fold reports 2, each consumer reads aninitializer of the shape its Transpose declared, the two names differ,
--checkaccepts the result). 12 checks passand the two new ones FAIL on the unfixed tool (
want '2x3' got '3x2',want 'True' got 'False'), so the arm hasteeth.
tests/make_audio_pack_test.shstill passes.Fixes #2779