Skip to content

Commit e854967

Browse files
kirklandsignhuydhn
andauthored
Build QNN in android_llm_demo.sh and perf
Pull Request resolved: #5105 Co-authored-by: Huy Do <[email protected]>
1 parent ee752f0 commit e854967

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

.github/workflows/android-perf.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ jobs:
206206
name: build-llm-demo
207207
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
208208
needs: set-parameters
209+
strategy:
210+
matrix:
211+
delegate: ${{ fromJson(needs.set-parameters.outputs.delegates) }}
212+
fail-fast: false
209213
with:
210214
runner: linux.2xlarge
211215
docker-image: executorch-ubuntu-22.04-clang12-android
@@ -222,6 +226,11 @@ jobs:
222226
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh cmake
223227
export ARTIFACTS_DIR_NAME=artifacts-to-be-uploaded
224228
229+
if [[ ${{ matrix.delegate }} == "qnn" ]]; then
230+
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-qnn-deps.sh
231+
PYTHON_EXECUTABLE=python bash .ci/scripts/build-qnn-sdk.sh
232+
fi
233+
225234
# TODO: This needs to be replaced with a generic loader .apk
226235
# Build LLM Demo for Android
227236
bash build/build_android_llm_demo.sh ${ARTIFACTS_DIR_NAME}

build/build_android_llm_demo.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ build_android_native_library() {
1919
ANDROID_ABI="$1"
2020
ANDROID_NDK="${ANDROID_NDK:-/opt/ndk}"
2121
CMAKE_OUT="cmake-out-android-${ANDROID_ABI}"
22+
QNN_SDK_ROOT="${QNN_SDK_ROOT:-}"
23+
if [ -n "$QNN_SDK_ROOT" ]; then
24+
EXECUTORCH_BUILD_QNN=ON
25+
else
26+
EXECUTORCH_BUILD_QNN=OFF
27+
fi
28+
2229

2330
cmake . -DCMAKE_INSTALL_PREFIX="${CMAKE_OUT}" \
2431
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \
@@ -34,6 +41,8 @@ build_android_native_library() {
3441
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
3542
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
3643
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \
44+
-DEXECUTORCH_BUILD_QNN="${EXECUTORCH_BUILD_QNN}" \
45+
-DQNN_SDK_ROOT="${QNN_SDK_ROOT}" \
3746
-DCMAKE_BUILD_TYPE=Release \
3847
-B"${CMAKE_OUT}"
3948

0 commit comments

Comments
 (0)