-
Notifications
You must be signed in to change notification settings - Fork 104
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
Fix LTO warning by enabling parallel compilation #523
Conversation
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.
Nit: Missing a period in the commit message. Otherwise, LGTM. Thanks!
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 warning remains when using older version of gcc
. @eleanorLYJ Can you check? (maybe provide some fallback mechanism for older gcc
)
Note: I tried gcc-12 or above and the warning are gone.
Compiler:
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Build log of make check
:
CC build/map.o
CC build/utils.o
CC build/decode.o
CC build/io.o
CC build/syscall.o
CC build/emulate.o
CC build/riscv.o
CC build/elf.o
CC build/cache.o
CC build/mpool.o
CC build/main.o
LD build/rv32emu
lto-wrapper: warning: using serial compilation of 2 LTRANS jobs
[OK]
Checking SHA-1 of prebuilt binaries ... [OK]
Running hello.elf ... [OK]
Running puzzle ... [OK]
Running fcalc ... [OK]
Running pi ... [OK]
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.
Always rebase the latest master
branch when you submit pull requests.
Hmm, that's strange. |
Found this at stackoverflow. The warning was introduced from v11.4 . Thus, I believe it might be specific to version 11.4 or later but below version 12. Actually, I think we can mention this in the commit message and move on. |
e005458
to
a8ee495
Compare
Don't use markdown syntax in the body of git commit messages since not every parser recognizes the format (I meant the gcc docs link here). Instead, always use plaintext. Thanks! |
Change the following:
to
|
When using make for builds, the following warning is observed: lto-wrapper: warning: using serial compilation of 2 LTRANS jobs. To address this, -flto=auto is now used. According to GCC optimization options [1], use -flto=auto to use GNU make's job server, if available, or otherwise fall back to autodetection of the number of CPU threads present in your system. While this patch does not fully suppress the warning in certain GCC versions (11.4 or later but below 12), it improves build performance by enabling parallel LTO compilation whenever possible. [1] https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
a8ee495
to
cb7def0
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.
LGTM.
Thank @eleanorLYJ for contributing! |
When using
make
, the following warning occurs:lto-wrapper: warning: using serial compilation of 2 LTRANS jobs.
To resolve this and enable parallel compilation, -flto=auto is now used.
According to the GCC documentation:
Use
-flto=auto
to use GNU make’s job server, if available, or otherwise fall back to autodetection of the number of CPU threads present in your system.