diff --git a/cmake/onnxruntime_webassembly.cmake b/cmake/onnxruntime_webassembly.cmake index 90817ca48ec0a..c90703cb0d2e8 100644 --- a/cmake/onnxruntime_webassembly.cmake +++ b/cmake/onnxruntime_webassembly.cmake @@ -271,15 +271,45 @@ else() "SHELL:-s VERBOSE=0" "SHELL:-s FILESYSTEM=0" "SHELL:-s INCOMING_MODULE_JS_API=[preRun,locateFile,arguments,onExit,wasmMemory,buffer,instantiateWasm,mainScriptUrlOrBlob]" - "SHELL:-s WASM_BIGINT" + "SHELL:-s WASM_BIGINT=1" ${WASM_API_EXCEPTION_CATCHING} --no-entry "SHELL:--pre-js \"${ONNXRUNTIME_ROOT}/wasm/pre.js\"" ) if (onnxruntime_ENABLE_WEBASSEMBLY_MEMORY64) + set(SIGNATURE_CONVERSIONS "\ +OrtRun:_ppp_p_pp,\ +OrtGetTensorData:_ppppp,\ +OrtCreateTensor:p_pppp_,\ +OrtCreateSession:pppp,\ +OrtReleaseSession:_p,\ +OrtGetInputOutputCount:pppp,\ +OrtCreateSessionOptions:pp__p_ppppp,\ +OrtAddSessionConfigEntry:pppp,\ +OrtReleaseSessionOptions:_p,\ +OrtAppendExecutionProvider:ppp,\ +OrtAddSessionConfigEntry:pppp,\ +OrtGetInputName:ppp,\ +OrtGetOutputName:ppp,\ +OrtCreateRunOptions:ppp_p,\ +OrtReleaseRunOptions:pp,\ +OrtReleaseTensor:_p,\ +OrtFree:_p,\ +OrtCreateBinding:_p,\ +OrtBindInput:_ppp,\ +OrtBindOutput:_ppp,\ +OrtClearBoundOutputs:_p,\ +OrtReleaseBinding:_p,\ +OrtGetLastError:_pp,\ +JsepOutput:pp_p,\ +JsepGetNodeN:pp,\ +JsepOutput:pp_p,\ +jsepCopy:_pp_,\ +jsepCopyAsync:_pp_,\ +jsepDownload:_pp_") target_link_options(onnxruntime_webassembly PRIVATE "SHELL:-s ERROR_ON_UNDEFINED_SYMBOLS=0" - "SHELL:-s SIGNATURE_CONVERSIONS=OrtRun:_ppp_p_pp,OrtGetTensorData:_ppppp,OrtCreateTensor:p_pppp_,OrtCreateSession:pppp,OrtReleaseSession:_p,OrtGetInputOutputCount:pppp,OrtCreateSessionOptions:pp__p_ppppp,OrtAddSessionConfigEntry:pppp,OrtReleaseSessionOptions:_p,OrtAppendExecutionProvider:ppp,OrtAddSessionConfigEntry:pppp,OrtGetInputName:ppp,OrtGetOutputName:ppp,OrtCreateRunOptions:ppp_p,OrtReleaseRunOptions:pp,OrtReleaseTensor:_p,OrtFree:_p,OrtGetLastError:_pp,JsepOutput:pp_p,JsepGetNodeName:pp,JsepOutput:pp_p,jsepCopy:_pp_,jsepCopyAsync:_pp_,jsepDownload:_pp_" + "SHELL:-s SIGNATURE_CONVERSIONS='${SIGNATURE_CONVERSIONS}'" ) endif () set_target_properties(onnxruntime_webassembly PROPERTIES LINK_DEPENDS ${ONNXRUNTIME_ROOT}/wasm/pre.js) diff --git a/onnxruntime/core/providers/js/data_transfer.cc b/onnxruntime/core/providers/js/data_transfer.cc index e18bad836a223..3809df2c82e4c 100644 --- a/onnxruntime/core/providers/js/data_transfer.cc +++ b/onnxruntime/core/providers/js/data_transfer.cc @@ -37,7 +37,7 @@ common::Status DataTransfer::CopyTensor(const Tensor& src, Tensor& dst) const { } } else /* if (src_device.Type() == OrtDevice::GPU) */ { // copy from GPU to CPU - EM_ASM({ Module.jsepCopyAsync(Number($0), Number($1), Number($2)); }, src_data, dst_data, bytes); + jsepDownload(src_data, dst_data, bytes); } }