Skip to content

tools/ci: the f16 guard list learns about online_softmax's max floor (10 → 11, ratchet green at c5a0f6637) - #2395

Closed
bong-water-water-bong wants to merge 1 commit into
mainfrom
guards-online-softmax
Closed

bong-water-water-bong wants to merge 1 commit into
mainfrom
guards-online-softmax

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

What

One line: tools/ci/hrx_f16_guards.txt gains loom-libs/motifs/flash_attention/online_softmax.loom (10 → 11 guards).

Why

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 has changed. The only difference is the guard set: llama.cpp a5cf1f2c4 ("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

%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) 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:

// 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

Verified at c5a0f6637, fingerprint b9b121a5ddc51854 (326 .loom)

result
before FAIL (0 new, 0 stale of 84 …; 0 new, 0 stale of 22 accumulator(s)) + the guard-marker message
after 84 narrowing bodies, none new, none stale; 22 f16 accumulator bodies, none new, none stale; 11 carry a guard marker

--write produces exactly 84 / 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.

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
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

348 - Partially compliant

Compliant requirements:

  • The PR updates tools/ci/hrx_f16_guards.txt to include a new guard marker for loom-libs/motifs/flash_attention/online_softmax.loom
  • This addresses the immediate issue of the ratchet failing due to an untracked guard

Non-compliant requirements:

  • The PR does not address the core issue of uncovered Hugging Face model architecture classes mentioned in the ticket description
  • No changes were made to registry/architectures.json, registry/significant.json, or docs/arch-gaps.md to map the uncovered architectures

Requires further human verification:

  • The PR does not include a re-run of python3 tools/census_watch.py to confirm the fix
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Missing Architecture Mapping

The PR only updates the f16 guard list but does not address the core issue of uncovered Hugging Face model architecture classes. The ticket requires mapping these architectures in registry/architectures.json or documenting why they are not aliases in registry/significant.json and docs/arch-gaps.md.

loom-libs/motifs/flash_attention/online_softmax.loom

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Closing this: as a standalone change it turns engine main red, and I only found that by checking the right layer.

The guard list is tied to the commit the engine pins, not to the fork head. Measured both:

corpus at guard list result
pinned 6485e5d69 10 (current main) passes
pinned 6485e5d69 11 (this PR) FAIL — online_softmax.loom NO LONGER carries a producer-side guard marker
fork head c5a0f6637 10 (current main) FAIL — … now carries a guard marker
fork head c5a0f6637 11 (this PR) passes

git merge-base --is-ancestor a5cf1f2c4 6485e5d69 says NO: the floor fix (#348) is not in the engine's current pin. So the two states pull in opposite directions, and the guard line has a hard ordering constraint:

it must land in the same PR that bumps the pin to a commit at or past a5cf1f2c4.

My first version was written and verified against the fork head, which is the wrong reference — the engine's CI runs tools/ci/hrx_f16_narrowing.py --check against its own submodule checkout. A baseline change is not free-standing when the baseline is versioned by the pin.

What I am doing instead

  • Closing this and deleting the branch, so the one-line change cannot be merged on its own.
  • The requirement is now recorded where the next pin bump will read it: when the pin moves past a5cf1f2c4, tools/ci/hrx_f16_guards.txt gains loom-libs/motifs/flash_attention/online_softmax.loom (10 → 11) in the same PR, and --write produces exactly 84 / 22 / 11.

The underlying finding stands and is worth keeping: at fork head c5a0f6637 the ratchet fails on the guard set alone (0 new, 0 stale in bodies and accumulators), because #348 added a floor — vector.maxnumf %next_max, -3.4e38, which stops a fully masked block's -inf running max from making exp(x - max) NaN. That is a real fix and its guard marker is legitimate; it just belongs to the pin bump, not to a PR of its own.

@bong-water-water-bong
bong-water-water-bong deleted the guards-online-softmax branch November 14, 2026 03:06

@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: 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 gitlink

and 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 51 and 0 new, 0 stale of 11 in 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 (51 narrowing 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 pin e6c80014e the count is 51, at head c5a0f6637 it 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

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT: CHANGES REQUESTED at 0eb56af — one line, and it turns hrx_f16_narrowing --check red on the engine's own tree. This is the second half of an ask I made on llama.cpp#348, landing before the first half.

Measured, at the engine's actual pin

pin (origin/main → third_party/llama.cpp)   e6c80014
$ python3 tools/ci/hrx_f16_narrowing.py --check --root .
FINGERPRINT 7daf4d8d3516be1b (124 .loom file(s))
hrx_f16_narrowing: loom-libs/motifs/flash_attention/online_softmax.loom NO LONGER carries a
                   producer-side guard marker -- …
hrx_f16_narrowing: FAIL (0 new, 0 stale of 51; 0 new, 0 stale of 11 accumulator(s))

The 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 it

I also tested against the pin #2357 proposes (6485e5d69), which does contain online_softmax.loom:

$ grep -c 'f16-narrowing' <that file>        →  0

because guard: f16-narrowing arrives with llama.cpp#348, which is still open, and tools/ci/hrx_f16_narrowing.py:91 is still:

GUARD = ("scale_log2", "prescale")

so even with #348 merged the marker is not one the detector recognises — guarded() would still return nothing for that file and the row would still read "NO LONGER carries".

What would make this PR land clean

Both halves, in this order:

  1. GUARD learns the marker — GUARD = ("scale_log2", "prescale", "f16-narrowing") (or a general "guard:", which lets the next guard name itself without a tuple edit). This is the other half of the ask I made on llama.cpp#348, where I wrote that the engine-side detector needs it.
  2. then the baseline row, once the corpus in the pinned tree actually carries it — i.e. after census: new HF model class uncovered by the registry #348 merges and after the pin bump (third_party/llama.cpp: pin to the fork head 912c079d8 (#327's merge + #337/#339), and the engine builds and tests against it (refs #2138) #2357) brings the file in.

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 body

Say the dependency explicitly — "lands the row; needs llama.cpp#348 merged and the pin bumped, and GUARD extended to the marker, or the check reports the body as unguarded" — because the next person to see red on hrx_f16_narrowing will otherwise spend a session on the corpus.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT: READY 0eb56af

One line, one guard, and the claim checks out: tools/ci/hrx_f16_guards.txt holds 10 entries on origin/main, this adds loom-libs/motifs/flash_attention/online_softmax.loom → 11, which is the count the description states. So the ratchet stops failing at fork head c5a0f6637 for the reason given rather than by loosening a threshold.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant