Skip to content

[9.2.0] Make local scheduling respect exec_properties resources - #29426

Merged
iancha1992 merged 1 commit into
bazelbuild:release-9.2.0from
keith:ks/make-local-scheduling-respect-exec_properties-resources-https-github.com-bazelbuild-bazel-pull-29284
Apr 30, 2026
Merged

iancha1992 merged 1 commit into
bazelbuild:release-9.2.0from
keith:ks/make-local-scheduling-respect-exec_properties-resources-https-github.com-bazelbuild-bazel-pull-29284

Conversation

@keith

@keith keith commented Apr 29, 2026

Copy link
Copy Markdown
Member

Previously only tests supported a target level way to hint the resources
required by the target. This is done with tags = ["resources:cpu:10"].
Now this syntax is supported for normal actions as well, and both normal
actions and test actions support this same format in exec_properties
with exec_properties = {"resources:cpu": "10"}, or exec_group specific
versions like: exec_properties = {"cpp_link.resources:cpu": "10"}.

Work towards #19679 (doesn't
handle a default flag currently)
Work towards #17368
Work towards #25770

Fixes #6477
Fixes #19805
Fixes #25195
Fixes #25792
Fixes #25793

RELNOTES[inc]: exec_properties now respects resources:cpu and resources:memory for local resource estimation.

Closes #29284.

Closes #29419

PiperOrigin-RevId: 906919034
Change-Id: Ia9effd70a71f4e1f42021d945cdc7b1d9d52bbf6
(cherry picked from commit d35da0e)

…9284)

Previously only tests supported a target level way to hint the resources
required by the target. This is done with `tags = ["resources:cpu:10"]`.
Now this syntax is supported for normal actions as well, and both normal
actions and test actions support this same format in `exec_properties`
with `exec_properties = {"resources:cpu": "10"}`, or exec_group specific
versions like: `exec_properties = {"cpp_link.resources:cpu": "10"}`.

Work towards bazelbuild#19679 (doesn't
handle a default flag currently)
Work towards bazelbuild#17368
Work towards bazelbuild#25770

Fixes bazelbuild#6477
Fixes bazelbuild#19805
Fixes bazelbuild#25195
Fixes bazelbuild#25792
Fixes bazelbuild#25793

RELNOTES[inc]: `exec_properties` now respects `resources:cpu` and `resources:memory` for local resource estimation.

Closes bazelbuild#29284.

Closes bazelbuild#29419

PiperOrigin-RevId: 906919034
Change-Id: Ia9effd70a71f4e1f42021d945cdc7b1d9d52bbf6
(cherry picked from commit d35da0e)
@keith
keith requested a review from a team as a code owner April 29, 2026 17:53
@github-actions github-actions Bot added team-Performance Issues for Performance teams team-Configurability platforms, toolchains, cquery, select(), config transitions awaiting-review PR is awaiting review from an assigned reviewer labels Apr 29, 2026
@keith
keith requested review from iancha1992 and katre April 29, 2026 17:54
@keith keith changed the title Make local scheduling respect exec_properties resources (https://github.com/bazelbuild/bazel/pull/29284) [9.2.0] Make local scheduling respect exec_properties resources Apr 29, 2026
@github-actions github-actions Bot added the community-reviewed Reviewed by a trusted community contributor label Apr 29, 2026
@iancha1992
iancha1992 requested a review from gregestren April 29, 2026 21:07
@iancha1992
iancha1992 enabled auto-merge April 29, 2026 21:08
@iancha1992
iancha1992 added this pull request to the merge queue Apr 30, 2026
Merged via the queue into bazelbuild:release-9.2.0 with commit 51e07ea Apr 30, 2026
2 checks passed
@github-actions github-actions Bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Apr 30, 2026
fhanau added a commit to cloudflare/workerd that referenced this pull request Aug 14, 2026
Starting with Bazel 9.2.0, we can indicate expected resource usage for non-test
actions (see bazelbuild/bazel#29426). This can be useful for link actions, which
lld runs in parallel by default. Reserve 4 or 8 CPUs for link actions. This
change is primarily useful for the downstream build, but the workerd build will
also benefit from having fewer CPU usage spikes due to trying to link too many
targets at once.
Also limit lld's link parallelism since lld is slightly less efficient when
linking with too many threads at once as discussed in
https://reviews.llvm.org/D147493. Note that we deliberately apply a limit of 8
threads while only allocating 4 CPUs for most targets since lld usually doesn't
reach the maximum allowed parallelism for long (i.e. average link CPU is
expected to be well below 800% anyway).
fhanau added a commit to cloudflare/workerd that referenced this pull request Aug 14, 2026
Starting with Bazel 9.2.0, we can indicate expected resource usage for non-test
actions (see bazelbuild/bazel#29426). This can be useful for link actions, which
lld runs in parallel by default. Reserve 4 or 8 CPUs for link actions. This
change is primarily useful for the downstream build, but the workerd build will
also benefit from having fewer CPU usage spikes due to trying to link too many
targets at once.
Also limit lld's link parallelism since lld is slightly less efficient when
linking with too many threads at once as discussed in
https://reviews.llvm.org/D147493. Note that we deliberately apply a limit of 8
threads while only allocating 4 CPUs for most targets since lld usually doesn't
reach the maximum allowed parallelism for long (i.e. average link CPU is
expected to be well below 800% anyway).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-reviewed Reviewed by a trusted community contributor team-Configurability platforms, toolchains, cquery, select(), config transitions team-Performance Issues for Performance teams

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants