Draft
Fix Dawn WebGPU parallel build race on webgpu_enum_class_bitmasks.h in wasm_inferencing_webgpu_jspi#29777
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
…gpu_jspi
Two related fixes for the race condition where cmake -E copy fails when
two parallel make jobs both try to copy webgpu_enum_class_bitmasks.h to
the same destination file.
Fix 1: Add cmake -E make_directory before cmake -E copy in the
emdawnwebgpu_headers_gen_add macro to ensure the output directory exists
before any copy command runs, regardless of parallel build ordering.
Fix 2: Remove webgpu_enum_class_bitmasks.h from emdawnwebgpu_cpp's
HEADERS list. Because emdawnwebgpu_cpp is an INTERFACE library and this
file is in INTERFACE_SOURCES, CMake propagates it to every linking target's
directory scope and generates a duplicate cmake -E copy recipe. With
parallel make (-jN), both the Dawn-directory recipe and the
ORT-directory recipe run concurrently for the same output file, causing
the copy to fail. The header remains accessible via the include directory
set on emdawnwebgpu_c_include (${EM_BUILD_GEN_DIR}/include), and build
ordering is preserved through the existing dependency chain.
Copilot
AI
changed the title
[WIP] Fix failing Web CI pipeline job from PR #29776
Fix Dawn WebGPU parallel build race on webgpu_enum_class_bitmasks.h in wasm_inferencing_webgpu_jspi
Jul 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Extends
cmake/patches/dawn/dawn_parallel_build_fix.patchwith a second hunk and updates the explanatory comment inonnxruntime_external_deps.cmake. Two fixes in the patch address the race:Fix 1 — missing output directory (existing hunk): adds
cmake -E make_directorybeforecmake -E copyinemdawnwebgpu_headers_gen_addso the destination directory is guaranteed to exist before any copy runs, regardless of parallel job scheduling.Fix 2 — duplicate custom-command recipe (new hunk): removes
webgpu_enum_class_bitmasks.hfromemdawnwebgpu_cpp'sHEADERSlist:emdawnwebgpu_cppis anINTERFACElibrary, so anything inHEADERSgoes intoINTERFACE_SOURCES. Whenonnxruntime_providers_webgpulinks to it, CMake propagates the generated file into ORT's directory scope and emits a secondcmake -E copyrecipe for the same output path. With-j32, both recipes run concurrently → race → copy failure. Removing the entry eliminates the duplicate recipe. The header remains reachable via${EM_BUILD_GEN_DIR}/include(already onemdawnwebgpu_c_include'sINTERFACE_INCLUDE_DIRECTORIES), and build ordering is preserved through the existingemdawnwebgpu_c → emdawnwebgpu_c_include → emdawnwebgpu_headers_genchain.Also removes a stale comment in
cmake/onnxruntime_providers_webgpu.cmakethat described an older, different bug.Motivation and Context
The
wasm_inferencing_webgpu_jspistep (CI job88023093249) was failing becausewebgpu_enum_class_bitmasks.hwas being copied by two parallel make jobs simultaneously. The JSPI build is most susceptible because it runs after a warmed ccache, so all ORT compilation steps finish quickly and many more jobs compete for the Dawn header generation step at the same time.