Skip to content

Commit cdc209c

Browse files
authored
Revert "Rebasing with msft commits (#607)"
This reverts commit a6cdf62.
1 parent a6cdf62 commit cdc209c

File tree

274 files changed

+3285
-10047
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

274 files changed

+3285
-10047
lines changed

ThirdPartyNotices.txt

-35
Original file line numberDiff line numberDiff line change
@@ -6045,38 +6045,3 @@ https://github.com/intel/neural-speed
60456045
terms, and open source software license terms. These separate license terms
60466046
govern your use of the third party programs as set forth in the
60476047
"THIRD-PARTY-PROGRAMS" file.
6048-
6049-
_____
6050-
6051-
dawn
6052-
6053-
https://dawn.googlesource.com/dawn
6054-
6055-
BSD 3-Clause License
6056-
6057-
Copyright 2017-2023 The Dawn & Tint Authors
6058-
6059-
Redistribution and use in source and binary forms, with or without
6060-
modification, are permitted provided that the following conditions are met:
6061-
6062-
1. Redistributions of source code must retain the above copyright notice, this
6063-
list of conditions and the following disclaimer.
6064-
6065-
2. Redistributions in binary form must reproduce the above copyright notice,
6066-
this list of conditions and the following disclaimer in the documentation
6067-
and/or other materials provided with the distribution.
6068-
6069-
3. Neither the name of the copyright holder nor the names of its
6070-
contributors may be used to endorse or promote products derived from
6071-
this software without specific prior written permission.
6072-
6073-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
6074-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
6075-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
6076-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
6077-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
6078-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
6079-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
6080-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
6081-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
6082-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

cmake/deps.txt

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ re2;https://github.com/google/re2/archive/refs/tags/2024-07-02.zip;646e1728269cd
5353
safeint;https://github.com/dcleblanc/SafeInt/archive/refs/tags/3.0.28.zip;23f252040ff6cb9f1fd18575b32fa8fb5928daac
5454
tensorboard;https://github.com/tensorflow/tensorboard/archive/373eb09e4c5d2b3cc2493f0949dc4be6b6a45e81.zip;67b833913605a4f3f499894ab11528a702c2b381
5555
cutlass;https://github.com/NVIDIA/cutlass/archive/refs/tags/v3.5.1.zip;e49b2b964163d27765a5002d210a2f3c73771835
56+
utf8_range;https://github.com/protocolbuffers/utf8_range/archive/72c943dea2b9240cd09efde15191e144bc7c7d38.zip;9925739c9debc0efa2adcb194d371a35b6a03156
5657
extensions;https://github.com/microsoft/onnxruntime-extensions/archive/c24b7bab0c12f53da76d0c31b03b9f0f8ec8f3b4.zip;239063aee4946a9af147b473a4c3da78ba7413b4
5758
composable_kernel;https://github.com/ROCmSoftwarePlatform/composable_kernel/archive/204da9c522cebec5220bba52cd3542ebcaf99e7a.zip;1827348efd47831c13074245274d41b7cae8a557
5859
directx_headers;https://github.com/microsoft/DirectX-Headers/archive/refs/tags/v1.613.1.zip;47653509a3371eabb156360f42faf582f314bf2e

cmake/external/onnxruntime_external_deps.cmake

+26-28
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,23 @@ if(onnxruntime_USE_MIMALLOC)
107107
FetchContent_MakeAvailable(mimalloc)
108108
endif()
109109

110+
#Protobuf depends on utf8_range
111+
onnxruntime_fetchcontent_declare(
112+
utf8_range
113+
URL ${DEP_URL_utf8_range}
114+
URL_HASH SHA1=${DEP_SHA1_utf8_range}
115+
EXCLUDE_FROM_ALL
116+
FIND_PACKAGE_ARGS NAMES utf8_range
117+
)
118+
119+
set(utf8_range_ENABLE_TESTS OFF CACHE BOOL "Build test suite" FORCE)
120+
set(utf8_range_ENABLE_INSTALL OFF CACHE BOOL "Configure installation" FORCE)
121+
122+
# The next line will generate an error message "fatal: not a git repository", but it is ok. It is from flatbuffers
123+
onnxruntime_fetchcontent_makeavailable(utf8_range)
124+
# protobuf's cmake/utf8_range.cmake has the following line
125+
include_directories(${utf8_range_SOURCE_DIR})
126+
110127
# Download a protoc binary from Internet if needed
111128
if(NOT ONNX_CUSTOM_PROTOC_EXECUTABLE AND NOT onnxruntime_USE_VCPKG)
112129
# This part of code is only for users' convenience. The code couldn't handle all cases. Users always can manually
@@ -287,7 +304,7 @@ if(NOT TARGET Boost::mp11)
287304
EXCLUDE_FROM_ALL
288305
FIND_PACKAGE_ARGS NAMES Boost
289306
)
290-
onnxruntime_fetchcontent_makeavailable(mp11)
307+
onnxruntime_fetchcontent_makeavailable(mp11)
291308
if(NOT TARGET Boost::mp11)
292309
add_library(Boost::mp11 ALIAS Boost::headers)
293310
endif()
@@ -425,9 +442,6 @@ target_include_directories(safeint_interface INTERFACE ${safeint_SOURCE_DIR})
425442

426443

427444
# Flatbuffers
428-
if(onnxruntime_USE_VCPKG)
429-
find_package(flatbuffers REQUIRED)
430-
else()
431445
# We do not need to build flatc for iOS or Android Cross Compile
432446
if (CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "Android" OR CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
433447
set(FLATBUFFERS_BUILD_FLATC OFF CACHE BOOL "FLATBUFFERS_BUILD_FLATC" FORCE)
@@ -478,7 +492,6 @@ namespace std { using ::getenv; }
478492
endif()
479493
endif()
480494
endif()
481-
endif()
482495

483496
# ONNX
484497
if (NOT onnxruntime_USE_FULL_PROTOBUF)
@@ -659,10 +672,17 @@ if (onnxruntime_USE_WEBGPU)
659672

660673
# disable things we don't use
661674
set(DAWN_DXC_ENABLE_ASSERTS_IN_NDEBUG OFF)
675+
set(DAWN_ENABLE_DESKTOP_GL OFF CACHE BOOL "" FORCE)
676+
set(DAWN_ENABLE_OPENGLES OFF CACHE BOOL "" FORCE)
677+
set(DAWN_SUPPORTS_GLFW_FOR_WINDOWING OFF CACHE BOOL "" FORCE)
678+
set(DAWN_USE_GLFW OFF CACHE BOOL "" FORCE)
679+
set(DAWN_USE_WINDOWS_UI OFF CACHE BOOL "" FORCE)
662680
set(DAWN_USE_X11 OFF CACHE BOOL "" FORCE)
663681

664682
set(TINT_BUILD_TESTS OFF CACHE BOOL "" FORCE)
665683
set(TINT_BUILD_CMD_TOOLS OFF CACHE BOOL "" FORCE)
684+
set(TINT_BUILD_GLSL_WRITER OFF CACHE BOOL "" FORCE)
685+
set(TINT_BUILD_GLSL_VALIDATOR OFF CACHE BOOL "" FORCE)
666686
set(TINT_BUILD_IR_BINARY OFF CACHE BOOL "" FORCE)
667687
set(TINT_BUILD_SPV_READER OFF CACHE BOOL "" FORCE) # don't need. disabling is a large binary size saving
668688
set(TINT_BUILD_WGSL_WRITER ON CACHE BOOL "" FORCE) # needed to create cache key. runtime error if not enabled.
@@ -712,29 +732,7 @@ if (onnxruntime_USE_WEBGPU)
712732
# # if we need to apply patches in the future, we can uncomment the following line.
713733
#
714734
# The dawn.patch contains the following changes:
715-
#
716-
# - (public) CMake fix to support Emscripten v4.0.3+
717-
# This change allows Dawn to find the file "gen_struct_info.py" in the correct location.
718-
# https://dawn-review.googlesource.com/c/dawn/+/225514
719-
#
720-
# - (public) Fix emwgpu C++ implementation for buffer destroy
721-
# In native implementation, wgpuBufferRelease will trigger the buffer destroy (if refcount decreased to 0). But
722-
# in emwgpu implementation, the buffer destroy won't happen. This change fixes the bug.
723-
# https://dawn-review.googlesource.com/c/dawn/+/226315
724-
#
725-
# - (private) Allow "external" buffer in emwgpu C++ implementation
726-
# This change allows WGPUBufferImpl to destroy the buffer when the refcount decreased to 0 only for non-external
727-
# buffer.
728-
# "external buffer" means the GPUBuffer instance created in JavaScript and imported to C++ by `importJsBuffer`.
729-
#
730-
# - (private) Remove hard-coded CMAKE_OSX_DEPLOYMENT_TARGET in Dawn's CMake files
731-
# https://github.com/microsoft/onnxruntime/pull/23729
732-
#
733-
# - (private) Fix external ref count for "external" device in emwgpu C++ implementation
734-
# This change fixes the incorrect external ref count for class WGPUDeviceImpl when used with "external" device.
735-
# "external device" means the GPUDevice instance created in JavaScript and imported to C++ by `importJsDevice`.
736-
#
737-
#
735+
# - https://dawn-review.googlesource.com/c/dawn/+/225514
738736
PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/dawn/dawn.patch
739737
EXCLUDE_FROM_ALL
740738
)

cmake/nuget_helpers.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4-
cmake_minimum_required(VERSION 3.5)
4+
cmake_minimum_required(VERSION 3.0)
55

66
# Determines the version of a native nuget package from the root packages.config.
77
#

cmake/onnxruntime_framework.cmake

+4-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ elseif(onnxruntime_ENABLE_TRITON)
3636
endif()
3737

3838
if (onnxruntime_MINIMAL_BUILD)
39-
set(onnxruntime_framework_src_exclude)
39+
set(onnxruntime_framework_src_exclude
40+
"${ONNXRUNTIME_ROOT}/core/framework/fallback_cpu_capability.h"
41+
"${ONNXRUNTIME_ROOT}/core/framework/fallback_cpu_capability.cc"
42+
)
4043

4144
# custom ops support must be explicitly enabled in a minimal build. exclude if not.
4245
if (NOT onnxruntime_MINIMAL_BUILD_CUSTOM_OPS)

cmake/onnxruntime_optimizer.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ if (onnxruntime_MINIMAL_BUILD)
99
list(APPEND onnxruntime_optimizer_src_patterns
1010
"${ONNXRUNTIME_INCLUDE_DIR}/core/optimizer/graph_transformer.h"
1111
"${ONNXRUNTIME_ROOT}/core/optimizer/graph_transformer.cc"
12-
"${ONNXRUNTIME_ROOT}/core/optimizer/graph_optimizer_registry.cc"
1312
)
1413

1514
if (onnxruntime_EXTENDED_MINIMAL_BUILD)

cmake/onnxruntime_providers_js.cmake

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4-
if (onnxruntime_MINIMAL_BUILD AND NOT onnxruntime_EXTENDED_MINIMAL_BUILD)
5-
message(FATAL_ERROR "JSEP can not be used in a basic minimal build. Please build with '--minimal_build extended'")
6-
endif()
7-
84
add_compile_definitions(USE_JSEP=1)
95

106
file(GLOB_RECURSE onnxruntime_providers_js_cc_srcs
@@ -22,4 +18,4 @@
2218
onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers Boost::mp11 Eigen3::Eigen
2319
)
2420

25-
add_dependencies(onnxruntime_providers_js ${onnxruntime_EXTERNAL_DEPENDENCIES})
21+
add_dependencies(onnxruntime_providers_js ${onnxruntime_EXTERNAL_DEPENDENCIES})

cmake/onnxruntime_python.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ if (onnxruntime_USE_QNN)
10291029
add_custom_command(
10301030
TARGET onnxruntime_pybind11_state POST_BUILD
10311031
COMMAND ${CMAKE_COMMAND} -E copy
1032-
$<TARGET_FILE:ep_weight_sharing_ctx_gen>
1032+
$<TARGET_FILE:onnxruntime_qnn_ctx_gen>
10331033
$<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
10341034
)
10351035
if (EXISTS "${onnxruntime_QNN_HOME}/Qualcomm AI Hub Proprietary License.pdf")

cmake/onnxruntime_session.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ endif()
2222
if (onnxruntime_MINIMAL_BUILD)
2323
set(onnxruntime_session_src_exclude
2424
"${ONNXRUNTIME_ROOT}/core/session/provider_bridge_ort.cc"
25-
"${ONNXRUNTIME_ROOT}/core/session/model_builder_c_api.cc"
2625
)
2726

2827
list(REMOVE_ITEM onnxruntime_session_srcs ${onnxruntime_session_src_exclude})

cmake/onnxruntime_unittests.cmake

+17-26
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,14 @@ function(AddTest)
236236
)
237237
endif()
238238
# Set test timeout to 3 hours.
239-
set_tests_properties(${_UT_TARGET} PROPERTIES TIMEOUT 10800)
239+
set_tests_properties(${_UT_TARGET} PROPERTIES TIMEOUT 7200)
240240
else()
241241
add_test(NAME ${_UT_TARGET}
242242
COMMAND ${_UT_TARGET} ${TEST_ARGS}
243243
WORKING_DIRECTORY $<TARGET_FILE_DIR:${_UT_TARGET}>
244244
)
245245
# Set test timeout to 3 hours.
246-
set_tests_properties(${_UT_TARGET} PROPERTIES TIMEOUT 10800)
246+
set_tests_properties(${_UT_TARGET} PROPERTIES TIMEOUT 7200)
247247
endif()
248248
endif()
249249
endfunction(AddTest)
@@ -503,7 +503,6 @@ set (onnxruntime_shared_lib_test_SRC
503503

504504
if (NOT onnxruntime_MINIMAL_BUILD)
505505
list(APPEND onnxruntime_shared_lib_test_SRC ${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/test_inference.cc)
506-
list(APPEND onnxruntime_shared_lib_test_SRC ${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/test_model_builder_api.cc)
507506
endif()
508507

509508
if(onnxruntime_RUN_ONNX_TESTS)
@@ -1289,34 +1288,31 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
12891288

12901289
if(onnxruntime_USE_QNN)
12911290
#qnn ctx generator
1292-
set(ep_weight_sharing_ctx_gen_src_dir ${TEST_SRC_DIR}/ep_weight_sharing_ctx_gen)
1293-
set(ep_weight_sharing_ctx_gen_src_patterns
1294-
"${ep_weight_sharing_ctx_gen_src_dir}/*.cc"
1295-
"${ep_weight_sharing_ctx_gen_src_dir}/*.h")
1291+
set(onnxruntime_qnn_ctx_gen_src_dir ${TEST_SRC_DIR}/qnn_ctx_gen)
1292+
set(onnxruntime_qnn_ctx_gen_src_patterns
1293+
"${onnxruntime_qnn_ctx_gen_src_dir}/*.cc"
1294+
"${onnxruntime_qnn_ctx_gen_src_dir}/*.h")
12961295

1297-
file(GLOB ep_weight_sharing_ctx_gen_src CONFIGURE_DEPENDS
1298-
${ep_weight_sharing_ctx_gen_src_patterns}
1296+
file(GLOB onnxruntime_qnn_ctx_gen_src CONFIGURE_DEPENDS
1297+
${onnxruntime_qnn_ctx_gen_src_patterns}
12991298
)
1300-
onnxruntime_add_executable(ep_weight_sharing_ctx_gen ${ep_weight_sharing_ctx_gen_src})
1301-
target_include_directories(ep_weight_sharing_ctx_gen PRIVATE ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR})
1299+
onnxruntime_add_executable(onnxruntime_qnn_ctx_gen ${onnxruntime_qnn_ctx_gen_src})
1300+
target_include_directories(onnxruntime_qnn_ctx_gen PRIVATE ${onnx_test_runner_src_dir} ${ONNXRUNTIME_ROOT}
1301+
${onnxruntime_graph_header} ${onnxruntime_exec_src_dir}
1302+
${CMAKE_CURRENT_BINARY_DIR})
13021303
if (WIN32)
1303-
target_compile_options(ep_weight_sharing_ctx_gen PRIVATE ${disabled_warnings})
1304+
target_compile_options(onnxruntime_qnn_ctx_gen PRIVATE ${disabled_warnings})
13041305
if (NOT DEFINED SYS_PATH_LIB)
13051306
set(SYS_PATH_LIB shlwapi)
13061307
endif()
13071308
endif()
13081309

1309-
if (onnxruntime_BUILD_SHARED_LIB)
1310-
set(ep_weight_sharing_ctx_gen_libs onnxruntime_common onnxruntime ${onnxruntime_EXTERNAL_LIBRARIES} ${GETOPT_LIB_WIDE})
1311-
target_link_libraries(ep_weight_sharing_ctx_gen PRIVATE ${ep_weight_sharing_ctx_gen_libs})
1312-
if (WIN32)
1313-
target_link_libraries(ep_weight_sharing_ctx_gen PRIVATE debug dbghelp advapi32)
1314-
endif()
1315-
else()
1316-
target_link_libraries(ep_weight_sharing_ctx_gen PRIVATE onnxruntime_session ${onnxruntime_test_providers_libs} ${onnxruntime_EXTERNAL_LIBRARIES} ${GETOPT_LIB_WIDE})
1310+
if(WIN32)
1311+
target_link_libraries(onnxruntime_qnn_ctx_gen PRIVATE debug dbghelp advapi32)
13171312
endif()
1313+
target_link_libraries(onnxruntime_qnn_ctx_gen PRIVATE onnx_test_runner_common onnxruntime_test_utils onnxruntime_common onnxruntime_graph onnxruntime_session onnxruntime_providers onnxruntime_framework onnxruntime_util onnxruntime_mlas onnxruntime_optimizer onnxruntime_flatbuffers onnx_test_data_proto ${onnxruntime_test_providers_libs} ${onnxruntime_EXTERNAL_LIBRARIES} ${GETOPT_LIB_WIDE} ${SYS_PATH_LIB} ${CMAKE_DL_LIBS})
13181314

1319-
set_target_properties(ep_weight_sharing_ctx_gen PROPERTIES FOLDER "ONNXRuntimeTest")
1315+
set_target_properties(onnxruntime_qnn_ctx_gen PROPERTIES FOLDER "ONNXRuntimeTest")
13201316
endif()
13211317

13221318
# shared lib
@@ -1363,19 +1359,14 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
13631359
LIBS ${onnxruntime_shared_lib_test_LIBS}
13641360
DEPENDS ${all_dependencies}
13651361
)
1366-
1367-
target_include_directories(onnxruntime_shared_lib_test PRIVATE ${ONNXRUNTIME_ROOT})
1368-
13691362
if (onnxruntime_USE_CUDA)
13701363
target_include_directories(onnxruntime_shared_lib_test PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
13711364
target_sources(onnxruntime_shared_lib_test PRIVATE ${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/cuda_ops.cu)
13721365
endif()
1373-
13741366
if (onnxruntime_USE_ROCM)
13751367
target_include_directories(onnxruntime_shared_lib_test PRIVATE ${onnxruntime_ROCM_HOME}/include)
13761368
target_compile_definitions(onnxruntime_shared_lib_test PRIVATE __HIP_PLATFORM_AMD__)
13771369
endif()
1378-
13791370
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
13801371
target_sources(onnxruntime_shared_lib_test PRIVATE
13811372
"${ONNXRUNTIME_ROOT}/core/platform/android/cxa_demangle.cc"

cmake/onnxruntime_webassembly.cmake

+9-28
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,10 @@ else()
211211
target_link_libraries(onnxruntime_webassembly PRIVATE tensorboard)
212212
endif()
213213

214-
set(onnxruntime_webassembly_script_deps "${ONNXRUNTIME_ROOT}/wasm/pre.js")
215-
216-
set(EXPORTED_FUNCTIONS "_malloc,_free")
217214
if (onnxruntime_USE_JSEP)
218-
string(APPEND EXPORTED_FUNCTIONS ",_JsepOutput,_JsepGetNodeName")
219-
endif()
220-
if (onnxruntime_USE_WEBGPU)
221-
string(APPEND EXPORTED_FUNCTIONS ",_wgpuBufferRelease,_wgpuCreateInstance")
215+
set(EXPORTED_FUNCTIONS "_malloc,_free,_JsepOutput,_JsepGetNodeName")
216+
else()
217+
set(EXPORTED_FUNCTIONS "_malloc,_free")
222218
endif()
223219

224220
if (onnxruntime_ENABLE_WEBASSEMBLY_MEMORY64)
@@ -316,15 +312,13 @@ else()
316312
target_compile_options(noexcep_operators PRIVATE ${SMEMORY_FLAG} -Wno-experimental)
317313
endif()
318314
target_link_options(onnxruntime_webassembly PRIVATE
319-
"SHELL:--post-js \"${ONNXRUNTIME_ROOT}/wasm/js_post_js_64.js\""
315+
--post-js "${ONNXRUNTIME_ROOT}/wasm/js_post_js_64.js"
320316
)
321-
list(APPEND onnxruntime_webassembly_script_deps "${ONNXRUNTIME_ROOT}/wasm/js_post_js_64.js")
322317
else ()
323318
set(MAXIMUM_MEMORY "4294967296")
324319
target_link_options(onnxruntime_webassembly PRIVATE
325-
"SHELL:--post-js \"${ONNXRUNTIME_ROOT}/wasm/js_post_js.js\""
320+
--post-js "${ONNXRUNTIME_ROOT}/wasm/js_post_js.js"
326321
)
327-
list(APPEND onnxruntime_webassembly_script_deps "${ONNXRUNTIME_ROOT}/wasm/js_post_js.js")
328322
endif ()
329323

330324
target_link_options(onnxruntime_webassembly PRIVATE
@@ -378,6 +372,7 @@ jsepDownload:_pp_")
378372
"SHELL:-s SIGNATURE_CONVERSIONS='${SIGNATURE_CONVERSIONS}'"
379373
)
380374
endif ()
375+
set_target_properties(onnxruntime_webassembly PROPERTIES LINK_DEPENDS ${ONNXRUNTIME_ROOT}/wasm/pre.js)
381376

382377
if (onnxruntime_USE_JSEP)
383378
# NOTE: "-s ASYNCIFY=1" is required for JSEP to work with WebGPU
@@ -387,8 +382,10 @@ jsepDownload:_pp_")
387382
target_compile_definitions(onnxruntime_webassembly PRIVATE USE_JSEP=1)
388383
target_link_options(onnxruntime_webassembly PRIVATE
389384
"SHELL:--pre-js \"${ONNXRUNTIME_ROOT}/wasm/pre-jsep.js\""
385+
"SHELL:-s ASYNCIFY=1"
386+
"SHELL:-s ASYNCIFY_STACK_SIZE=65536"
390387
)
391-
list(APPEND onnxruntime_webassembly_script_deps "${ONNXRUNTIME_ROOT}/wasm/pre-jsep.js")
388+
set_target_properties(onnxruntime_webassembly PROPERTIES LINK_DEPENDS ${ONNXRUNTIME_ROOT}/wasm/pre-jsep.js)
392389

393390
if (onnxruntime_ENABLE_WEBASSEMBLY_MEMORY64)
394391
target_link_options(onnxruntime_webassembly PRIVATE
@@ -400,20 +397,6 @@ jsepDownload:_pp_")
400397

401398
if (onnxruntime_USE_WEBGPU)
402399
target_compile_definitions(onnxruntime_webassembly PRIVATE USE_WEBGPU=1)
403-
target_link_options(onnxruntime_webassembly PRIVATE
404-
"SHELL:--post-js \"${ONNXRUNTIME_ROOT}/wasm/post-webgpu.js\""
405-
)
406-
list(APPEND onnxruntime_webassembly_script_deps "${ONNXRUNTIME_ROOT}/wasm/post-webgpu.js")
407-
endif()
408-
409-
if (onnxruntime_USE_JSEP OR onnxruntime_USE_WEBGPU OR onnxruntime_USE_WEBNN)
410-
# if any of the above is enabled, we need to use the asyncify library
411-
target_link_options(onnxruntime_webassembly PRIVATE
412-
"SHELL:--pre-js \"${ONNXRUNTIME_ROOT}/wasm/pre-async.js\""
413-
"SHELL:-s ASYNCIFY=1"
414-
"SHELL:-s ASYNCIFY_STACK_SIZE=65536"
415-
)
416-
list(APPEND onnxruntime_webassembly_script_deps "${ONNXRUNTIME_ROOT}/wasm/pre-async.js")
417400
endif()
418401

419402
if (onnxruntime_EMSCRIPTEN_SETTINGS)
@@ -475,8 +458,6 @@ jsepDownload:_pp_")
475458
)
476459
endif()
477460

478-
set_target_properties(onnxruntime_webassembly PROPERTIES LINK_DEPENDS "${onnxruntime_webassembly_script_deps}")
479-
480461
set(target_name_list ort)
481462

482463
if (onnxruntime_ENABLE_TRAINING_APIS)

0 commit comments

Comments
 (0)