Re: [PATCH] pgo: add clang's Profile Guided Optimization infrastructure
From: Sedat Dilek <hidden>
Date: 2021-01-22 01:44:22
Also in:
linux-kbuild, lkml
On Fri, Jan 22, 2021 at 2:34 AM Nick Desaulniers [off-list ref] wrote:
On Wed, Jan 20, 2021 at 6:21 PM Sedat Dilek [off-list ref] wrote:quoted
Hi, When I looked through the code I wondered why we do not add a "CONFIG_PGO_CLANG_PROFDATA" which can be helpful when doing the PGO rebuild with a vmlinux.profdata. This introduces a "PGO_PROFDATA" to turn on/off to pass "-fprofile-use=vmlinux.profdata" (see CFLAGS_PGO_CLANG_PROFDATA in top-level Makefile). If we turn off via "PGO_PROFILE := n" in several Makefiles - we should do the same and add "PGO_PROFDATA := n" to the same Makefiles? Please see the attached diff.This is a good idea; something that I brought up in initial code review (on github). Would it be ok with you to land the core first, then follow up with this suggestion? Also, AutoFDO production builds are so incredibly similar to PGO builds that I could see a possible path forward: 1. land PGO upstream 2. adds docs for AutoFDO 3. consider a config for hardcoding the location of the profiling data so that we don't need to specify it at the command line invocation of make.
I made a v3 - with some small nits. The idea was to do the "PGO-rebuild" handling a bit easier. But as you say that can wait. Some personal notes: I will be very happy when people verify/confirm what's going on with PGO-rebuild + LLVM_IAS=1. As said GNU/AS and PGO-rebuild is fine. ( This seems to be independent of clang-12 or clang-11. ) ( This seems to be independent of DWARF v4 or v5 enabled. ) The benefit here I saw was a reduction in build-time of 00:30 seen from a total 04:30 when using a PGO-rebuilt Linux-kernel. Approx. 10%? This is not much compared to a ThinLTO + PGO optimized LLVM toolchain whcih saved here 40% of build-time. - Sedat -