| Bug #99781 | PGO build improvement | ||
|---|---|---|---|
| Submitted: | 4 Jun 2020 20:02 | Modified: | 9 Feb 2021 7:09 |
| Reporter: | Dmitriy Philimonov | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Compiling | Severity: | S3 (Non-critical) |
| Version: | 8.0.20 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | Contribution, PGO | ||
[5 Jun 2020 6:35]
MySQL Verification Team
Hello Dmitriy, Thank you for the report and contribution. regards, Umesh
[2 Jul 2020 12:41]
Tor Didriksen
Posted by developer: 8.0.19 and up has: Bug #96698 Use gold as default on x86_64 only which enables the gold linker by default for x86_64 only.
[9 Feb 2021 7:09]
Paul DuBois
Posted by developer: Fixed in 8.0.24. Compiler options for using profile guided optimization with GCC were improved to include -fprofile-partial-training and -fprofile-update=prefer-atomic when appropriate. Thanks to Dmitriy Philimonov for the suggestion.

Description: During our research about applying profile guided optimizations towards MySQL Server, we indeed achieved excellent results. We noticed that: 1. GCC's -fprofile-update=atomic usually generates thread-safe code for multithreaded applications. Using this flag makes profile data more precise and reliable. Additional info could be found in the official documentation: https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html 2. GCC10+ -fprofile-partial-training improves performance even more (+5%, OLTP_RO, 1-4 threads) comparing with usual PGO. 3. We detected that using ld.gold while compiling instrumented binary for aarch64 platform leads to linker internal error, meanwhile, the second build, which uses generated profile, is successful. At least the version 1.16 (Ubuntu 20.04) is broken. It makes sense to turn it off for a while. How to repeat: * Append recommended flags to the build scripts, try the latest stable GCC (10.1 to the date). * Usage of both FPROFILE_GENERATE=1 && USE_LD_GOLD on aarch64 leads to compiling error. Suggested fix: 1. Append -fprofile-update=atomic for GNU compiler 2. Append -fprofile-partial-training for GNU compiler, if its version is greater than '10' 3. Turn off USE_LD_GOLD if FPROFILE_GENERATE is turned on and system processor is aarch64