From 9683707490077491298591945d2746d0f8e28065 Mon Sep 17 00:00:00 2001 From: Felix Hanau Date: Wed, 23 Oct 2024 13:26:09 -0400 Subject: [PATCH] [build] Disable WebGPU for Windows non-release builds 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. --- .bazelrc | 30 +++++++++++++++++------------- .github/workflows/test.yml | 15 ++++++++++----- build/BUILD.wpt | 11 +---------- build/ci.bazelrc | 4 ++++ build/wpt_test.bzl | 9 +++++++++ src/wpt/BUILD.bazel | 3 +-- 6 files changed, 42 insertions(+), 30 deletions(-) diff --git a/.bazelrc b/.bazelrc index 3eb4b1c36462..b86705b99fdd 100644 --- a/.bazelrc +++ b/.bazelrc @@ -21,14 +21,18 @@ build --experimental_remote_cache_eviction_retries=3 # due to https://github.com/bazelbuild/bazel/issues/20576. # Windows build is failing on some runs due to FileAccessException errors, Bazel has had several # similar bugs in the past. Disable BwoB for now. -build:windows --remote_download_all # Import CI-specific configuration. As the amount of custom configuration settings we use grows, # consider moving more flags out to separate files. import %workspace%/build/ci.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 @@ -39,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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fdfb596693b5..fd35e2812421 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,7 +47,7 @@ jobs: # disk I/O race conditions causing permission denied errors (this also happened in # previous versions). Use remote_download_all for now. - os: { name : windows, image : windows-2022 } - config: { suffix: '', bazel-args: "--config=windows_no_dbg --remote_download_all" } + config: { suffix: '', bazel-args: "--config=windows_no_dbg" } # TODO (later): The custom Windows-debug configuration consistently runs out of disk # space on CI, disable it for now. Once https://github.com/bazelbuild/bazel/issues/21615 # has been resolved we can likely re-enable it and possibly fold up the custom @@ -171,12 +171,9 @@ jobs: - name: Configure git hooks # Configure git to quell an irrelevant warning for runners (they never commit / push). run: git config core.hooksPath githooks - - name: Bazel build + - name: Bazel build & test # timestamps are no longer being added here, the GitHub logs include timestamps (Use # 'Show timestamps' on the web interface) - run: | - bazel build --remote_download_minimal ${{ matrix.config.bazel-args }} --disk_cache=~/bazel-disk-cache --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev --config=ci --config=v8-codegen-opt //... - - name: Bazel test run: | bazel test --remote_download_minimal ${{ matrix.config.bazel-args }} --disk_cache=~/bazel-disk-cache --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev --test_output=errors --config=ci --config=v8-codegen-opt //... - name: Report disk usage (in MB) @@ -207,6 +204,14 @@ jobs: else echo "Disk cache does not exist: ~/bazel-disk-cache" fi + - name: Upload build statistics + if: always() + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os.name }}${{ matrix.config.suffix }}-bazel-profile + path: | + build.bazel-profile + test.bazel-profile - name: Bazel shutdown # Check that there are no .bazelrc issues that prevent shutdown. run: bazel shutdown diff --git a/build/BUILD.wpt b/build/BUILD.wpt index 757b227041c7..99e2f95515b1 100644 --- a/build/BUILD.wpt +++ b/build/BUILD.wpt @@ -2,16 +2,7 @@ # 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, -) +directories = ["url"] [filegroup( name = dir, diff --git a/build/ci.bazelrc b/build/ci.bazelrc index 939875a9715a..4cd17c029df4 100644 --- a/build/ci.bazelrc +++ b/build/ci.bazelrc @@ -18,3 +18,7 @@ build:ci --show_progress_rate_limit=1 build:ci --color=yes # Indicate support for more terminal columns, 100 is the line length recommended by KJ style. build:ci --terminal_columns=100 + +# Emit build profile so that slow builds can be investigated +build:ci --profile build.bazel-profile +test:ci --profile test.bazel-profile diff --git a/build/wpt_test.bzl b/build/wpt_test.bzl index f94915ba88b5..a69238073aaf 100644 --- a/build/wpt_test.bzl +++ b/build/wpt_test.bzl @@ -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( @@ -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): diff --git a/src/wpt/BUILD.bazel b/src/wpt/BUILD.bazel index 4eda7837a58b..f8ad536a57f8 100644 --- a/src/wpt/BUILD.bazel +++ b/src/wpt/BUILD.bazel @@ -1,8 +1,7 @@ filegroup( name = "wpt-test-harness", srcs = glob( - include = ["**/*"], - allow_empty = True, + include = ["*.js"], ), visibility = ["//visibility:public"], )