[Web] Avoid unnecessary data copy for pre-allocated tensors#25571
[Web] Avoid unnecessary data copy for pre-allocated tensors#25571guschmue merged 3 commits intomicrosoft:mainfrom
Conversation
|
@fs-eire, PTAL, thanks! |
8bd7e01 to
4810b63
Compare
|
/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows x64 QNN CI Pipeline |
|
Azure Pipelines successfully started running 5 pipeline(s). |
|
I may need to understand more details about why in this case, |
Currently this is WebNN only case, usually if we use pre-allocated output tensors, the
So I need to release this |
For onnxruntime/onnxruntime/wasm/api.cc Lines 605 to 607 in 131cf40 |
Oh, that's odd, as I tested |
@fs-eire, after further debugging, I find there're two places change the address of the
|
4810b63 to
a5cc31b
Compare
|
@fs-eire, friendly ping. |
please merge to latest main branch and add comments in line 866 "// TODO: revisit this part to ensure it works for WebGPU when both pre-allocated outputs and preferred location are specified" |
Ensure all pre-allocated tensors do not trigger unnecessary data copying. e.g. the WebNN EP always binds its tensor to 'ml-tensor'. In such cases, the tensor ID might change after binding, but copying data for these tensors should still be avoided. This improves efficiency and avoids redundant operations.
a5cc31b to
c92a638
Compare
|
/azp run Linux QNN CI Pipeline, Win_TRT_Minimal_CUDA_Test_CI, Windows ARM64 QNN CI Pipeline, Windows GPU Doc Gen CI Pipeline, Windows x64 QNN CI Pipeline |
|
Azure Pipelines successfully started running 5 pipeline(s). |
|
@fs-eire, one unexpected failure CI, do I need to re-merge to latest main branch? |
Description
Ensure all pre-allocated tensors do not trigger unnecessary data copying. e.g. the WebNN EP always binds its tensor to 'ml-tensor'. In such cases, the tensor ID might change after binding, but copying data for these tensors should still be avoided.
Motivation and Context
This improves efficiency and avoids redundant operations.