-
Notifications
You must be signed in to change notification settings - Fork 86
Some floating point test failures on Raspberry Pi 4 with Neon #41
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
Comments
looks like Neon treats NaN signs differently than scalar floats. LLVM currently doesn't specify which NaNs are returned, so I'd consider this an over-strict test case, rather than the code being tested being incorrect. |
As noted on the PR, |
Hum, I thought thumbv7neon was for "T32" code and armv7 +neon would be the logical choice for "A32" code, so I feel I am missing some nuance here. Nonetheless, if it is really that bad in perf and unsuitable for deployment, we should seriously consider raising a rustc issue to lint against using that target in that way. |
Yeh, I think
does actually still fail in the same way as |
There currently isn't a 32-bit ARM Linux target that would have non-Thumb instruction encoding and The reason is that Firefox for Android needed a NEON-enabled target and already used the Thumb instruction encoding. The NEON-enabled Linux targets are consistent with that to enable testing of the same kind of codegen on non-Android Linux. There wasn't a justification to spend build resources for a non-Thumb variant target without anyone showing up with a use case. |
The |
Ok, I think I misunderstood you when you suggested the fix was to use So on @programmerjake's point, are these tests too strict? Or do we want to keep assumptions like this around for now to try flush out differences? |
all FP tests should test for equality using the following function: pub fn to_canonical(v: f32, flush_subnormals_to_zero: bool) -> f32 {
match v.classify() {
FpCategory::Nan => {
// return canonical NaN because, IIRC, LLVM doesn't distuinguish between
// signaling/quiet NaNs. If not, adjust to return canonical signaling/quiet NaN.
f32::NAN
}
FpCategory::Subnormal if flush_subnormals_to_zero => 0.0 * v, // convert to signed zero
_ => v,
}
}
pub fn is_same(a: f32, b: f32, flush_subnormals_to_zero: bool) -> bool {
to_canonical(a, flush_subnormals_to_zero).to_bits()
== to_canonical(b, flush_subnormals_to_zero).to_bits()
}
|
That's certainly a choice that could be made. The code as-is was deliberately attempting to flush out such differences, as they are distinguishable differences between the SIMD and a scalar implementation. Edit: FWIW I'm more supportive of this for subnormal than for NaN. |
Probably because #39 🙂
I've been testing
stdsimd
a bit on a Raspberry Pi 4 and ran into a couple float test failures with+neon
:succeeds, but:
fails with:
I haven't investigated this much yet, but just thought I'd drop it here as a start.
The text was updated successfully, but these errors were encountered: