Fix cross-platform determinism on ARM64 NEON#1042
Fix cross-platform determinism on ARM64 NEON#1042halx99 wants to merge 1 commit intoerincatto:mainfrom
Conversation
|
I will only support a platform that runs with GitHub actions and passes unit tests. Just building it is not enough. |
|
Finally, I fixed the |
|
Finally+1, don't use NEON fma instructions solve the DeterminismTest issue |
4f47271 to
45682ec
Compare
Why Linux ARM64 works with FMA instruction?A: On linux arm64, the compiler translate Verified by disassembling the same C source.C source with NEON FMA instruction:b2FloatW b2MulAddW( b2FloatW a, b2FloatW b, b2FloatW c )
{
return vmlaq_f32( a, b, c );
}Windows ARM64: ; Exported entry 249. b2MulAddW
EXPORT b2MulAddW
b2MulAddW
FMLA V0.4S, V1.4S, V2.4S
RET
; End of function b2MulAddW
Linux ARM64: EXPORT b2MulAddW
b2MulAddW
FMUL V1.4S, V1.4S, V2.4S
FADD V0.4S, V0.4S, V1.4S
RET
; End of function b2MulAddWAndroid ARM64 EXPORT b2MulAddW
b2MulAddW
FMUL V1.4S, V1.4S, V2.4S
FADD V0.4S, V1.4S, V0.4S
RET
; End of function b2MulAddWmacOS ARM64 _b2MulAddW
FMUL V1.4S, V1.4S, V2.4S
FADD V0.4S, V1.4S, V0.4S
RET
; End of function _b2MulAddWiOS ARM64 _b2MulAddW
FMUL V1.4S, V1.4S, V2.4S
FADD V0.4S, V1.4S, V0.4S
RET
; End of function _b2MulAddWTested Android ARM64, when remove EXPORT b2MulAddW
b2MulAddW
FMLA V0.4S, V2.4S, V1.4S
RET
; End of function b2MulAddW |
|
Finally: Root Cause of CrossPlatformTest Failure
Conclusion: |
|
I have no further changes on this PR, it’s ready for review. |
- Update box2d to 3.2-04b0e92 with PR erincatto/box2d#1042 - Remove Rigidbody2D::setTag - Make CollisionFilter works with box2d - Make change rigidbody2d betweens node works - Add API: Rigidbody2D::setMass and Rigidbody2D::setAutoMass - Make rigidbody transform stable when change between nodes - Rigidbody2D: setRotationOffset when attach to world not necessary. - Rename API: Rigidbody2D::setRotationEnable -> Rigidbody2D::setRotationEnabled - Fix gravity units - Disable commonBox rotation for Test: 'PhysicsSetGravityEnableTest' - Fix TargetJoint2D not work when world gravity is 0, tests: Pump, Position/Rotation Test - Fix Contact Test yellow leaving the screen - Remove API: Collider2D::setContactMaskBits/getContactMaskBits - Add API PhysicsWorld2D::rayCastClosest - SImplify Physics 2d query callback - Rename PhysicsRayCastInfo -> RayCastHit2D - Rename RayCastHit2D::contact -> RayCastHit2D::point - Remove start and end members of RayCastHit2D - Re-struct 2d/3d physics folder - Implement all box2d supported contact events - Update luabindings and lua-tests
|
It is very cool you got this working. Thanks for looking into the determinism problem. I'll change the Neon code regardless of other factors. You added 3 CI jobs for a platform I'm not sure anyone uses with Box2D. Can you justify this? What is the real world use case for Box2D supporting this platform? For this platform I would only want to support one CI job and it would be for unit tests, not samples. Samples take longer to build and are lower priority than unit tests. |
- Add windows arm64 ci - Fix samples build fail on windows arm64 - Fixed DeterminismTest.CrossPlatformTest by disabling NEON FMA on native MSVC. This avoids codegen rounding differences between MSVC and other toolchains
done
For example: Microsoft Surface Pro |
|
Implemented in #1045. Unit tests are passing. |
CHANGES
Relative issues