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

Over-optimization with clang when building XDSP/Test #10

Open
shinjich opened this issue Jul 3, 2021 · 3 comments
Open

Over-optimization with clang when building XDSP/Test #10

shinjich opened this issue Jul 3, 2021 · 3 comments
Labels

Comments

@shinjich
Copy link

shinjich commented Jul 3, 2021

The clang with /Ox + /fp:fast seems to be over-optimize (incorrect pre-calculation) in the XDSP test with updated xDSP.h. This issue will be gone by changing to /fp:precise. The VC generate a function call and there is no issue with /fp:fast. It would be better to modify to complex code not affected by compiler optimization.

test_cpp_with_clang_fpfast_disasm.txt
clang /fp:fast, All complex numbers were 1.0,-0.0.

test_cpp_with_clang_fpprecise_disasm.txt
clang /fp:precise, Less accurate than VC but within updated epsilon range.

test_cpp_with_vc_fpfast_disasm.txt
VC /fp:fast, Looks good. :)

@walbourn
Copy link
Owner

walbourn commented Jul 3, 2021

We generally test with /fp:fast as that's the recommendation for games. I'll check into the clang/LLVM issue here...

@walbourn walbourn added the bug label Jul 3, 2021
@shinjich
Copy link
Author

shinjich commented Jul 9, 2021

This issue may be due to the optimization for the XMVectorRound (SSE version) used in XMVectorSinCos etc.
Because I replaced XMVectorRound with pseudocode and got a good result. Also, when built with AVX, XMVectorRound is replaced to _mm_round_ps and returns a good result. However, if we specify _MM_FROUND_TO_POS_INF for rounding mode in _mm_round_ps, there will be errors that exceed the epsilon for checking.

@shinjich
Copy link
Author

It seems to be the same issue as following. I also added a link to a reproduction code. Thanks,
microsoft/DirectXMath#127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants