[build] Enable racing mode for Dart actions.
Put local actions in a common pool, especially - Assembler (many run for boringssl) - Linker (high memory use) - Dart (high memory use) This should limit the number of concurrent local actions to the number of harts available, avoiding the racing actions triggering out-of-memory failures. Change-Id: Ifa168012d73472a3db349acc36545dd176385bbc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510190 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Alexander Aprelev <aam@google.com>
This commit is contained in:
committed by
dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
354a997abe
commit
0b1c0dc9c5
@@ -44,6 +44,10 @@ _is_dart = _dart_root == get_path_info("//", "abspath")
|
||||
|
||||
if (_is_dart) {
|
||||
import("../toolchain/rbe.gni")
|
||||
_dart_action_pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
} else {
|
||||
_dart_action_pool =
|
||||
"$_dart_root/build/dart:dart_action_pool($default_toolchain)"
|
||||
}
|
||||
|
||||
template("_compiled_action") {
|
||||
@@ -100,8 +104,9 @@ template("_compiled_action") {
|
||||
"--exec_strategy=" + rbe_expensive_exec_strategy,
|
||||
"--",
|
||||
]
|
||||
} else if (!defined(invoker.pool)) {
|
||||
pool = "$_dart_root/build/dart:dart_action_pool($default_toolchain)"
|
||||
}
|
||||
if (!defined(invoker.pool)) {
|
||||
pool = _dart_action_pool
|
||||
}
|
||||
|
||||
args += [ rebase_path(host_executable, root_build_dir) ] + invoker.args
|
||||
@@ -156,8 +161,9 @@ template("_prebuilt_tool_action") {
|
||||
"--exec_strategy=" + rbe_expensive_exec_strategy,
|
||||
"--",
|
||||
]
|
||||
} else if (!defined(invoker.pool)) {
|
||||
pool = "$_dart_root/build/dart:dart_action_pool($default_toolchain)"
|
||||
}
|
||||
if (!defined(invoker.pool)) {
|
||||
pool = _dart_action_pool
|
||||
}
|
||||
|
||||
args += [ rebase_path(invoker.binary, root_build_dir) ] + vm_args
|
||||
@@ -419,6 +425,7 @@ template("dartaotruntime_action") {
|
||||
"deps",
|
||||
"inputs",
|
||||
"metadata",
|
||||
"mnemonic",
|
||||
"outputs",
|
||||
"pool",
|
||||
"script",
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file
|
||||
# for details. All rights reserved. Use of this source code is governed by a
|
||||
# BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
# Define the pool only in one toolchain so all the toolchains share one pool.
|
||||
# default_toolchain would make a bit more sense, but it isn't defined yet when
|
||||
# the default toolchain is being evaluated.
|
||||
if (current_toolchain == host_toolchain) {
|
||||
pool("local_action_pool") {
|
||||
depth = exec_script("../dart/num_cpus.py", [], "value")
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,7 @@ template("fuchsia_toolchain") {
|
||||
}
|
||||
|
||||
tool("asm") {
|
||||
pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
depfile = "{{output}}.d"
|
||||
command = "$asm -MD -MF $depfile $target_triple_flags $sysroot_flags $lto_flags {{defines}} {{include_dirs}} {{asmflags}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
|
||||
depsformat = "gcc"
|
||||
@@ -102,6 +103,7 @@ template("fuchsia_toolchain") {
|
||||
}
|
||||
|
||||
tool("alink") {
|
||||
pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
rspfile = "{{output}}.rsp"
|
||||
command = "rm -f {{output}} && $ar rcs {{output}} @$rspfile"
|
||||
description = "AR {{output}}"
|
||||
@@ -113,6 +115,7 @@ template("fuchsia_toolchain") {
|
||||
}
|
||||
|
||||
tool("solink") {
|
||||
pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so".
|
||||
sofile = "{{root_out_dir}}/$soname" # Possibly including toolchain dir.
|
||||
unstripped_sofile =
|
||||
@@ -160,6 +163,7 @@ template("fuchsia_toolchain") {
|
||||
}
|
||||
|
||||
tool("link") {
|
||||
pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
exename = "{{target_output_name}}{{output_extension}}"
|
||||
outfile = "{{root_out_dir}}/$exename"
|
||||
rspfile = "$outfile.rsp"
|
||||
|
||||
@@ -117,6 +117,8 @@ template("gcc_toolchain") {
|
||||
}
|
||||
|
||||
tool("asm") {
|
||||
pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
|
||||
# For GCC we can just use the C compiler to compile assembly.
|
||||
depfile = "{{output}}.d"
|
||||
command = "$asm -MMD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}"
|
||||
@@ -127,6 +129,7 @@ template("gcc_toolchain") {
|
||||
}
|
||||
|
||||
tool("alink") {
|
||||
pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
rspfile = "{{output}}.rsp"
|
||||
command = "rm -f {{output}} && $ar rcs {{output}} @$rspfile"
|
||||
description = "AR {{output}}"
|
||||
@@ -138,6 +141,7 @@ template("gcc_toolchain") {
|
||||
}
|
||||
|
||||
tool("solink") {
|
||||
pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so".
|
||||
sofile = "{{root_out_dir}}/$soname" # Possibly including toolchain dir.
|
||||
rspfile = sofile + ".rsp"
|
||||
@@ -190,6 +194,7 @@ template("gcc_toolchain") {
|
||||
}
|
||||
|
||||
tool("link") {
|
||||
pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
exename = "{{target_output_name}}{{output_extension}}"
|
||||
outfile = "{{root_out_dir}}/$exename"
|
||||
rspfile = "$outfile.rsp"
|
||||
|
||||
@@ -101,6 +101,7 @@ template("mac_toolchain") {
|
||||
|
||||
tool("asm") {
|
||||
# For GCC we can just use the C compiler to compile assembly.
|
||||
pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
depfile = "{{output}}.d"
|
||||
command = "$asm -MMD -MF $depfile {{defines}} {{include_dirs}} $sysroot_flags $toolchain_flags {{asmflags}} -c {{source}} -o {{output}}"
|
||||
depsformat = "gcc"
|
||||
@@ -128,6 +129,7 @@ template("mac_toolchain") {
|
||||
}
|
||||
|
||||
tool("alink") {
|
||||
pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
rspfile = "{{output}}.rsp"
|
||||
command = "rm -f {{output}} && $ar rcs {{output}} @$rspfile"
|
||||
description = "AR {{output}}"
|
||||
@@ -139,6 +141,7 @@ template("mac_toolchain") {
|
||||
}
|
||||
|
||||
tool("solink") {
|
||||
pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
dylib = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # eg
|
||||
# "./libfoo.dylib"
|
||||
rspfile = dylib + ".rsp"
|
||||
@@ -203,6 +206,7 @@ template("mac_toolchain") {
|
||||
}
|
||||
|
||||
tool("link") {
|
||||
pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
exename = "{{target_output_name}}{{output_extension}}"
|
||||
outfile = "{{root_out_dir}}/$exename"
|
||||
rspfile = "$outfile.rsp"
|
||||
|
||||
@@ -19,10 +19,13 @@ declare_args() {
|
||||
# Set to the docker image to use in the RBE.
|
||||
rbe_image = "docker://gcr.io/cloud-marketplace/google/debian11@sha256:69e2789c9f3d28c6a0f13b25062c240ee7772be1f5e6d41bb4680b63eae6b304"
|
||||
|
||||
# Do expensive RBE actions remotely, falling back to local on failure/timeout.
|
||||
# The "racing" strategy can cause a memory exhaustion problem if too many
|
||||
# actions run locally at the same time.
|
||||
rbe_expensive_exec_strategy = "remote_local_fallback"
|
||||
# Do expensive RBE actions locally and remotely, taking whichever completes
|
||||
# first. Local machines are generally faster than the RBE workers, so this
|
||||
# usually takes the local action unless there is a cache hit.
|
||||
# Depends on expensive actions also being limited by a GN/Ninja pool to
|
||||
# prevent memory exhaustion from too many steps running locally at the same
|
||||
# time. Migration to SISO would handle this better.
|
||||
rbe_expensive_exec_strategy = "racing"
|
||||
|
||||
rbe_exec_root = rebase_path("//", root_build_dir)
|
||||
|
||||
|
||||
@@ -113,6 +113,7 @@ template("msvc_toolchain") {
|
||||
}
|
||||
|
||||
tool("rc") {
|
||||
pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
command = "$python_path $tool_wrapper_path rc-wrapper $env rc.exe /nologo {{defines}} {{include_dirs}} /fo{{output}} {{source}}"
|
||||
depsformat = "msvc"
|
||||
outputs = [
|
||||
@@ -122,6 +123,7 @@ template("msvc_toolchain") {
|
||||
}
|
||||
|
||||
tool("asm") {
|
||||
pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
if (toolchain_args.current_cpu == "x86") {
|
||||
command = "$python_path $tool_wrapper_path asm-wrapper $env ml.exe {{defines}} {{include_dirs}} {{asmflags}} /c /Fo {{output}} {{source}}"
|
||||
} else if (toolchain_args.current_cpu == "x64") {
|
||||
@@ -149,6 +151,7 @@ template("msvc_toolchain") {
|
||||
}
|
||||
|
||||
tool("alink") {
|
||||
pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
rspfile = "{{output}}.rsp"
|
||||
command = "$python_path $tool_wrapper_path link-wrapper $env False $lib /nologo /ignore:4221 /OUT:{{output}} @$rspfile"
|
||||
description = "LIB {{output}}"
|
||||
@@ -165,6 +168,7 @@ template("msvc_toolchain") {
|
||||
}
|
||||
|
||||
tool("solink") {
|
||||
pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
dllname = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # e.g.
|
||||
# foo.dll
|
||||
libname = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}.lib" # e.g.
|
||||
@@ -173,9 +177,10 @@ template("msvc_toolchain") {
|
||||
|
||||
link_command = "$python_path $tool_wrapper_path link-wrapper $env False $link /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile"
|
||||
|
||||
# TODO(brettw) support manifests
|
||||
#manifest_command = "$python_path $tool_wrapper_path manifest-wrapper $env mt.exe -nologo -manifest $manifests -out:${dllname}.manifest"
|
||||
#command = "cmd /c $link_command && $manifest_command"
|
||||
# TODO(brettw) support manifests #manifest_command = "$python_path
|
||||
# $tool_wrapper_path manifest-wrapper $env mt.exe -nologo -manifest
|
||||
# $manifests -out:${dllname}.manifest" #command = "cmd /c $link_command &&
|
||||
# $manifest_command"
|
||||
command = link_command
|
||||
|
||||
default_output_extension = ".dll"
|
||||
@@ -195,6 +200,7 @@ template("msvc_toolchain") {
|
||||
}
|
||||
|
||||
tool("solink_module") {
|
||||
pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
dllname =
|
||||
"{{output_dir}}/{{target_output_name}}{{output_extension}}" # e.g.
|
||||
# foo.dll
|
||||
@@ -219,6 +225,7 @@ template("msvc_toolchain") {
|
||||
}
|
||||
|
||||
tool("link") {
|
||||
pool = "//build/toolchain:local_action_pool($host_toolchain)"
|
||||
binary_output =
|
||||
"{{root_out_dir}}/{{target_output_name}}{{output_extension}}"
|
||||
rspfile = "$binary_output.rsp"
|
||||
@@ -226,9 +233,10 @@ template("msvc_toolchain") {
|
||||
|
||||
link_command = "$python_path $tool_wrapper_path link-wrapper $env False $link /nologo /OUT:$binary_output /PDB:$pdbfile @$rspfile"
|
||||
|
||||
# TODO(brettw) support manifests
|
||||
#manifest_command = "$python_path $tool_wrapper_path manifest-wrapper $env mt.exe -nologo -manifest $manifests -out:{{output}}.manifest"
|
||||
#command = "cmd /c $link_command && $manifest_command"
|
||||
# TODO(brettw) support manifests #manifest_command = "$python_path
|
||||
# $tool_wrapper_path manifest-wrapper $env mt.exe -nologo -manifest
|
||||
# $manifests -out:{{output}}.manifest" #command = "cmd /c $link_command &&
|
||||
# $manifest_command"
|
||||
command = link_command
|
||||
|
||||
default_output_extension = ".exe"
|
||||
|
||||
Reference in New Issue
Block a user