Skip to content

Commit f32ac1c

Browse files
committed
fix runtime failure (1)
1 parent 4e7317c commit f32ac1c

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

cmake/external/onnxruntime_external_deps.cmake

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,10 +644,8 @@ if (onnxruntime_USE_WEBGPU)
644644

645645
# file "${DAWN_EMSCRIPTEN_TOOLCHAIN}/tools/maint/gen_struct_info.py" is missing from emsdk installation.
646646
# we should copy if from ${PROJECT_SOURCE_DIR}/patches/
647-
file(COPY_FILE
648-
"${PROJECT_SOURCE_DIR}/patches/emscripten/tools/maint/gen_struct_info.py"
649-
"${DAWN_EMSCRIPTEN_TOOLCHAIN}/tools/maint/gen_struct_info.py"
650-
ONLY_IF_DIFFERENT)
647+
file(COPY "${PROJECT_SOURCE_DIR}/patches/emscripten/tools/maint/gen_struct_info.py"
648+
DESTINATION "${DAWN_EMSCRIPTEN_TOOLCHAIN}/tools/maint/")
651649
else()
652650
if (onnxruntime_BUILD_DAWN_MONOLITHIC_LIBRARY)
653651
set(DAWN_BUILD_MONOLITHIC_LIBRARY ON CACHE BOOL "" FORCE)

cmake/onnxruntime_providers_webgpu.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
endif()
3333

3434
target_link_libraries(onnxruntime_providers_webgpu PUBLIC emdawnwebgpu_cpp)
35+
target_link_options(onnxruntime_providers_webgpu PUBLIC "SHELL:-s ASYNCIFY=1")
3536
else()
3637
onnxruntime_add_include_to_target(onnxruntime_providers_webgpu dawn::dawncpp_headers dawn::dawn_headers)
3738

js/build_webgpu.bat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ set BUILD_DIR=%ROOT%build_webgpu
1717
:arg1
1818
if ["%~1"]==["d"] (
1919
set CONFIG=Debug
20-
set CONFIG_EXTRA_FLAG=--enable_wasm_profiling --cmake_extra_defines onnxruntime_ENABLE_WEBASSEMBLY_OUTPUT_OPTIMIZED_MODEL=1
20+
set CONFIG_EXTRA_FLAG=--enable_wasm_profiling --wasm_run_tests_in_browser
21+
@rem --cmake_extra_defines onnxruntime_ENABLE_WEBASSEMBLY_OUTPUT_OPTIMIZED_MODEL=1
2122
@rem --enable_wasm_debug_info
2223
goto :arg2
2324
)

onnxruntime/core/providers/webgpu/webgpu_context.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,9 +696,13 @@ WebGpuContext& WebGpuContextFactory::CreateContext(const WebGpuContextConfig& co
696696
#endif
697697

698698
// Step.2 - Create wgpu::Instance
699+
#if !defined(__wasm__)
699700
wgpu::InstanceDescriptor instance_desc{};
700701
instance_desc.features.timedWaitAnyEnable = true;
701702
default_instance_ = wgpu::CreateInstance(&instance_desc);
703+
#else
704+
default_instance_ = wgpu::CreateInstance(nullptr);
705+
#endif
702706

703707
ORT_ENFORCE(default_instance_ != nullptr, "Failed to create wgpu::Instance.");
704708
});

0 commit comments

Comments
 (0)