[js/webgpu] throw error when WebGPU=ON and SIMD=OFF (#15924)

### Description
throw error when WebGPU=ON and SIMD=OFF
This commit is contained in:
Yulong Wang 2023-05-16 11:05:56 -07:00 committed by GitHub
parent 780442b9f6
commit 04ea561fc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -98,6 +98,10 @@ class ComputeContextImpl implements ComputeContext {
export const init = async(module: OrtWasmModule, env: Env): Promise<void> => {
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);