Skip to content

[wasm] add flags for WebGPU build to reduce binary size#27371

Merged
fs-eire merged 8 commits intomainfrom
fs-eire/wasm-reduced-datatype-build
Feb 26, 2026
Merged

[wasm] add flags for WebGPU build to reduce binary size#27371
fs-eire merged 8 commits intomainfrom
fs-eire/wasm-reduced-datatype-build

Conversation

@fs-eire
Copy link
Copy Markdown
Contributor

@fs-eire fs-eire commented Feb 18, 2026

Description

This change uses a combination of flags to reduce binary size for WebGPU wasm build:

  • exclude a few data types: uint16/int16, float8, float4, float64, sparse tensor, string
  • disable_ml_ops
  • disable_generation_ops

Motivation and Context

reduce binary size for ORT-web.

Comment thread onnxruntime/core/providers/op_kernel_type_control_overrides.inc Outdated
Comment thread cmake/CMakeLists.txt Outdated
@fs-eire
Copy link
Copy Markdown
Contributor Author

fs-eire commented Feb 24, 2026

Updated the change to use config file and --enable_reduced_operator_type_support.

Pending more local test, now switching to "WIP" and will switch back once it's complete.

@fs-eire fs-eire marked this pull request as draft February 24, 2026 07:22
@fs-eire fs-eire changed the title add option for reduced datatype in WebAssembly builds [wasm] add flags for WebGPU build to reduce binary size Feb 24, 2026
@fs-eire fs-eire marked this pull request as ready for review February 24, 2026 10:20
Comment thread onnxruntime/wasm/reduced_types.config
Comment thread .github/workflows/linux-wasm-ci-build-and-test-workflow.yml
@fs-eire fs-eire merged commit 3db53eb into main Feb 26, 2026
102 of 109 checks passed
@fs-eire fs-eire deleted the fs-eire/wasm-reduced-datatype-build branch February 26, 2026 00:31
@xenova
Copy link
Copy Markdown
Contributor

xenova commented Mar 2, 2026

Very aligned with this fix, but we do get the following error for https://huggingface.co/onnx-community/BEN2-ONNX/tree/main/onnx.

ERROR_MESSAGE: /mnt/vss/_work/1/s/onnxruntime/core/optimizer/transformer_memcpy.cc:254 bool onnxruntime::TransformerMemcpyImpl::IsNodeCompatibleWithProvider(const onnxruntime::Node &) const !node_provider_type.empty() was false. Provider type for Pow node with name '/dec_blk3/norm1/Pow' is not set.

which uses float64 ops (first Pow).

This is VERY rare though... so probably not worth reverting/updating. We should update the model instead imo.

@fs-eire
Copy link
Copy Markdown
Contributor Author

fs-eire commented Mar 2, 2026

Very aligned with this fix, but we do get the following error for https://huggingface.co/onnx-community/BEN2-ONNX/tree/main/onnx.

ERROR_MESSAGE: /mnt/vss/_work/1/s/onnxruntime/core/optimizer/transformer_memcpy.cc:254 bool onnxruntime::TransformerMemcpyImpl::IsNodeCompatibleWithProvider(const onnxruntime::Node &) const !node_provider_type.empty() was false. Provider type for Pow node with name '/dec_blk3/norm1/Pow' is not set.

which uses float64 ops (first Pow).

This is VERY rare though... so probably not worth reverting/updating. We should update the model instead imo.

Yes usually fp32 works for most of the scenarios.

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