Handle FMA on RISC-V - #22962
Conversation
|
We have build on RISC-V koji: https://riscv-koji.fedoraproject.org/koji/taskinfo?taskID=256015 The list of skipped tests: |
MathCore, Matrix tests fail on RISC-V:
266 - gtest-math-mathcore-stressMathCoreUnit (Failed)
Discrepancy in PtEtaPhiMVector operations() :
62919.12458590859 != 62919.124585843325 discr = 5 (Allowed discrepancy is 1.7763568394002505e-13)
300 - gtest-math-matrix-testMatrixTSparse (Failed)
Expected equality of these values:
m1
Which is: 80-byte object <90-0A 9E-93 FF-FF 00-00 00-00 00-00 00-00 00-02 04-00 00-00 05-00 00-00 01-00 00-00 00-00 00-00 14-00 00-00 05-00 00-00 00-00 00-00 00-00 B0-3C 01-E2 1E-94 FF-FF 00-00 30-26 61-55 55-55 00-00 00-62 60-55 55-55 00-00 A0-2B 61-55 55-55 00-00>
m2
Which is: 264-byte object <48-76 56-55 55-55 00-00 00-00 00-00 00-00 00-02 04-00 00-00 05-00 00-00 01-00 00-00 00-00 00-00 14-00 00-00 00-00 00-00 00-00 00-00 00-00 B0-3C 01-00 00-00 03-00 00-00 18-2D 44-54 FB-21 09-40 ... 53-B7 49-9E A1-B8 34-40 40-42 AC-EF 82-70 37-40 E0-09 61-55 55-55 00-00 60-E2 1E-94 FF-FF 00-00 50-2A 61-55 55-55 00-00 20-0A 61-55 55-55 00-00 30-E3 1E-94 FF-FF 00-00 60-E1 1E-94 FF-FF 00-00>
422 - test-stressmathcore (Failed) longtest
Based on my experience with similar failures on AArch64 (years ago) I
suspected FMA handling. Looked through code and found some places where
disabling/handling FMA was needed.
| # Force remove FMA on RISC-V | ||
| if(CMAKE_SYSTEM_PROCESSOR MATCHES "riscv64|riscv") | ||
| if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") | ||
| target_compile_options(MathCore PRIVATE -ffp-contract=off) |
There was a problem hiding this comment.
I don't think it's the right approach to forbid FMA - it will be slower, no? Failing tests are a sign of too tight tolerances...
There was a problem hiding this comment.
For now we want this package to build. Previous builds just added failed tests to exclude list.
I decided to try different approach. Without FMA we at least have something which builds and works as expected (so it passes tests).
I am open to other solutions.
There was a problem hiding this comment.
I maintain that the tests should be fixed. Disabling FMA is a workaround, and if we put it in now nobody will be working to remove it.
There was a problem hiding this comment.
Can "root" get some central way to tell "this architecture has FMA precision" instead of forcing any new architecture to reinvent the wheel?
The whole build takes 14 hours on current RISC-V hardware (SpacemiT K3 - the fastest available CPU). The way how it builds (single thread for most of time) does not help.
There was a problem hiding this comment.
I will resume my work on root around 20th August.
Test Results 4 files 4 suites 12h 45m 58s ⏱️ Results for commit ede5ce9. |
MathCore, Matrix tests fail on RISC-V:
266 - gtest-math-mathcore-stressMathCoreUnit (Failed)
Discrepancy in PtEtaPhiMVector operations() :
62919.12458590859 != 62919.124585843325 discr = 5 (Allowed discrepancy is 1.7763568394002505e-13)
300 - gtest-math-matrix-testMatrixTSparse (Failed)
Expected equality of these values:
m1
Which is: 80-byte object <90-0A 9E-93 FF-FF 00-00 00-00 00-00 00-00 00-02 04-00 00-00 05-00 00-00 01-00 00-00 00-00 00-00 14-00 00-00 05-00 00-00 00-00 00-00 00-00 B0-3C 01-E2 1E-94 FF-FF 00-00 30-26 61-55 55-55 00-00 00-62 60-55 55-55 00-00 A0-2B 61-55 55-55 00-00>
m2
Which is: 264-byte object <48-76 56-55 55-55 00-00 00-00 00-00 00-00 00-02 04-00 00-00 05-00 00-00 01-00 00-00 00-00 00-00 14-00 00-00 00-00 00-00 00-00 00-00 00-00 B0-3C 01-00 00-00 03-00 00-00 18-2D 44-54 FB-21 09-40 ... 53-B7 49-9E A1-B8 34-40 40-42 AC-EF 82-70 37-40 E0-09 61-55 55-55 00-00 60-E2 1E-94 FF-FF 00-00 50-2A 61-55 55-55 00-00 20-0A 61-55 55-55 00-00 30-E3 1E-94 FF-FF 00-00 60-E1 1E-94 FF-FF 00-00>
422 - test-stressmathcore (Failed) longtest
Based on my experience with similar failures on AArch64 (years ago) I suspected FMA handling. Looked through code and found some places where disabling/handling FMA was needed.
This Pull request:
Changes or fixes:
It is an attempt to get 'root' build properly on RISC-V. Or at least to get some of tests to pass (we still have a list of tests to skip).
Checklist: