Skip to content

Commit a12abb9

Browse files
authored
Arm backend: Enable zero copy IO. (#24276)
Enable execution-time zero-copy I/O for the VGF backend using VK_EXT_external_memory_host. Eligible ExecuTorch input and output tensors can now be imported directly into Vulkan and bound to VGF boundary tensors, avoiding host-side memcpy for those buffers. The implementation includes: - build-time and runtime gates for zero-copy - capability and alignment validation with safe copy fallback - mixed zero-copy/copy execution - correct model-boundary input/output mapping - execution-scoped imported-memory lifetime - cleanup and terminal-state handling for error and device-loss paths - runtime tests covering import, fallback, pointer changes, and cleanup The existing copy path remains the fallback whenever zero-copy cannot be used. cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani Signed-off-by: Elena Zhelezina <elena.zhelezina@arm.com>
1 parent 4fe0253 commit a12abb9

11 files changed

Lines changed: 693 additions & 90 deletions

‎backends/arm/CMakeLists.txt‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,15 @@ if(EXECUTORCH_BUILD_VGF)
277277
list(TRANSFORM _vgf_backend_sources PREPEND "${EXECUTORCH_ROOT}/")
278278
add_library(vgf_backend ${_vgf_backend_sources})
279279

280+
option(EXECUTORCH_VGF_ZERO_COPY_IO
281+
"Enable VGF model-boundary host zero-copy I/O" OFF
282+
)
283+
if(EXECUTORCH_VGF_ZERO_COPY_IO)
284+
target_compile_definitions(vgf_backend PUBLIC EXECUTORCH_VGF_ZERO_COPY_IO=1)
285+
else()
286+
target_compile_definitions(vgf_backend PUBLIC EXECUTORCH_VGF_ZERO_COPY_IO=0)
287+
endif()
288+
280289
# Should be absent in ordinary production builds.
281290
option(EXECUTORCH_VGF_IO_STATS "Collect per-execution VGF copy statistics"
282291
OFF

0 commit comments

Comments
 (0)