Skip to content

Commit b73ca05

Browse files
authored
Qualcomm AI Engine Direct - CMake fix for direct mode (pytorch#18205)
1 parent e1f24ec commit b73ca05

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

backends/qualcomm/scripts/build.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ if [ "$BUILD_ANDROID" = true ]; then
127127

128128
# DSP_TYPE variable only matters when building direct_mode.
129129
# Ignore the variable for traditional mode.
130+
131+
if [ "$BUILD_HEXAGON" = "true" ]; then
132+
DIRECT_MODE_FLAG="-DBUILD_DIRECT_MODE=ON"
133+
else
134+
DIRECT_MODE_FLAG="-DBUILD_DIRECT_MODE=OFF"
135+
fi
136+
130137
cmake $PRJ_ROOT/$EXAMPLE_ROOT \
131138
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake \
132139
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
@@ -140,6 +147,7 @@ if [ "$BUILD_ANDROID" = true ]; then
140147
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH \
141148
-DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE \
142149
-DDSP_TYPE=$DSP_TYPE \
150+
$DIRECT_MODE_FLAG \
143151
-B$EXAMPLE_ROOT
144152

145153
cmake --build $EXAMPLE_ROOT -j$BUILD_JOB_NUMBER

examples/qualcomm/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/qaihub_scripts/stable_diffusion)
8989
# direct-mode qnn_executor_direct_runner is build with ndk toolchain, paired
9090
# with libraries built with hexagon toolchain, communicate through self-defined
9191
# fastrpc protocol.
92-
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" AND DEFINED ENV{HEXAGON_SDK_ROOT})
92+
option(BUILD_DIRECT_MODE "Build direct mode executor runner" OFF)
93+
if(BUILD_DIRECT_MODE)
9394
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/direct_executor_runner)
9495
endif()

0 commit comments

Comments
 (0)