Skip to content

testdata: compare activation_functions.txt with the same machine's scalar build - #17

Merged
mauri870 merged 1 commit into
masterfrom
activation-nan
Nov 3, 2026
Merged

mauri870 merged 1 commit into
masterfrom
activation-nan

Conversation

@mauri870

@mauri870 mauri870 commented Nov 3, 2026

Copy link
Copy Markdown
Owner

activation_functions.txt hashes float bits and compares both builds with testmain/output, which was recorded on amd64. It passes on arm64 only because none of its loops creates a NaN: they just pass the input NaN through. With an alpha of 0, LeakyReLU computes 0 * -Inf. The resulting NaN has the sign bit set on amd64 and clear on arm64, so the script fails on arm64 against the recording. This change gives it #8's treatment: the recording is compared only on amd64, and on every target the simd build is compared with the scalar build of the same machine.

It also changes the three scripts from #8:

  • They compared the simd build with the recording on amd64 as well. That adds nothing: on amd64 the scalar build matches the recording and the simd build matches the scalar build.
  • That comparison came last, so it was the one -update recorded. A simd build that differed from the scalar one would have been written into the recording. Now only the scalar build is compared with the recording, and that's what -update records.
  • Two of their comments named the square root of a negative number, though those scripts have no square root.

Tested locally:

  • I made temporary copies of the old and new activation_functions.txt with alpha set to 0, recorded the expected output on amd64, and ran both on arm64 under qemu. The old script fails at cmp stdout testmain/output, and the new one passes.
  • The four scripts pass on amd64 and on arm64 under qemu, and -update leaves them unchanged.

…alar build

activation_functions.txt hashes float bits and compares both builds
with testmain/output, which was recorded on amd64. It passes on arm64
only because its loops pass the input NaN through and never create
one: with an alpha of 0, LeakyReLU computes 0 times -Inf, whose NaN has
the sign bit set on amd64 and clear on arm64, and the script then fails
on arm64 against the recording. It now compares the recording only on
amd64 and the simd build with the scalar build of the same machine, as
#8 did for three other scripts.

Those three scripts also compared the simd build with the recording on
amd64. That adds nothing, since the scalar build matches the recording
there and the simd build matches the scalar build, and as the last
comparison it is the one -update recorded, so a simd build that differed
from the scalar one would have been written into the recording. Only the
scalar build is compared with the recording now. Their comments also
named the square root of a negative number in two scripts that have no
square root.
@mauri870
mauri870 enabled auto-merge (squash) November 3, 2026 22:37
@mauri870
mauri870 merged commit 895f862 into master Nov 3, 2026
2 checks passed
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