Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ci/scripts/wheel/test_shared_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -3018,6 +3018,7 @@ def test_shipped_library_names_are_expected() -> None:
"libexecutorch_backend_mlx",
"libexecutorch_backend_openvino",
"libexecutorch_backend_qnn",
"libexecutorch_vulkan_shared_runtime",
"libexecutorch_threadpool",
"libexecutorch_etdump",
)
Expand Down
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,17 @@ configure_file(
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/executorch-backend-dependencies.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ExecuTorch
)
set(EXECUTORCH_VULKAN_SHARED_RUNTIME_REQUIRED
OFF
CACHE INTERNAL "Vulkan or VGF requires the shared registry DSO" FORCE
)
if(EXECUTORCH_BUILD_VULKAN OR EXECUTORCH_BUILD_VGF)
set(EXECUTORCH_VULKAN_SHARED_RUNTIME_REQUIRED
ON
CACHE INTERNAL "Vulkan or VGF requires the shared registry DSO" FORCE
)
endif()

if(EXECUTORCH_BUILD_VULKAN
OR EXECUTORCH_BUILD_VGF
OR EXECUTORCH_BUILD_NATIVE_VULKAN
Expand Down Expand Up @@ -1668,6 +1679,12 @@ if(EXECUTORCH_BUILD_VGF)
list(APPEND _executorch_backends vgf_backend)
endif()

# The example links the Vulkan backend and extension/module targets; these
# targets are all available here, unlike inside backends/arm.
if(EXECUTORCH_BUILD_VGF_SHARED_EXAMPLE)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/examples/arm/vgf_vulkan_shared)
endif()

# Added after the backends so EXECUTORCH_BUILD_WASM_WEBGPU can link
# webgpu_backend, which has to already be defined at that point.
if(EXECUTORCH_BUILD_WASM)
Expand Down
45 changes: 44 additions & 1 deletion backends/arm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,9 @@ if(EXECUTORCH_BUILD_VGF)

# Add backend delegate for VGF
set(_vgf_backend_sources
backends/arm/runtime/VGFBackend.cpp backends/arm/runtime/VGFSetup.cpp
backends/arm/runtime/VGFBackend.cpp
backends/arm/runtime/VGFSetup.cpp
backends/arm/runtime/VGFSharedDevice.cpp
backends/arm/runtime/VGFZeroCopy.cpp
backends/arm/runtime/VGFNeuralStatistics.cpp
)
Expand Down Expand Up @@ -349,6 +351,23 @@ if(EXECUTORCH_BUILD_VGF)
target_link_libraries(vgf_backend PRIVATE executorch_core)
target_link_libraries(vgf_backend PRIVATE vgf)

target_compile_features(vgf_backend PUBLIC cxx_std_17)
target_link_libraries(vgf_backend PUBLIC executorch_vulkan_shared_runtime)
target_compile_options(
vgf_backend PRIVATE "$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-fexceptions>"
"$<$<CXX_COMPILER_ID:MSVC>:/EHsc>"
)
if(EXECUTORCH_BUILD_VULKAN)
target_compile_definitions(
vgf_backend PUBLIC EXECUTORCH_VGF_SHARED_DEVICE=1
)
target_link_libraries(vgf_backend PRIVATE vulkan_backend)
else()
target_compile_definitions(
vgf_backend PUBLIC EXECUTORCH_VGF_SHARED_DEVICE=0
)
endif()

# When VGF compiles volk.c itself, link libdl for dlopen/dlsym
if(NOT EXECUTORCH_BUILD_VULKAN)
target_link_libraries(vgf_backend PRIVATE ${CMAKE_DL_LIBS})
Expand Down Expand Up @@ -436,5 +455,29 @@ if(EXECUTORCH_BUILD_VGF)
add_test(NAME vgf_zero_copy_test COMMAND vgf_zero_copy_test)
endif()

if(EXECUTORCH_BUILD_TESTS)
add_executable(
vgf_shared_device_test
${EXECUTORCH_ROOT}/backends/arm/test/vgf_shared_device_test.cpp
)
target_include_directories(
vgf_shared_device_test
PRIVATE ${_common_include_directories} ${VULKAN_HEADERS_PATH}
${VOLK_HEADERS_PATH}
)
target_compile_options(
vgf_shared_device_test PRIVATE -DUSE_VULKAN_WRAPPER -DUSE_VULKAN_VOLK
)
target_link_libraries(vgf_shared_device_test PRIVATE vgf_backend)
if(TARGET GTest::gtest_main)
target_link_libraries(vgf_shared_device_test PRIVATE GTest::gtest_main)
else()
target_link_libraries(vgf_shared_device_test PRIVATE gtest gtest_main)
endif()
add_test(NAME vgf_shared_device_test COMMAND vgf_shared_device_test)
endif()

# The mixed example is configured at the root after dependencies exist.

# end config for VGF builds
endif()
Loading
Loading