Skip to content

Commit

Permalink
[build] Disable WebGPU for Windows non-release builds
Browse files Browse the repository at this point in the history
The Windows build is currently much slower than the macOS/Linux builds on CI,
especially on mostly cached builds.
Based on profiling on #2981, this is caused by the repo mapping stage for dawn
taking several minutes of Windows. Disable the experimental WebGPU feature on
Windows to better meet compile time constraints. Release builds remain
unaffected.
Fetching WPT also contributes here. Only fetch/use WPT on Unix and only
configure targets based on globs as we start using them, Bazel configures
90,000 targets for it otherwise.
  • Loading branch information
fhanau committed Nov 7, 2024
1 parent 10a1edb commit 67f20b3
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 24 deletions.
29 changes: 17 additions & 12 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ import %workspace%/build/ci.bazelrc

import %workspace%/build/lint.bazelrc

# Enable webgpu
build --//src/workerd/io:enable_experimental_webgpu=True
# Enable webgpu. Merely fetching the required Dawn library and computing the repo mapping based on
# it slows down the Windows build significantly, so only enable this on Unix and for Windows release
# builds. This is mostly motivated by compile time constraints, we hope to lift this limitation
# again if this Windows performance bottleneck gets fixed within Bazel.
build:unix --config=webgpu
build:release_windows --config=webgpu
build:webgpu --//src/workerd/io:enable_experimental_webgpu=True

# Avoid generating duplicate runfile trees. This will become the default in a future bazel version.
build --nolegacy_external_runfiles
Expand All @@ -38,16 +43,16 @@ build --incompatible_disallow_empty_glob
# Prevents bazel cache invalidation when switching terminals
build --incompatible_strict_action_env

# Dawn tint build flags
build --@dawn//src/tint:tint_build_glsl_writer=False
build --@dawn//src/tint:tint_build_glsl_validator=False
build --@dawn//src/tint:tint_build_hlsl_writer=True
build --@dawn//src/tint:tint_build_ir=False
build --@dawn//src/tint:tint_build_msl_writer=True
build --@dawn//src/tint:tint_build_spv_reader=False
build --@dawn//src/tint:tint_build_spv_writer=True
build --@dawn//src/tint:tint_build_wgsl_reader=True
build --@dawn//src/tint:tint_build_wgsl_writer=True
# Dawn tint build flags. Only enable when building with webgpu support
build:webgpu --@dawn//src/tint:tint_build_glsl_writer=False
build:webgpu --@dawn//src/tint:tint_build_glsl_validator=False
build:webgpu --@dawn//src/tint:tint_build_hlsl_writer=True
build:webgpu --@dawn//src/tint:tint_build_ir=False
build:webgpu --@dawn//src/tint:tint_build_msl_writer=True
build:webgpu --@dawn//src/tint:tint_build_spv_reader=False
build:webgpu --@dawn//src/tint:tint_build_spv_writer=True
build:webgpu --@dawn//src/tint:tint_build_wgsl_reader=True
build:webgpu --@dawn//src/tint:tint_build_wgsl_writer=True

# Our dependencies (ICU, zlib, etc.) produce a lot of these warnings, so we disable them. Depending
# on the clang version, zlib either produces warnings for -Wdeprecated-non-prototype or does not
Expand Down
15 changes: 5 additions & 10 deletions build/BUILD.wpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@
# Licensed under the Apache 2.0 license found in the LICENSE file or at:
# https://opensource.org/licenses/Apache-2.0

directories = glob(
["*"],
exclude = glob(
["*"],
exclude_directories = 1,
) + [
".*",
],
exclude_directories = 0,
)
# successively enable wpt targets
directories = [
"url",
"urlpattern",
]

[filegroup(
name = dir,
Expand Down
6 changes: 6 additions & 0 deletions build/ci.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ build:ci --color=yes
# Indicate support for more terminal columns, 100 is the line length recommended by KJ style.
build:ci --terminal_columns=100

# Only build runfile trees when needed/lazily, so that they are not built for disabled tests
build:ci --nobuild_runfile_links
# Speeds up CI build by making action output uploads non-blocking so Bazel can e.g. run a test
# before it finishes uploading the test binary. On-by-default in Bazel 8.
build:ci --experimental_remote_cache_async

build:ci --config=v8-codegen-opt
test:ci --test_output=errors
build:ci --disk_cache=~/bazel-disk-cache
Expand Down
9 changes: 9 additions & 0 deletions build/wpt_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ def wpt_test(name, wpt_directory, test_js):
test_name = name,
wpt_directory = wpt_directory,
test_js = test_js,
target_compatible_with = select({
"@platforms//os:windows": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
)

wd_test(
Expand All @@ -28,6 +32,11 @@ def wpt_test(name, wpt_directory, test_js):
wpt_directory,
"//src/workerd/io:trimmed-supported-compatibility-date.txt",
],
# Even generating WPT tests is prohibitively expensive on Windows, disable it there
target_compatible_with = select({
"@platforms//os:windows": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
)

def _wpt_test_gen_impl(ctx):
Expand Down
3 changes: 1 addition & 2 deletions src/wpt/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
filegroup(
name = "wpt-test-harness",
srcs = glob(
include = ["**/*"],
allow_empty = True,
include = ["*.js"],
),
visibility = ["//visibility:public"],
)

0 comments on commit 67f20b3

Please sign in to comment.