Announcement
Collapse
No announcement yet.
LLVM Clang 16 vs. GCC 13 Compiler Performance On Intel Raptor Lake
Collapse
X
-
When are we getting this... ???
11.4 vs 12.2 vs 12.3 vs 13.1 vs llvm-15 vs llvm-16
with:- O2
- O3
- O2 -flto
- O3 -flto
- O3 -flto=thin (llvm)
- march=native O2
- march=native O3
- march=native O2 -flto
- march=native O3 -flto
- march=native O3 -flto=thin (llvm)
Leave a comment:
-
Looks like OpenMandriva's idea of switching the entire OS to building with clang will finally pay off in terms of performance.
- Likes 2
Leave a comment:
-
Originally posted by discordian View PostTBH this whole ELF interposition should've never been the default but an explicit opt-in. Its not used anywhere outside of hooking stuff into libc
Leave a comment:
-
-
Originally posted by hubicka View Post
Both GCC and Clang require -fvisibility=hidden to not export the symbol. Making -fvisibility=hidden a default would break a lot of existing packages that does not mark exported symbols.
Originally posted by hubicka View PostIf you compile the testcase with -fvisibility=hidden, GCC will optimize return to 1. GCC has quite careful logic about what can be interposed:- Interposition is possible only with -fpic or weak symbols
- And that comes with a cost: inefficent code and relocations.
Originally posted by hubicka View Post- Inline functions or comdats can not be be semantically interposed (but can be interposed to different, equivalent definition possibly optimized with different optimization flags or compiled by other compiler)
- With -flto, one can use resolution file to hide symbols at link-time (as you suggest) and GCC will be informed about this (it will see that the symbol is not LDPR_PREVAILING_DEF_IRONLY and optimize accordingly)
Originally posted by hubicka View Post- If you compile with -fpic but link resulting object into non-shared binary, GCC will know this from linker plugin too and disable inteprosition.
Originally posted by hubicka View PostProblem is that Clang exports the symbol in my testcase yet does not expect the interposition to happen. This is not considered to be a good idea in GCC (as discussed few times at the mailing-list).
Leave a comment:
- Interposition is possible only with -fpic or weak symbols
-
Originally posted by discordian View Post
The example you provided contained a function that is not marked to be exported, so ELF interposition is not an argument. Which functions are eligible to be exported is not standardized, the sane thing to do would add a macro notifying that. gcc leaves valid optimizations on the table, unless your example is missing some crucial details.
(in an ideal world, the information how the symbol is to be used comes from the linker and not marks in the source-code, requiring at least some mild form of LTO or turning the build-process upside-down)
If you compile the testcase with -fvisibility=hidden, GCC will optimize return to 1. GCC has quite careful logic about what can be interposed:- Interposition is possible only with -fpic or weak symbols
- Inline functions or comdats can not be be semantically interposed (but can be interposed to different, equivalent definition possibly optimized with different optimization flags or compiled by other compiler)
- With -flto, one can use resolution file to hide symbols at link-time (as you suggest) and GCC will be informed about this (it will see that the symbol is not LDPR_PREVAILING_DEF_IRONLY and optimize accordingly)
- If you compile with -fpic but link resulting object into non-shared binary, GCC will know this from linker plugin too and disable inteprosition.
Problem is that Clang exports the symbol in my testcase yet does not expect the interposition to happen. This is not considered to be a good idea in GCC (as discussed few times at the mailing-list).
- Likes 2
Leave a comment:
-
Originally posted by hubicka View Post
-fno-semantic-interposition is not an optimization. It is flag telling compiler to ignore ELF interposition rules. Doing so enables other optimizations (such as inlining, constant propagation etc.). GCC at -O3 optimization levels should be standard conforming (with few well justified exceptions), so enabling semantic interposition would need agreement outside of GCC community on updating ELF standard.
(in an ideal world, the information how the symbol is to be used comes from the linker and not marks in the source-code, requiring at least some mild form of LTO or turning the build-process upside-down)Last edited by discordian; 12 May 2023, 07:49 AM.
- Likes 1
Leave a comment:
Leave a comment: