Repository navigation
M5: opt-in full-fp32 P x V for Nemotron's prompt attention (part of #1772) - #1882
Merged
Merged
Conversation
Keep the relaxed tensor product by default. Use FP32 FMA products under TF_ATTENTION_PV_FP32=1, separate prompt-state identities, and register both modes with the actual cut path as a precision control. Fixes #1772.
Build shared, paged and image attention libraries through the production source selector, and report which P x V mode each measured library uses. Refs #1772.
Preserve the measured one-sided operand cut for the default Nemotron prompt range. In full mode count its FMA chain and explicitly compile the cut product as the negative control. Keep masked-key findings separate in both modes. Part of #1772.
ashhart
force-pushed
the
lead/attn-pv-fp32
branch
from
November 2, 2026 02:23
25a8a34 to
5f23e50
Compare
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.
Part of #1772.
TF_ATTENTION_PV_FP32=1(off by default) keeps Nemotron's Metal prompt attention's P x V at full fp32 on the M5, instead of the tensor units' 10-mantissa-bit cut. Unset, every buffer, launch and output is unchanged.On an M5 Ultra against a binary64 reference, output cells off the nearest bf16 value fall from 1,141,167 to 1,800 (of 8.6M) on ordinary inputs, and from 517,840 to 277 with P spread over [0, 1]. It's an FMA path, so prompts are 30% to 87% slower at 2K to 32K (MLX 4-bit). That's why it stays opt-in; a tensor-unit version follows. The kernel contract registers it with its own bound and controls. An independent review found the unset path byte-identical and #1748's operand-cut terms kept.