You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This test fails //xla/tests:complex_unary_op_test_cpu on my Mac mini.
I hacked the test up a bit to simplify things.
[ RUN ] ComplexUnaryOpTest.Log1pTest
2024-11-24 17:54:52.487071: I xla/tests/literal_test_util.cc:56] expected: c64[2] c64[2] {(inf, -2.3561945), (-0.5, -0.5)}
2024-11-24 17:54:52.487089: I xla/tests/literal_test_util.cc:58] actual: c64[2] c64[2] {(inf, -2.3561945), (-0.5, -0)}
This is using the following input:
{ { -min, -min }, { -min, -min }, 0x1p+125f }
After a bit of further investigation, I was able to determine that the root cause is that the implementation of atan2f depends on subnormal support even if the inputs and outputs are not subnormal.
#include<cmath>
#include<cfloat>
#include<cstdio>
#include<fenv.h>staticvoiddoit() {
volatileconstfloat a = -FLT_MIN;
volatileconstfloat b = 1.0f;
volatilefloat c = atan2f(a, b);
c *= 0x1p+125f;
printf("%.19g\n", c);
}
intmain (int argc, char *argv[]) {
doit();
fesetenv(FE_DFL_DISABLE_DENORMS_ENV);
doit();
return0;
}
On Darwin Kernel Version 24.1.0: Thu Nov 14 18:15:21 PST 2024; root:xnu-11215.41.3~13/RELEASE_ARM64_T6041, this outputs:
-0.5
-0
The text was updated successfully, but these errors were encountered:
This is just under -1.17549435082228750797e-38 so this will end up getting flushed to 0 when it gets converted from double precision to single precision if subnormals are disabled.
Sure, this issue sounds very similar to the data point in jax-ml/jax#24787 (comment) , that is, on a Mac platform operations on smallest normal value lead to flushing to zero while on other platforms this does not happen. A simple fix is to adjust the test samples as in jax-ml/jax#25117 (use nextafter(min, 1) instead of min), otherwise, eliminating these corner case differences between Mac and Linux platforms may be a complicated task.
This test fails //xla/tests:complex_unary_op_test_cpu on my Mac mini.
I hacked the test up a bit to simplify things.
This is using the following input:
{ { -min, -min }, { -min, -min }, 0x1p+125f }
After a bit of further investigation, I was able to determine that the root cause is that the implementation of
atan2f
depends on subnormal support even if the inputs and outputs are not subnormal.On
Darwin Kernel Version 24.1.0: Thu Nov 14 18:15:21 PST 2024; root:xnu-11215.41.3~13/RELEASE_ARM64_T6041
, this outputs:The text was updated successfully, but these errors were encountered: