Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Suite has errors on MacOS #499

Open
fyellin opened this issue Nov 20, 2022 · 0 comments
Open

Test Suite has errors on MacOS #499

fyellin opened this issue Nov 20, 2022 · 0 comments

Comments

@fyellin
Copy link

fyellin commented Nov 20, 2022

The Test Suite is showing errors when run on MacOS running Apple M1 Pro.

It seems that on the M1 Pro's GPU, exp2(x) is returning a slightly incorrect number x < 0 .

I have texted it on the following values:

exp2(-1) =  0.4999999403953552
exp2(-2) = 0.2499999701976776
exp2(-3) = 0.1249999850988388

This causes any shader that uses PACK_BYTES_INTO_FLOAT_CODE or PACK_FLOAT_INTO_BYTES_CODE to work incorrectly. These are used by the test suite, but are not used by Quirk itself on the Mac, since it can use the more direct float options. I looked at the shaders used by all the example circuits, and the only use of exp2 was a guaranteed non-negative exponent.

Replacing exp2(exponent) with exp2(max(exponent, 0)) / exp2(max(-exponent, 0)) does work correctly. When I replaced the two code snippets above to use this alternate version, all tests passed (except for the Painter print_line aligned, which claims it is very machine and browser specific.)

I'm not quite sure what the best way to deal with this is. Ignore it? I at least wanted there to be some documentation.

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

No branches or pull requests

1 participant