Repository navigation
contract: MOSS-Image's reference follows fp32 expf overflow - #4794
Merged
Merged
Conversation
This was referenced Nov 23, 2026
tf_me_conv's silu is z / (1 + expf(-z)) in fp32. At a bf16 tap sum of -89, expf(89) overflows to inf and the kernel stores -0, on every architecture. The reference kept float64's exp and asked for -1.98e-37, which bf16 holds, so the sums gate's interval excluded -0. kernel-contract's seed draws one such sum among the stress inputs; moss-contract's seed draws only sums at or below -99, whose reference already rounds to 0. The reference now returns -0 where expf overflows. The kernels are unchanged. test-moss-contract-host runs the reference's host test; it fails on main.
ashhart
force-pushed
the
lead/moss-contract-expf
branch
from
November 24, 2026 00:48
6c0fcdc to
356a7ae
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.
tf_me_convis right; the contract's reference is wrong at one input.At a bf16 tap sum of -89, fp32
expfoverflows, so the kernel's silu stores -0. The reference kept float64'sexpand expected -1.98e-37, which bf16 can hold, so the sums check failed. The nearest bf16 value on the finite side is -88.5, so no input sits whereexpf's rounding could go either way.The failure follows the seed, not the chip. The
kernel-contractrun draws -89. Themoss-contractrun draws -104 and -101, which round to 0 on both sides.This changes only the reference and adds
test-moss-contract-host, which fails before the fix. No kernel source or image changes, so output cannot change. It has not been run on SM 11.0.Refs #4791.