65 lines
2.5 KiB
Diff
65 lines
2.5 KiB
Diff
From b8384ef181084c630d0073dcb81dfd338da40c42 Mon Sep 17 00:00:00 2001
|
|
From: Maksim Sisov <msisov@igalia.com>
|
|
Date: Wed, 15 Sep 2021 14:29:03 +0300
|
|
Subject: [PATCH] limit number of LTO jobs.
|
|
|
|
--thinlto-jobs accepts "all" only since llvm 13. Dunfell
|
|
branch uses quite old llvm that doesn't support this keyword.
|
|
Thus, use the previously used number of threads.
|
|
|
|
Upstream-Status: Inappropriate
|
|
|
|
Signed-off-by: Maksim Sisov <msisov@igalia.com>
|
|
|
|
---
|
|
build/config/compiler/BUILD.gn | 12 ++++++------
|
|
build/config/compiler/compiler.gni | 5 +++++
|
|
2 files changed, 11 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
|
|
index ef3285ae74e1b..a704f0f485e4e 100644
|
|
--- a/build/config/compiler/BUILD.gn
|
|
+++ b/build/config/compiler/BUILD.gn
|
|
@@ -683,7 +683,7 @@ config("compiler") {
|
|
|
|
if (is_win) {
|
|
ldflags += [
|
|
- "/opt:lldltojobs=all",
|
|
+ "/opt:lldltojobs=" + max_jobs_per_link,
|
|
"-mllvm:-import-instr-limit=$import_instr_limit",
|
|
"/lldltocache:" +
|
|
rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
|
|
@@ -696,11 +696,11 @@ config("compiler") {
|
|
# usage in crbug.com/1038040. Note this will increase build time in
|
|
# Chrome OS.
|
|
|
|
- # In ThinLTO builds, we run at most one link process at a time,
|
|
- # and let it use all cores.
|
|
- # TODO(thakis): Check if '=0' (that is, number of cores, instead
|
|
- # of "all" which means number of hardware threads) is faster.
|
|
- ldflags += [ "-Wl,--thinlto-jobs=all" ]
|
|
+ # Limit the parallelism to avoid too aggressive competition between
|
|
+ # linker jobs. This is still suboptimal to a potential dynamic
|
|
+ # resource allocation scheme, but should be good enough.
|
|
+ ldflags += [ "-Wl,--thinlto-jobs=" + max_jobs_per_link ]
|
|
+
|
|
if (is_apple) {
|
|
_object_path_suffix = ""
|
|
if (is_ios) {
|
|
diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni
|
|
index 4738ee80d307c..7a43b1113a495 100644
|
|
--- a/build/config/compiler/compiler.gni
|
|
+++ b/build/config/compiler/compiler.gni
|
|
@@ -99,6 +99,11 @@ declare_args() {
|
|
# If true, use Goma for ThinLTO code generation where applicable.
|
|
use_goma_thin_lto = false
|
|
|
|
+ # Limit the number of jobs (threads/processes) the linker is allowed
|
|
+ # to use (for linkers that support this).
|
|
+ # Upstream chromium uses "all" keyword that is available since llvm 13.
|
|
+ max_jobs_per_link = 8
|
|
+
|
|
# Whether we're using a sample profile collected on an architecture different
|
|
# than the one we're compiling for.
|
|
#
|