• Nico Weber's avatar
    build: In LTO links, run just one link at once, but give it all cores · 174d9faa
    Nico Weber authored
    Normally, we allow running several links in parallel if there's enough
    memory, since links tend to be memory- and io-bound, not compute bound.
    However, in LTO builds the linker does codegen for every linked
    translation unit, which needs a lot of CPU.
    
    Previously, we used to hardcode 8 threads per link for thinlto builds,
    which makes builds needlessly slow on machines with many cores.
    
    Instead, automatically use all cores for a thinlto link, but only run
    one link in parallel at once.
    
    chromeos-chrome-9999.ebuild in the Chrome OS build and link_jobs_32 in
    mb_config.pyl currently manually set the number of threads per lto link
    to the number of cores. Once this change here is in, we should stop
    explicitly setting the arg there and then we can turn this from a gn arg
    to a regular variable that's not settable in args.gn
    
    Bug: 1132930
    Change-Id: If2fda3e38b2b1827beb2da844f024f52211210db
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2464782Reviewed-by: default avatarHans Wennborg <hans@chromium.org>
    Commit-Queue: Nico Weber <thakis@chromium.org>
    Auto-Submit: Nico Weber <thakis@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#816129}
    174d9faa
BUILD.gn 86.8 KB