Repository navigation
Contract: masked non-finite values across every Metal prompt attention, the findings registered as known (refs #1009) - #2308
Merged
Conversation
This was referenced Nov 6, 2026
ashhart
added a commit
that referenced
this pull request
Nov 6, 2026
ashhart
force-pushed
the
lead/masked-nonfinite-census
branch
from
November 6, 2026 14:15
edd1bd6 to
74082c0
Compare
Check masked Inf and NaN separately against binary64, including visible IEEE classes, sparse padding and wrapped windows. Retain the 45 measured inherited failures as known #1009 findings and catch both planted GPU controls. Register the suite in the Metal contract and provide a source-only focused runner. Production kernels and dispatch remain unchanged.
…e the default install
… no longer shadows launchOf's text
ashhart
force-pushed
the
lead/masked-nonfinite-census
branch
from
November 6, 2026 14:36
811e6d2 to
158b5eb
Compare
ashhart
added a commit
that referenced
this pull request
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1009 (the finding from 28 Oct). #2106 fixed it for Qwen3.8-27B. This finds where else it holds.
A row gives probability 0 to a key it must not see, so a masked key whose value is +Inf or NaN should add nothing to that row. In many prompt-attention kernels, 0 × Inf gives NaN instead. This adds a contract census of that case across every Metal family with its own prompt attention:
The findings are registered as known, as #2106 registered the 27B's before fixing it, so nothing new goes red on main. Flash Next is left out (its own line).
On an M5 Ultra, 45 panels are red and 37 green on main:
Fixes follow family by family, the 27B's way: finite prompts run main's kernel unchanged, and the masked read sits only where a masked non-finite value can occur.
zig build tf-masked-valuesandzig build test-masked-values-host(macOS, outside the default install). The census also runs insidetf-kernel-contract.test-masked-values-host: 148 of 148 tests;zig build: 255 of 255 steps;zig fmt --check;metal_main.zigstays at 600 lines).