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

[Web] Allow to disable the SIMD detection check #24292

Closed
Eldow opened this issue Apr 3, 2025 · 2 comments · Fixed by #24314
Closed

[Web] Allow to disable the SIMD detection check #24292

Eldow opened this issue Apr 3, 2025 · 2 comments · Fixed by #24314
Labels
api:Javascript issues related to the Javascript API platform:web issues related to ONNX Runtime web; typically submitted using template

Comments

@Eldow
Copy link

Eldow commented Apr 3, 2025

Hello dear onnx team 👋

We are currently making verifications before switching from a legacy sklearn implementation in javascript to ONNX runtime web to run our machine learning models in our web extension and are noticing an issue with a sizeable share of our users.

When trying to load the WASM file, ONNX runtime web performs a feature detection for SIMD which fails in our case for about 20K users out of 600K active users.

From the logs, I figured it couldn't be related to the browser version as they were happening on up to date browsers which should have proper SIMD support, neither OS related as the issue seems to happen on Windows 10, MacOS Catalina and Linux x86_64 distributions. I suspect the issue might be hardware/CPU related.

Could it be because of some specific features from the SIMD detection being not available in some systems ? Are you aware of some limitations ?
eg.

// (module
    //   (type $t0 (func))
    //   (func $f0 (type $t0)
    //     (drop
    //       (i32x4.dot_i16x8_s
    //         (i8x16.splat
    //           (i32.const 0))
    //         (v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000)))))

We are building our own WASM file using the documentation so we could theoretically build a non-SIMD WASM but there is no option to disable the detection check in onnx-runtime-web.

Do you think it would makes sense to add some sort of flag to disable SIMD detection to support providing custom non SIMD wasm files ?

Thank you !

To reproduce

I am not sure how to reproduce exactly as I don't have the exact hardware information where the simd detection fails.

Urgency

This issue prevents a share of our users (20K) to benefit from some AI features.

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

1.19.2

Execution Provider

'wasm'/'cpu' (WebAssembly CPU)

@Eldow Eldow added the platform:web issues related to ONNX Runtime web; typically submitted using template label Apr 3, 2025
@github-actions github-actions bot added the api:Javascript issues related to the Javascript API label Apr 3, 2025
@fs-eire
Copy link
Contributor

fs-eire commented Apr 4, 2025

I can reuse the flag ort.env.wasm.simd to make it bypass the check if it's explicitly set to false. But ONNX Runtime Web team no longer provide official non SIMD build, and you need to build from source. Does that work to your case?

@Eldow
Copy link
Author

Eldow commented Apr 8, 2025

That would be perfect ! Thank you so much 😄

fs-eire added a commit that referenced this issue Apr 8, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
### Description

This PR revised the flag `ort.env.wasm.simd` to enhance its usage so
that more use scenarios are covered.
- Allow setting to `false` explicitly to disable SIMD checking. resolves
#24292 (@Eldow)
- Allow setting to `'relaxed'` to enable Relaxed SIMD checking. Relaxed
SIMD is introduced first in #22794 (@jing-bao)
- Behavior is not changed when not setting (ie. `undefined`) or setting
to `true`
- Added a warning message when setting to unknown value, and reset to
`false` in this case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:Javascript issues related to the Javascript API platform:web issues related to ONNX Runtime web; typically submitted using template
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants