As discussed in this issue, we have found the platform running on Apple Silicon did not seem to support the negative nan. That causes the test failure when we check the output of the nan signedness by running the test with the CPU runner.
The function used in the CRunnerUtil always print nan
in Apple Silicon platform.
extern "C" void printF32(float f) { fprintf(stdout, "%g", f); }
We have fixed the issue happening in the complex dialect not to check the signess of the nan value to make it platform agnostic.
We have found the same situation happened in the test of sparse dialect.
//
// Verify the results.
//
// CHECK: ---- Sparse Tensor ----
// CHECK-NEXT: nse = 12
// CHECK-NEXT: dim = ( 32 )
// CHECK-NEXT: lvl = ( 32 )
// CHECK-NEXT: pos[0] : ( 0, 12
// CHECK-NEXT: crd[0] : ( 0, 3, 5, 11, 13, 17, 18, 20, 21, 28, 29, 31
// CHECK-NEXT: values : ( -1, 1, -1, 1, 1, -1, nan, -nan, 1, -1, -0, 0
// CHECK-NEXT: ----
//
The test result in Apple Silicon is as follows. We do not get -nan
.
---- Sparse Tensor ----
nse = 12
dim = ( 32 )
lvl = ( 32 )
pos[0] : ( 0, 12, )
crd[0] : ( 0, 3, 5, 11, 13, 17, 18, 20, 21, 28, 29, 31, )
values : ( -1, 1, -1, 1, 1, -1, nan, nan, 1, -1, -0, 0, )
----
The test explicitly specifies the bit pattern for negative nan, which makes the test platform dependent.
What is the desired approach to fix this test in Apple Silicon? The options I have come up with are:
- Excluding
aarch64
architecture with specifyingXFAIL
directive. (But this approach may be too broad considering the other aarch64 architecture seems to support negative nan.) - Exclude the spec from running on Apple Silicon (possible?)
- Move the test under the platform specific folder if it assumes some platform dependency. (e.g.
mlir/test/Integration/Dialect /SparseTensor/CPU/X86
)
Do you have any thoughts on this?