Skip to content

Commit 3d734f3

Browse files
committed
Add build flag check
Raise error when enable_wasm_simd is False but enable_wasm_relaxed_simd is True. Fix comments.
1 parent f18f70a commit 3d734f3

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

cmake/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ option(onnxruntime_ENABLE_WEBASSEMBLY_DEBUG_INFO "Enable this option to turn on
206206
option(onnxruntime_ENABLE_WEBASSEMBLY_PROFILING "Enable this option to turn on WebAssembly profiling and preserve function names" OFF)
207207
option(onnxruntime_ENABLE_WEBASSEMBLY_OUTPUT_OPTIMIZED_MODEL "Enable this option to allow WebAssembly to output optimized model" OFF)
208208
option(onnxruntime_ENABLE_WEBASSEMBLY_MEMORY64 "Enable this option to allow WebAssembly to use 64bit memory" OFF)
209+
option(onnxruntime_ENABLE_WEBASSEMBLY_RELAXED_SIMD "Enable WebAssembly Relaxed SIMD" OFF)
209210

210211
# Enable bitcode for iOS
211212
option(onnxruntime_ENABLE_BITCODE "Enable bitcode for iOS only" OFF)

cmake/onnxruntime_mlas.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ function(setup_mlas_source_for_windows)
236236
endfunction()
237237

238238
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
239-
if (onnxruntime_ENABLE_WEBASSEMBLY_SIMD OR onnxruntime_ENABLE_WEBASSEMBLY_RELAXED_SIMD)
239+
if (onnxruntime_ENABLE_WEBASSEMBLY_SIMD)
240240
file(GLOB_RECURSE mlas_platform_srcs
241241
"${MLAS_SRC_DIR}/wasm_simd/*.cpp"
242242
)

onnxruntime/core/mlas/lib/qgemm_kernel_wasmrelaxedsimd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ Licensed under the MIT License.
66
77
Module Name:
88
9-
qgemm_kernel_wasmsimd.cpp
9+
qgemm_kernel_wasmrelaxedsimd.cpp
1010
1111
Abstract:
1212
13-
This module implements QGEMM kernel for WebAssembly SIMD128.
13+
This module implements QGEMM kernel for WebAssembly Relaxed SIMD128.
1414
1515
--*/
1616

tools/ci_build/build.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,9 +1156,12 @@ def generate_build_tree(
11561156
cmake_args.append("-Donnxruntime_DNNL_ACL_ROOT=" + args.dnnl_acl_root)
11571157
if args.build_wasm:
11581158
cmake_args.append("-Donnxruntime_ENABLE_WEBASSEMBLY_SIMD=" + ("ON" if args.enable_wasm_simd else "OFF"))
1159-
cmake_args.append(
1160-
"-Donnxruntime_ENABLE_WEBASSEMBLY_RELAXED_SIMD=" + ("ON" if args.enable_wasm_relaxed_simd else "OFF")
1161-
)
1159+
if args.enable_wasm_relaxed_simd:
1160+
if not args.enable_wasm_simd:
1161+
raise BuildError(
1162+
"Wasm Relaxed SIMD (--enable_wasm_relaxed_simd) is only available with Wasm SIMD (--enable_wasm_simd)."
1163+
)
1164+
cmake_args += ["-Donnxruntime_ENABLE_WEBASSEMBLY_RELAXED_SIMD=ON"]
11621165
if args.use_migraphx:
11631166
cmake_args.append("-Donnxruntime_MIGRAPHX_HOME=" + migraphx_home)
11641167
if args.use_cuda:

0 commit comments

Comments
 (0)