[UnitTest] Add test for fmax reductions without fast-math.#266
[UnitTest] Add test for fmax reductions without fast-math.#266
Conversation
Add unit tests for vectorizing FMax reductions without fast-math flags, covering a wide range of inputs, including various combinations of NaNs and signed-zeros.
| check(ScalarFn, VectorFn, &Src1[0], N, "full-with-multiple-nan"); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
It would be good to test signaling nans, but it will be busted all over the place
Test some denormals?
There was a problem hiding this comment.
I added some tests with denormals both as start value and in the inputs, thanks
At least for AArch64, the tests also pass when replacing all quiet nans with signaling nans with llvm/llvm-project#148239, as it just checks if it matches the behavior of the scalar loop.
But in general it may be a bit risky to check signaling NaNs, as the behavior may not be 100% consistent across platforms?
There was a problem hiding this comment.
It should be, but the state is in flux and has never been consistent
| if (std::isnan(A)) | ||
| return std::isnan(B); | ||
|
|
||
| if (A == 0.0f) |
There was a problem hiding this comment.
I think if isnan(B) and A == 0.0f this becomes dependent on the nan signbit
There was a problem hiding this comment.
I updated the check above to check if either is nan, in that case both must be nan to be equal. I also check here if B is zero. I think that should take care of that.
Add unit tests for vectorizing FMax reductions without fast-math flags, covering a wide range of inputs, including various combinations of NaNs and signed-zeros.