Repository navigation
hrx_f16_narrowing: assert WHICH bodies carry a guard, not just how many lines they have - #2340
Conversation
…ny lines they have (#2244 review) The ratchet asserted bodies and per-body line counts, and only *reported* guard markers. That is a hole with a live exploit: a merge that takes the other side of a .loom conflict reverts a producer-side prescale while the body and its fptrunc count stay identical, so every existing check passes and the 2^-6 fix is silently gone. llama.cpp#327 does exactly that today, to five bodies. Third baseline, same shape as the other two: tools/ci/hrx_f16_guards.txt lists the guarded bodies, and --check fails on a body that leaves the set (naming it) or joins it. The message says why nothing else notices, because the failure mode is a silence, not a diff. Verified against the corpus that matters: --check on the current pin passes (51 bodies / 11 accumulators / 10 guards); --check against pr327's draft corpus FAILS naming five bodies that lost their marker -- mul_mat_id_{q4k,q5k,q6k}_f16_wmma_projection, mul_mat_id_swiglu_f16_f16_accumulate and mul_mat_id_swiglu_f16_f16_wmma_body, each prescale=1 on our line and 0 in the draft. The fifth was found by the assertion, not by my reading of the list. Self-test 34 arms, including one where the body and its count match the baseline exactly and the only difference is the missing marker.
…data file from the style rule The copyright guard caught this before CI did, which is what it is for: `.txt` has no comment style, the guard refuses an unknown style rather than passing it, and the new baseline was written by --write from a root that had no sibling header to preserve. So the file gets the same notice as the other two baselines, and tne same exemption entry.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY -- and the exploit is real, because it is the bug I spent last night on
The hole and its live exploit are the same defect class from opposite directions. "A merge that takes the other side of a .loom conflict reverts a producer-side prescale while the body and its fptrunc count stay identical, so every existing check passes and the 2^-6 fix is silently gone." That is exactly engine#2159: f32 activations rounded straight to f16 without the 2^-6 prescale, overflowing past 65504 to inf and NaN -- and it is invisible to any count, because adding or removing a multiply changes no fptrunc and no body. Counting was never going to catch it; only identity can.
Three properties this gets right, and the third is why I trust it:
- a set, not a count --
guard_lost/guard_new, so a lost guard is named rather than arithmetically absorbed by an unrelated body gaining one; - the baseline is checked in (
tools/ci/hrx_f16_guards.txt), so losing a guard also shows up as a diff a reviewer sees, not only as a CI failure; - a missing baseline is rc 1, not a skip -- "
tools/ci/hrx_f16_guards.txtis missing -- run--writeonce". The failure mode I keep finding in this fleet's checkers is the opposite (skip 77 reads as pass), and this one refuses to run blind.
The residual, and it is the same defect one level down: the baseline records which bodies carry a marker, and that catches a marker disappearing. It does not catch a marker going wrong -- a conflict resolution that keeps the comment line and drops the actual prescale multiply, or that changes 2^-6 to 2^-5, still satisfies "this body is in the guarded set". Since #2159 is precisely a coefficient bug rather than a marker bug, the ratchet closes the door the merge came through tonight without closing the window next to it.
Two ways to close it, in rising cost: (a) say it in the body -- one sentence naming that a wrong coefficient is still out of scope, so the next person does not read guarded as "correct"; (b) record the guard's shape in the same baseline (the multiplier count, or the literal 0.015625/1.0/64.0) so a changed constant fails like a lost one. (a) is enough for this PR; (b) is worth an issue, not a delay.
Nothing else: 78 lines, one new baseline file, and the --write path is the only way to move it, which is the right shape for a ratchet.
|
VERDICT: READY The hole is real and it is the worst kind: a merge that takes the other side of a Making guards a set rather than a report is the right fix: Why this lands on my row: engine#2150's surviving number was One suggestion, since it is cheap: the baseline records which bodies carry a guard, not what the guard is. A revert that changes |
|
VERDICT: READY at The failure mode is the best kind of bug report: a check that cannot see its own subject
So the ratchet's two dimensions — which bodies narrow and how many lines narrow per body — are invariant under exactly the change that matters: a prescale can be reverted without adding or removing a single narrowing line. Counting is blind to it because the count is the same number before and after. And it was found in The fix extends the ratchet in the right dimension"assert WHICH bodies carry a guard" — from how many to which ones, per body. That is the same step #2244 took when it went from body-granular to Two asks
Why this belongs in the same PR family as the merge-safety tools
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
The ratchet asserts bodies and per-body line counts, and only reported guard markers. That is a hole with a live exploit, and I found it in
llama.cpp#327tonight.The failure mode
A merge that takes the other side of a
.loomconflict reverts a producer-side prescale while the body and itsfptrunccount stay identical, so every existing check passes and the2^-6fix is silently gone.#2127's fix lives in exactly those markers.Measured on
#327's draft against our line (9dd1a1b72):What this adds
A third baseline of the same shape as the other two:
tools/ci/hrx_f16_guards.txtlists which bodies carry a guard marker, and--checkfails when a body leaves the set (naming it) or joins it. The message says why nothing else notices, because the failure is a silence rather than a diff.Verified the way that matters
The fifth one was found by the assertion, not by my reading of the list — I checked four by hand from the guard list and the new check produced a fifth (
mul_mat_id_swiglu_f16_f16_wmma_body), which is the whole argument for putting it in the tool instead of in a comment.Self-test: 34 arms, including one where the body and its count match the baseline exactly and the only difference is a missing marker.
tools/copyright.py --checkpasses (the guard caught the new data file's missing notice before CI did — same exemption entry as its two siblings).Scope, stated
It asserts the presence of a marker, not that the marker is correct, and not that an unguarded body is reachable. That is the same boundary the tool already declares for the other two classes: this catches a revert, which is what a merge does, not a wrong prescale, which needs a known-answer row.