Repository navigation
tools/ci: the f16 guard list learns about online_softmax's max floor (10 → 11, ratchet green at c5a0f6637) - #2395
bong-water-water-bong wants to merge 1 commit into
Conversation
At fork head c5a0f6637 the engine's ratchet fails:
hrx_f16_narrowing: loom-libs/motifs/flash_attention/online_softmax.loom now carries a guard marker
-- add it to tools/ci/hrx_f16_guards.txt
hrx_f16_narrowing: FAIL (0 new, 0 stale of 84, 0 unclassified fptrunc; 0 new, 0 stale of 22 accumulator(s))
0 new and 0 stale in both lists: nothing about narrowing or accumulation changed. The only difference is
the guard SET, because llama.cpp a5cf1f2c4 ('online_softmax floors the max before the scale, so a masked
block is not NaN', #348) added a floor that the engine's copy of the list has not seen.
That is a genuine numerical fix and worth keeping visible:
%next_max_floor = vector.constant -3.400000e+38 : vector<4xf32>
%next_max_safe = vector.maxnumf %next_max, %next_max_floor : vector<4xf32>
-- a fully masked block has a running max of -inf, and exp(x - max) on that is NaN; flooring it keeps the
softmax finite. The kernel says so itself, including why the marker is not one of the prescale kinds:
// guard: f16-narrowing -- declared for tools/ci/hrx_f16_narrowing.py, whose GUARD markers are
// ("scale_log2", "prescale") for the prefill GEMMs. This one is not a prescale: it floors the running max
So the list gets one line (10 -> 11 guards) and the next pin bump stops failing on it.
Verified at c5a0f6637, fingerprint b9b121a5ddc51854 (326 .loom):
before: FAIL (the message above)
after : 84 narrowing bodies, none new, none stale; 22 f16 accumulator bodies, none new, none stale;
11 of the narrowing bodies carry a guard marker
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
Closing this: as a standalone change it turns engine The guard list is tied to the commit the engine pins, not to the fork head. Measured both:
it must land in the same PR that bumps the pin to a commit at or past My first version was written and verified against the fork head, which is the wrong reference — the engine's CI runs What I am doing instead
The underlying finding stands and is worth keeping: at fork head |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: CHANGES at 0eb56af — the line is right for the fork head and wrong for the engine's current pin, and I measured both sides
The guard list and the submodule pin have to move together, and this PR moves only one of them. third_party/llama.cpp is pinned at e6c80014eb1c in this repo (git ls-tree HEAD third_party/llama.cpp), and at that commit online_softmax.loom does not carry the marker — so the added line is stale there:
pin e6c80014e, tools/ci/hrx_f16_guards.txt as main has it rc 0
hrx_f16_narrowing: 51 narrowing body(ies), none new, none stale;
11 f16 accumulator body(ies), none new, none stale
pin e6c80014e, tools/ci/hrx_f16_guards.txt with this PR's line rc 1
FAIL … online_softmax.loom NO LONGER carries a producer-side guard marker
So a green CI on this PR is a statement about a corpus the submodule pin does not contain. The PR's own evidence is at fork head c5a0f6637, where the marker exists because llama.cpp#348 landed the maxnumf floor — that commit is not what this repo's submodule points at.
What makes this worth blocking rather than noting: the failure mode is a ratchet that cannot be satisfied. With the pin where it is, pre-pr-checks and the ctest row go red for every lane, and the line cannot be removed without re-breaking the fork-head case — the two halves need one commit that changes both the guard list and the submodule pin, or the guard line waits.
The right shape, whichever way it is done:
# in the same PR as the line
git -C third_party/llama.cpp checkout c5a0f6637 # the fork head with #348's floor
git add third_party/llama.cpp # the gitlinkand then the guard list and the corpus agree, at both the pin and CI.
Two smaller things I checked, so the CHANGES is only about the pin:
0 new, 0 stale of 51and0 new, 0 stale of 11in the no-line run confirm nothing about narrowing or accumulation changed — this really is one list entry, exactly as the body says;- the PR's quoted fork-head failure (
0 new, 0 stale of 84) differs from what I see at the pin (51narrowing bodies), which is further evidence the two runs are on different corpora. Worth naming the sha the list must match in the PR body — "at pine6c80014ethe count is 51, at headc5a0f6637it is 84" — because the next reader will hit the same confusion.
How to reproduce what I did, since this repo's third_party/llama.cpp is absent by disk hygiene:
ln -sfn ~/wt/prs2-llama third_party/llama.cpp # then check out the pin inside it
git -C ~/wt/prs2-llama checkout e6c80014e
python3 tools/ci/hrx_f16_narrowing.py --check
rm -f third_party/llama.cpp # git refuses `stash` while it is a symlink|
VERDICT: CHANGES REQUESTED at Measured, at the engine's actual pinThe row you add names a file that does not exist in the pinned corpus (the flash-attention motif family arrives with the later pin), so the baseline has an entry and the tool finds nothing for it. That is the check doing its job correctly — a baseline row is a claim about a body that exists and carries a marker. And the bump does not rescue itI also tested against the pin #2357 proposes ( because GUARD = ("scale_log2", "prescale")so even with #348 merged the marker is not one the detector recognises — What would make this PR land cleanBoth halves, in this order:
As written the row precedes both, so the engine's f16 ratchet goes from green to red for a body that is not in the tree yet. Nothing is wrong with the intent: this is the row that should exist after those two land. For the bodySay the dependency explicitly — "lands the row; needs llama.cpp#348 merged and the pin bumped, and |
|
VERDICT: READY One line, one guard, and the claim checks out: The one thing worth saying about this class: a guard file that grows one entry per kernel is a ratchet that must be updated by whoever lands the kernel, and the failure mode when it is not is a red main attributed to the wrong lane — which is exactly what happened here. If this file is meant to be authoritative, the count belongs in a comment at the top (or better, the checker should print "expected ≥ 11, found 10, missing: " rather than a bare count mismatch). Cheap, and it turns "the ratchet fails" into "this kernel is unguarded". Not blocking: the fix is correct and minimal. |
What
One line:
tools/ci/hrx_f16_guards.txtgainsloom-libs/motifs/flash_attention/online_softmax.loom(10 → 11 guards).Why
At fork head
c5a0f6637the engine's ratchet fails:0 newand0 stalein both lists — nothing about narrowing or accumulation has changed. The only difference is the guard set: llama.cppa5cf1f2c4("online_softmax floors the max before the scale, so a masked block is not NaN", engine#2374 → #348) added a floor that our copy of the list has not seen. Every pin at or past that head fails this check until the list is updated.The guard is a real fix, so it is worth naming here
A fully masked block has a running max of
-inf, andexp(x - max)against that is NaN; flooring it keeps the softmax finite. The kernel explains why the marker is not one of the prescale kinds the ratchet also looks for:Verified at
c5a0f6637, fingerprintb9b121a5ddc51854(326.loom)FAIL (0 new, 0 stale of 84 …; 0 new, 0 stale of 22 accumulator(s))+ the guard-marker message84 narrowing bodies, none new, none stale; 22 f16 accumulator bodies, none new, none stale; 11 carry a guard marker--writeproduces exactly84 / 22 / 11, so the committed list is what the tool generates rather than a hand edit.Scope
Baseline list only. No kernel, no dispatch, no narrowing/accumulator entry added or removed — the two lists that would signal a regression are untouched, which is why this is safe to merge ahead of the next pin bump rather than with it.
Refs engine#2138 (the pin), llama.cpp#348, engine#2374.