From 04ea561fc88433015829718923ed2e8e5ea703e2 Mon Sep 17 00:00:00 2001 From: Yulong Wang <7679871+fs-eire@users.noreply.github.com> Date: Tue, 16 May 2023 11:05:56 -0700 Subject: [PATCH] [js/webgpu] throw error when WebGPU=ON and SIMD=OFF (#15924) ### Description throw error when WebGPU=ON and SIMD=OFF --- js/web/lib/wasm/jsep/init.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/web/lib/wasm/jsep/init.ts b/js/web/lib/wasm/jsep/init.ts index 93d390dd64..dd875cda12 100644 --- a/js/web/lib/wasm/jsep/init.ts +++ b/js/web/lib/wasm/jsep/init.ts @@ -98,6 +98,10 @@ class ComputeContextImpl implements ComputeContext { export const init = async(module: OrtWasmModule, env: Env): Promise => { const init = module.jsepInit; if (init && navigator.gpu) { + if (!env.wasm.simd) { + throw new Error( + 'Not supported for WebGPU=ON and SIMD=OFF. Please set `env.wasm.simd` to true when using WebGPU EP'); + } const backend = new WebGpuBackend(); await backend.initialize(env);