-
Notifications
You must be signed in to change notification settings - Fork 7
cmake: use -flto=auto compiler flag when supported, rework fast-math disablement #80
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
base: master
Are you sure you want to change the base?
Conversation
Use -flto=auto compiler flag when supported, this silence this GCC warning: > lto-wrapper: warning: using serial compilation of # LTRANS jobs This also greatly speeds-up the linkage time as it enables LTO multithreading in GCC (either by using Make jobserver if detected, either by detecting CPU cores). Also always set LTO if enabled.
Some compilers may enable fast-math by default (example: ICC). Some contractions are still safe and can be enabled.
166155c
to
867022a
Compare
867022a
to
160640b
Compare
867022a
to
629da09
Compare
2abc19b
to
27c13ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any numbers on performance impact of the strict math flags? Reproducible floating-point operations are of somewhat niche interest and have limited chance to be reliably achieved between differing compilers and architectures, so I think that would be a bad default if it costs more than a few percent of speed.
@@ -88,12 +98,8 @@ if (MSVC) | |||
endif() | |||
|
|||
if (USE_LTO) | |||
set_cxx_flag("/GL" RELEASE) | |||
set_cxx_flag("/GL" RELWITHDEBINFO) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point of these is to have different flags per configuration in a multi-configuration build, so that you can test a Release build with LTO and a Debug build without it from the same IDE instance.
It's OK to remove this for the GCC-style options since it gets in the way of flag tests, but there is no need to remove it for MSVC.
cmake: use -flto=auto compiler flag when supported
Use -flto=auto compiler flag when supported, this silence this
GCC warning:
This also greatly speeds-up the linkage time as it enables LTO
multithreading in GCC (either by using Make jobserver if detected,
either by detecting CPU cores).
Also always set LTO if enabled.
Similar to:
cmake: rework the fast-math enablement and force the disablement
Some compilers may enable fast-math by default (example: ICC).
Some contractions are still safe and can be enabled.
cmake: fix typo