Repository navigation
Conversation
ashhart
force-pushed
the
lead/softmax-identity-skip
branch
3 times, most recently
from
November 23, 2026 13:48
60254d8 to
d60f2a4
Compare
Keep the finite stable-max guards behind TF_METAL_SOFTMAX_IDENTITY_GUARD. The A/B baseline compiles the same shaders with the flag at zero, with no copied baseline kernels or lean exemption.
Keep the finite stable-max guards behind TF_CUDA_SOFTMAX_IDENTITY_GUARD. Build the unguarded reference from the same CUDA sources with flag zero; update generated Qwen controls and remove all copied baselines.
ashhart
force-pushed
the
lead/softmax-identity-skip
branch
from
November 23, 2026 18:38
d60f2a4 to
81f7bb6
Compare
Contributor
|
Attempted the sm_120 kernel contract on this head (
|
4 of 8 tasks
This was referenced Nov 25, 2026
This branch has not been deployed
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.
What this changes
Online softmax rescales its running state by
exp(old_max - new_max)after each key tile; when the maximum doesn't change that factor is exactly 1. This skips the identity work in the served online-softmax updates on CUDA and Metal, behind guards: the shortcut runs only when the maximum is finite and every skipped operand or fast result is finite, so signed zeros, subnormals, NaN payloads and infinities behave as before.TF_CUDA_SOFTMAX_IDENTITY_GUARD/TF_METAL_SOFTMAX_IDENTITY_GUARD(compile-time, default 1) build the unguarded variant from the same sources so the GPU contract compares the two.Not landing yet
This changes every served attention kernel's default, and the finite checks may cost what they save, so it lands only after the full kernel contract on sm_121, sm_120, M3 Ultra and M5 Ultra (guarded vs unguarded byte equality, planted controls red) and paired whole-request A-B-B-A per family with tokens compared. Kill on any byte or token difference, any slower cell, or under 3% whole-request gain.