Skip to content

testdata: compare NaN results with the same machine's scalar build - #8

Open
thesyncim wants to merge 1 commit into
mauri870:masterfrom
thesyncim:nan-goldens-per-arch
Open

thesyncim wants to merge 1 commit into
mauri870:masterfrom
thesyncim:nan-goldens-per-arch

Conversation

@thesyncim

@thesyncim thesyncim commented Nov 1, 2026 •

Copy link
Copy Markdown

abs_sqrt.txt, activation_temp.txt and invariant_call.txt compare both builds against testmain/output, which was recorded on amd64. A NaN produced by an operation (sqrt of a negative number, 0 × Inf) has the sign bit set on amd64 (0xffc00000) and clear on arm64 (0x7fc00000). So on arm64 even the scalar run differs from the recording, and the scripts fail before they get to the simd build.

What these scripts check is that the rewrite gives the same bits as the scalar loop on the machine running it. Now the recording is only compared on amd64, and on every target the simd output is compared against the scalar output saved on the same machine. -update only rewrites sections that already exist, so scalar.out never becomes a golden.

Found while running the suite on an M4 for goav1.

abs_sqrt.txt, activation_temp.txt and invariant_call.txt compare both
builds with testmain/output, which was recorded on amd64. A NaN that an
operation creates (the square root of a negative number, 0 times
infinity) has the sign bit set on amd64 and clear on arm64, so on arm64
the scalar program itself does not match the recording and the scripts
fail before the simd build runs.

The recording is now compared only on amd64. On every target the simd
build is compared with the scalar build of the same machine, which is
the property these scripts check: the rewrite produces the same bits
the scalar loop does there.
@thesyncim
thesyncim force-pushed the nan-goldens-per-arch branch from 93bfd01 to 0833715 Compare November 1, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant