Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade emsdk version to v4.0.3 #23633

Merged
merged 1 commit into from
Feb 12, 2025
Merged

Upgrade emsdk version to v4.0.3 #23633

merged 1 commit into from
Feb 12, 2025

Conversation

fs-eire
Copy link
Contributor

@fs-eire fs-eire commented Feb 10, 2025

Description

Upgrade EMSDK to v4.0.3

File Size Comparison:

Baseline: e666503 [Build]
This change: bb9f747 [Build]

File Baseline This Change Diff
ort-wasm-simd-threaded.jsep.mjs 49,240 44,230 -5,010
ort-wasm-simd-threaded.jsep.wasm 22,921,505 21,236,866 -1,684,639
ort-wasm-simd-threaded.mjs 25,539 20,890 -4,649
ort-wasm-simd-threaded.wasm 11,771,161 10,942,193 -828,968
ort.min.mjs 345,608 345,608 0
ort.bundle.min.mjs 392,960 388,426 -4,534

Motivation and Context

  • EMSDK 3.1.62-3.1.74 is not working because of an linker issue (wasm-ld) that causes out-of-memory or crash.
  • EMSDK > 3.1.69 requires a change as a post-process of the generated JS file otherwise it will fails onnxruntime-web (as a NPM package) to be consumed in user's web application because of an unexpected webpack behavior.
  • EMSDK >= 4.0.1 fixes the out-of-memory issue but brought new issues causes build break of an indirect dependency of ORT (ORT -> ORT-extensions -> dlib).
  • EMSDK 4.0.3 introduces a change that allows a previous workaround to be removed.

In this PR, all of the above issues are addressed:

  • the linker issue (wasm-ld) is fixed in 4.0.1+
  • the post-process is added in onnxruntime_webassembly.cmake as a POST_BUILD event of target onnxruntime_webassembly. It's done by a Node.js script that uses Regex match and replace.
  • dlib not working with EMSDK v4:
  • file gen_struct_info.py is moved from ${DAWN_EMSCRIPTEN_TOOLCHAIN}/tools/maint to ${DAWN_EMSCRIPTEN_TOOLCHAIN}/tools. This helped to remove the patch.tgz for emscripten. This change also requires a change in Dawn, so patched the change needed for Dawn in this PR.

@fs-eire fs-eire merged commit e6ae1bb into main Feb 12, 2025
98 checks passed
@fs-eire fs-eire deleted the fs-eire/emsdk-4.0.3 branch February 12, 2025 01:13
fs-eire added a commit that referenced this pull request Feb 12, 2025
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