-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Change compiler optimizations to -O3 -flto #11207
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
Conversation
Optimization update from -O2 to -O3 -flto gives up to 5% performance gain in 'redis-benchmarks-spec-client-runner' tests geomean where GCC 9.4.0 is used for build
|
thanks, where do you get the performance gain result, i can recall this one: #9601 (comment) |
Hi @enjoy-binbin , Comparison was performed for Jun'29 commit built with GCC 9.4.0, O3 flto options (through REDIS_*FLAGS) vs. the same redis bin built with GCC 9.4.0 with default options. Measurement showed: |
|
Adding @filipecosta90 to review |
|
@markovamaria @filipecosta90 Do you know which specific optimization options contribute to this improvement? Given the broad spectrum of architectures/compilers/compiler versions used, I assume |
|
@markovamaria thanks. please post more details on the benchmarks you conducted and their results. I'm a little bit paranoid about bugs resulting from eager optimizations, maybe combined with some places where redis assumes things that the compiler concludes that are invalid. something like this. p.s. i see a compilation error on centos, can you please look into it? |
Taken from : https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html I didn't analyzed these options separately, so I can't answer which is then really helped. |
Please find .xlsx with details attached. File contains raw data collected on bare metal from joint lab (biredis03), test by test comparison and summary conclusions for GCC 9.4.0 + O3 flto vs. GCC 9.4.0 with details. Data includes 2 variations (w/ and w/o dependencies - *FLAGS or REDIS_*FLAGS).
Sure, I'll check |
Warning appeared with O3, on CentOS during inlininig procedure
5a69986 to
98cd4da
Compare
|
@markovamaria please check PR markovamaria#1 to your branch. It should fix the failing CI and we can then retake this effort forward. |
Hi @filipecosta90, thanks for your suggestion. I've considered such change, but decided that it can hide potential issue because of function "lpGetEdgeStreamID" includes scenario with 'returns 0' and then last_id is not defined. In positive cases function returns 1 and last_id is defined. |
|
WRT:
pinging @guybe7 if he believes that we should cover that scenario or if the lp will never be null and we can just move along with the test fix. It's also worth noting that on |
|
@filipecosta90 re the cleanup: yes, i'm aware there's some dead code there, it's there for symmetry (we can comment it out but i don't think it disturbs anyone) |
@markovamaria given the above I suggest we move forward with PR markovamaria#1 . agree? |
1caca3d to
98cd4da
Compare
done |
So if I understand correctly, when building deps with the more aggressive optimizations, we had slightly better results, but also some regressions, we it was eventually decided to apply these just on redis' src dir? |
something like this. Result are similar. There is choice. |
|
@yossigo i guess now is a good time to merge this? anything you wanna check before we proceed? |
|
look like there is a build issue in test-sanitizer-address (clang): https://github.com/redis/redis/actions/runs/3170623367/jobs/5163322525 in my local env, by doing this, can make it work (but I'm not familiar with this part, so just raise it, it also passed in the GH daily) ifdef SANITIZER
ifeq ($(SANITIZER),address)
MALLOC=libc
CFLAGS+=-fsanitize=address -fno-sanitize-recover=all -fno-omit-frame-pointer
- LDFLAGS+=-fsanitize=address
+ LDFLAGS+=-fsanitize=address -flto -fuse-ld=gold
else
ifeq ($(SANITIZER),undefined)
MALLOC=libc
CFLAGS+=-fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer
- LDFLAGS+=-fsanitize=address
+ LDFLAGS+=-fsanitize=address -flto -fuse-ld=gold
else
ifeq ($(SANITIZER),thread)
CFLAGS+=-fsanitize=thread -fno-sanitize-recover=all -fno-omit-frame-pointer
- LDFLAGS+=-fsanitize=address
+ LDFLAGS+=-fsanitize=address -flto -fuse-ld=gold
else
$(error "unknown sanitizer=${SANITIZER}")
endif
endif
endif
endif |
Optimization update from -O2 to -O3 -flto gives up to 5% performance gain in 'redis-benchmarks-spec-client-runner' tests geomean where GCC 9.4.0 is used for build * Fix for false-positive warning in bitops.c Warning appeared with O3, on CentOS during inlininig procedure * Fixed unitialized streamID within streamTrim() (#1) Co-authored-by: filipe oliveira <filipecosta.90@gmail.com>
Optimization update from -O2 to -O3 -flto gives up to 5% performance gain in 'redis-benchmarks-spec-client-runner' tests geomean where GCC 9.4.0 is used for build * Fix for false-positive warning in bitops.c Warning appeared with O3, on CentOS during inlininig procedure * Fixed unitialized streamID within streamTrim() (#1) Co-authored-by: filipe oliveira <filipecosta.90@gmail.com>
Optimization update from -O2 to -O3 -flto gives up to 5% performance gain in 'redis-benchmarks-spec-client-runner' tests geomean where GCC 9.4.0 is used for build