From 69c5edb11b4b8d9f5b6e522066990ac0d6e0eaee Mon Sep 17 00:00:00 2001 From: Yulong Wang <7679871+fs-eire@users.noreply.github.com> Date: Tue, 28 Feb 2023 11:06:09 -0800 Subject: [PATCH] [wasm] upgrade emsdk from 3.1.19 to 3.1.32 (#14818) ### Description upgrade emsdk from 3.1.19 to 3.1.32 also add explicit config for stack size (1MB). --- .gitmodules | 2 +- cgmanifests/generated/cgmanifest.json | 35 ++----------------- cmake/external/emsdk | 2 +- cmake/onnxruntime_unittests.cmake | 2 +- tools/ci_build/build.py | 5 ++- .../azure-pipelines/templates/win-wasm-ci.yml | 2 +- 6 files changed, 10 insertions(+), 38 deletions(-) diff --git a/.gitmodules b/.gitmodules index 8e4217162b..a7b81e2639 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,7 +13,7 @@ [submodule "cmake/external/emsdk"] path = cmake/external/emsdk url = https://github.com/emscripten-core/emsdk.git - branch = 3.1.19 + branch = 3.1.32 [submodule "cmake/external/onnxruntime-extensions"] path = cmake/external/onnxruntime-extensions url = https://github.com/microsoft/onnxruntime-extensions.git diff --git a/cgmanifests/generated/cgmanifest.json b/cgmanifests/generated/cgmanifest.json index 378647f273..cf89f37758 100644 --- a/cgmanifests/generated/cgmanifest.json +++ b/cgmanifests/generated/cgmanifest.json @@ -92,7 +92,7 @@ "component": { "type": "git", "git": { - "commitHash": "c220895fd1163c01f0a8b44229fb9e4fe0ae0958", + "commitHash": "0ab19024f08c6673a713e454ef8bd95e174c807f", "repositoryUrl": "https://github.com/emscripten-core/emsdk.git" }, "comments": "git submodule at cmake/external/emsdk" @@ -328,16 +328,6 @@ "comments": "psimd" } }, - { - "component": { - "type": "git", - "git": { - "commitHash": "a20c65f2cd549445fda907f7b83894c8eb7427d6", - "repositoryUrl": "https://github.com/protocolbuffers/protobuf.git" - }, - "comments": "protobuf" - } - }, { "component": { "type": "git", @@ -455,28 +445,7 @@ "commitHash": "75a84807a019bf4961faf713df9d748f0fc83b47", "repositoryUrl": "https://github.com/triton-inference-server/server.git" }, - "comments": "triton server" - } - }, - { - "component": { - "type": "git", - "git": { - "commitHash": "3712ec3f0426f7132d3759b84683d7d11e9ba683", - "repositoryUrl": "https://github.com/triton-inference-server/client.git" - }, - "comments": "triton client" - } - }, - { - "Component": { - "Type": "other", - "other": { - "Name": "pthread", - "Version": "3.0.0", - "DownloadUrl": "https://sourceforge.net/projects/pthreads4w/files/pthreads4w-code-v3.0.0.zip" - }, - "comments": "posix pthread library" + "comments": "triton" } } ] diff --git a/cmake/external/emsdk b/cmake/external/emsdk index c220895fd1..0ab19024f0 160000 --- a/cmake/external/emsdk +++ b/cmake/external/emsdk @@ -1 +1 @@ -Subproject commit c220895fd1163c01f0a8b44229fb9e4fe0ae0958 +Subproject commit 0ab19024f08c6673a713e454ef8bd95e174c807f diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake index 86254d464a..d4365d5586 100644 --- a/cmake/onnxruntime_unittests.cmake +++ b/cmake/onnxruntime_unittests.cmake @@ -835,7 +835,7 @@ if (onnxruntime_ENABLE_TRAINING_TORCH_INTEROP) endif() if (onnxruntime_BUILD_WEBASSEMBLY) set_target_properties(onnxruntime_test_all PROPERTIES LINK_DEPENDS ${TEST_SRC_DIR}/wasm/onnxruntime_test_all_adapter.js) - set_target_properties(onnxruntime_test_all PROPERTIES LINK_FLAGS "-s ALLOW_MEMORY_GROWTH=1 --pre-js \"${TEST_SRC_DIR}/wasm/onnxruntime_test_all_adapter.js\" -s \"EXPORTED_RUNTIME_METHODS=['FS']\" --preload-file ${CMAKE_CURRENT_BINARY_DIR}/testdata@/testdata -s EXIT_RUNTIME=1") + set_target_properties(onnxruntime_test_all PROPERTIES LINK_FLAGS "-s STACK_SIZE=1048576 -s ALLOW_MEMORY_GROWTH=1 --pre-js \"${TEST_SRC_DIR}/wasm/onnxruntime_test_all_adapter.js\" -s \"EXPORTED_RUNTIME_METHODS=['FS']\" --preload-file ${CMAKE_CURRENT_BINARY_DIR}/testdata@/testdata -s EXIT_RUNTIME=1") if (onnxruntime_ENABLE_WEBASSEMBLY_THREADS) set_property(TARGET onnxruntime_test_all APPEND_STRING PROPERTY LINK_FLAGS " -s USE_PTHREADS=1 -s PROXY_TO_PTHREAD=1") endif() diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index 1ca662a50b..816054ee4c 100644 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -397,7 +397,7 @@ def parse_arguments(): # WebAssembly build parser.add_argument("--build_wasm", action="store_true", help="Build for WebAssembly") parser.add_argument("--build_wasm_static_lib", action="store_true", help="Build for WebAssembly static library") - parser.add_argument("--emsdk_version", default="3.1.19", help="Specify version of emsdk") + parser.add_argument("--emsdk_version", default="3.1.32", help="Specify version of emsdk") parser.add_argument("--enable_wasm_simd", action="store_true", help="Enable WebAssembly SIMD") parser.add_argument("--enable_wasm_threads", action="store_true", help="Enable WebAssembly multi-threads support") @@ -1222,6 +1222,9 @@ def generate_build_tree( add_default_definition(emscripten_settings, "MALLOC", args.wasm_malloc) add_default_definition(emscripten_settings, "MALLOC", "dlmalloc") + # set -s STACK_SIZE=1048576 + add_default_definition(emscripten_settings, "STACK_SIZE", "1048576") + if emscripten_settings: cmake_args += [f"-Donnxruntime_EMSCRIPTEN_SETTINGS={';'.join(emscripten_settings)}"] diff --git a/tools/ci_build/github/azure-pipelines/templates/win-wasm-ci.yml b/tools/ci_build/github/azure-pipelines/templates/win-wasm-ci.yml index 5c27c84152..b0ac9b6259 100644 --- a/tools/ci_build/github/azure-pipelines/templates/win-wasm-ci.yml +++ b/tools/ci_build/github/azure-pipelines/templates/win-wasm-ci.yml @@ -29,7 +29,7 @@ jobs: variables: EnvSetupScript: setup_env.bat buildArch: x64 - CommonBuildArgs: '--parallel --config ${{ parameters.BuildConfig }} --skip_submodule_sync --cmake_generator "Visual Studio 16 2019" --build_wasm --use_xnnpack --emsdk_version releases-upstream-4c3772879a04140298c3abde90962d5567b5e2fc-64bit ${{ parameters.ExtraBuildArgs }}' + CommonBuildArgs: '--parallel --config ${{ parameters.BuildConfig }} --skip_submodule_sync --cmake_generator "Visual Studio 16 2019" --build_wasm --use_xnnpack --emsdk_version releases-29ad1037cd6b99e5d8a1bd75bc188c1e9a6fda8d-64bit ${{ parameters.ExtraBuildArgs }}' runCodesignValidationInjection: false timeoutInMinutes: ${{ parameters.TimeoutInMinutes }} workspace: