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

Failures on "Add documentation, tests and better parameter names to Float32x4." #60336

Open
alexmarkov opened this issue Mar 17, 2025 · 4 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. gardening triaged Issue has been triaged by sub team

Comments

@alexmarkov
Copy link
Contributor

There are new test failures on Add documentation, tests and better parameter names to Float32x4..

The tests

lib/typed_data/float32x4_test/0 RuntimeError (expected Pass)
lib/typed_data/float32x4_test/1 RuntimeError (expected Pass)

are failing on configurations

vm-aot-android-release-arm_x64

Log:

Unhandled exception:
Expect.equals(expected: <0>, actual: <-1>) fails.
#0      Expect._fail (package:expect/expect.dart:887)
#1      Expect._failNotEqual (package:expect/expect.dart:174)
#2      Expect.equals (package:expect/expect.dart:157)
#3      testComparison (file:///b/swarming/w/ir/tests/lib/typed_data/float32x4_test.dart:160)
#4      main (file:///b/swarming/w/ir/tests/lib/typed_data/float32x4_test.dart:651)
#5      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:315)
#6      _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:194)
ExitCode: 255
Time: 0:00:00.132921

--- Re-run this test:
python3 tools/test.py -n vm-aot-android-release-arm_x64 lib/typed_data/float32x4_test/0

https://dart-ci.appspot.com/log/vm-aot-android-release-arm_x64/vm-aot-android-release-arm_x64/4823/lib/typed_data/float32x4_test/0

/cc @lrhn

@alexmarkov alexmarkov added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. gardening labels Mar 17, 2025
@alexmarkov
Copy link
Contributor Author

The following comparison between min and 0.0 fails on 32-bit ARM:

/// Minimal positive 32-bit float value.
const min = 1.401298464324817e-45;

  var p = Float32x4(0.0, nan, min, nan);
  var q = Float32x4(-0.0, nan, 0.0, 3.14);

  cmp = p.lessThanOrEqual(q);

  Expect.equals(0, cmp.z);

The difference in behavior from other platforms is likely caused by flushing denormalized numbers to zero, so min is treated as 0.0 and min <= 0.0 is true/-1. We should probably document this behavior and fix the test to avoid denormalized numbers.

(I assume we don't want to stop using SIMD/NEON instructions on 32-bit ARM due to this non-compliance to IEEE 754.)

Related discussion: #24416.

@lrhn Could you take a look?

@lrhn
Copy link
Member

lrhn commented Mar 17, 2025

Just like NaN, denormals is a gift that keeps giving.

See fx: WebAssembly/design#1429

I'll check if I can make the tests expect all the possible results, not just the "correct" ones.
(Not sure we've guaranteed any specific semantics for SIMD operations, and this is why we shouldn't.)

@a-siva
Copy link
Contributor

a-siva commented Mar 18, 2025

@lrhn I presume you are going to adjust the documentation to reflect this fact.

@a-siva a-siva added the triaged Issue has been triaged by sub team label Mar 18, 2025
@lrhn
Copy link
Member

lrhn commented Mar 18, 2025

That too 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. gardening triaged Issue has been triaged by sub team
Projects
None yet
Development

No branches or pull requests

3 participants