Skip to content

onnxruntime-web - Add full native WebGPU Asyncify WASM build - #34127

Merged
Edward Chen (edgchen1) merged 8 commits into
mainfrom
edgchen1/web_full_native_asyncify_build
Nov 13, 2026
Merged

Edward Chen (edgchen1) merged 8 commits into
mainfrom
edgchen1/web_full_native_asyncify_build

Conversation

@edgchen1

Copy link
Copy Markdown
Contributor

Description

Adds a full (unreduced) native WebGPU EP Asyncify WebAssembly build, ort-wasm-simd-threaded-full.asyncify.{wasm,mjs}.

Motivation and Context

JSEP migration work.

Build the native WebGPU EP with Asyncify and without the reduced-size
options as ort-wasm-simd-threaded.asyncify-full.{wasm,mjs}, alongside the
existing reduced .asyncify artifacts used by onnxruntime-web/webgpu.

- CMake: onnxruntime_WEBASSEMBLY_ASYNCIFY_FULL_ARTIFACT (build.py
  --wasm_asyncify_full_artifact) names the artifact and rejects JSEP, JSPI
  and reduced-size options.
- JS: build.ts --webgpu-ep --asyncify-full routes the default and /all
  bundles to the full artifact; /webgpu, /jspi, /wasm and Node.js bundles are
  unchanged. The artifact is excluded from the npm package until the default
  switch.
- CI: build the full artifact in the Linux WASM workflow and run WebGPU EP
  suite1 and unit tests against it, plus unit tests against the reduced build.
- Test: add wasm operator/type coverage checks that distinguish full and
  reduced builds.
- Docs: record the artifact name and switches in the migration design.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The native WebGPU EP is replacing JSEP, so label its WASM build steps
"WebGPU EP" to match the browser test step names.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Name a WebGPU Asyncify build .asyncify-full when no operator or type
reduction option is set, instead of requiring a separate CMake option and
build.py flag. Reduced builds keep the .asyncify name, and JSPI naming is
unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Put the full/reduced distinction in the hyphenated name segments, which
describe the build, and keep the dotted suffix for the variant (.jsep,
.asyncify, .jspi). Only the full WebGPU Asyncify build gets the "-full"
segment; existing artifact names, including other unreduced builds, are
unchanged for compatibility.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An unguarded BUILD_DEFS reference throws during Node test discovery, preventing the entire Node unit suite from running.

1 open issue
What changed in this PR

Adds a full, unreduced native WebGPU Asyncify WASM build to support the JSEP migration, while preserving existing reduced artifacts and keeping the new build CI/test-only.

Changes:

  • Gives the full build distinct filenames and adds opt-in routing through --asyncify-full.
  • Builds and stages the artifacts in CI, with Windows browser tests and operator/type coverage checks.
  • Updates migration documentation and excludes the new artifacts from npm packages until the default switch.
File Description
tools/​ci_build/​github/​azure-pipelines/​templates/​linux-wasm-ci.yml Renames WebGPU build display labels.
js/​web/​test/​unittests/​index.ts Registers operator/type coverage tests.
js/​web/​test/​unittests/​backends/​wasm/​test-operator-type-coverage.ts Checks operator and type availability across full and reduced builds.
js/​web/​script/​pull-prebuilt-wasm-artifacts.ts Downloads the full Asyncify artifact pair.
js/​web/​script/​build.ts Adds and validates the opt-in full-build flag.
js/​web/​lib/​wasm/​wasm-utils-import.ts Routes embedded and external loaders to the full artifact.
js/​web/​lib/​wasm/​proxy-wrapper.ts Selects the full WASM URL when enabled.
js/​web/​lib/​build-def.d.ts Declares the full-build selection flag.
js/​web/​.npmignore Excludes full artifacts from npm publication.
docs/​design/​onnxruntime_web_jsep_to_webgpu_ep_migration.md Documents artifact naming, routing, and rollout status.
cmake/​onnxruntime_webassembly.cmake Adds -full naming for unreduced native WebGPU Asyncify builds.
.github/​workflows/​windows-web-ci-workflow.yml Adds full-build browser coverage and full/reduced unit tests.
.github/​workflows/​web.yml Enables full WebGPU builds in Debug and Release CI.
.github/​workflows/​linux-wasm-ci-build-and-test-workflow.yml Builds and stages the full artifact pair.

Review effort: Balanced

Node.js unit tests are compiled by tsc without BUILD_DEFS substitutions, so
reading BUILD_DEFS at module load threw a ReferenceError and stopped the
Node unit suite. Node.js uses the unreduced CPU-only artifact.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Coverage test: assert full operator/type coverage only for the
  -full.asyncify artifact, whose name CMake derives from the absence of
  reduction options. Other artifacts can be built with varying reductions
  (e.g. js/build_jsep.bat, js/build_webgpu.sh), so their full-only cases are
  skipped, and the CI reduced-build unit-test step is removed.
- build.ts: parse --webgpu-ep, --jspi and --asyncify-full (and npm config
  values) as booleans so an explicit "false" is not treated as true.
- build.ts: pin DISABLE_WEBGPU for the CPU-only ort.wasm and ort.node bundles,
  which previously loaded the .asyncify artifact under --webgpu-ep.
- Design doc: record the reduced-build expectation change and defer bundled
  ESM and proxy-worker coverage of the full artifact to Phase 1 prerelease
  package validation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Debug/Release Emscripten builds and Windows GPU/browser CI remain outstanding, leaving loader initialization, native GPU execution, and full-only CPU kernels unverified under the new unreduced Asyncify configuration.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@edgchen1
Edward Chen (edgchen1) marked this pull request as ready for review November 12, 2026 21:31
@edgchen1
Edward Chen (edgchen1) merged commit 499ef30 into main Nov 13, 2026
108 checks passed
@edgchen1
Edward Chen (edgchen1) deleted the edgchen1/web_full_native_asyncify_build branch November 13, 2026 23:05
Edward Chen (edgchen1) added a commit that referenced this pull request Nov 14, 2026
Mark build configuration parity (#34127) and deprecated WebGPU settings
(#34024) done, and JSPI browser coverage in progress: the custom-device
E2E test already runs the /jspi bundle in Chrome. Note that the full
artifact's package exports ship with the default flip.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants