Skip to content

Commit f412630

Browse files
authored
Qualcomm AI Engine Direct - Uplevel QNN version for ci test (#5174)
* Qualcomm AI Engine Direct - Uplevel QNN version for ci test Summary: - For rms norm, we need to uplevel to QNN sdk 2.25 or above - There is no libc++.so in ${QNN_SDK_ROOT}/lib/x86_64-linux-clang for QNN sdk 2.23 or above. So, we need to install it manually. * enable llama test for qnn
1 parent 7650667 commit f412630

File tree

4 files changed

+61
-4
lines changed

4 files changed

+61
-4
lines changed

.ci/scripts/build-qnn-sdk.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set -o xtrace
1111
build_qnn_backend() {
1212
echo "Start building qnn backend."
1313
export ANDROID_NDK_ROOT=/opt/ndk
14-
export QNN_SDK_ROOT=/tmp/qnn/2.23.0.240531
14+
export QNN_SDK_ROOT=/tmp/qnn/2.25.0.240728
1515
export EXECUTORCH_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)"
1616

1717
bash backends/qualcomm/scripts/build.sh --skip_aarch64 --job_number 2 --release

.ci/scripts/setup-qnn-deps.sh

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@
77

88
set -ex
99

10+
verify_pkg_installed() {
11+
echo $(dpkg-query -W --showformat='${Status}\n' $1|grep "install ok installed")
12+
}
13+
1014
install_qnn() {
1115
echo "Start installing qnn."
1216
QNN_INSTALLATION_DIR=/tmp/qnn
1317
mkdir -p "${QNN_INSTALLATION_DIR}"
1418

15-
curl -Lo /tmp/v2.23.0.24.06.24.zip "https://softwarecenter.qualcomm.com/api/download/software/qualcomm_neural_processing_sdk/v2.23.0.24.06.24.zip"
19+
curl -Lo /tmp/v2.25.0.24.07.28.zip "https://softwarecenter.qualcomm.com/api/download/software/qualcomm_neural_processing_sdk/v2.25.0.240728.zip"
1620
echo "Finishing downloading qnn sdk."
17-
unzip -qo /tmp/v2.23.0.24.06.24.zip -d /tmp
21+
unzip -qo /tmp/v2.25.0.24.07.28.zip -d /tmp
1822
echo "Finishing unzip qnn sdk."
1923

2024

@@ -26,4 +30,22 @@ install_qnn() {
2630
ls -lah "${QNN_INSTALLATION_DIR}"
2731
}
2832

33+
setup_libc++() {
34+
sudo apt-get update
35+
pkgs_to_check=('libc++-dev')
36+
j=0
37+
while [ $j -lt ${#pkgs_to_check[*]} ]; do
38+
install_status=$(verify_pkg_installed ${pkgs_to_check[$j]})
39+
if [ "$install_status" == "" ]; then
40+
sudo apt-get install -y ${pkgs_to_check[$j]}
41+
if [[ $? -ne 0 ]]; then
42+
echo "ERROR: Failed to install required packages for libc++"
43+
exit 1
44+
fi
45+
fi
46+
j=$(( $j +1));
47+
done
48+
}
49+
50+
setup_libc++
2951
install_qnn

.ci/scripts/test_llama.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ echo "COREML option ${COREML}"
7575
if [[ "${MODE}" =~ .*qnn.* ]]; then
7676
QNN=ON
7777
export EXECUTORCH_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
78-
export QNN_SDK_ROOT=/tmp/qnn/2.23.0.240531
78+
export QNN_SDK_ROOT=/tmp/qnn/2.25.0.240728
7979
export LD_LIBRARY_PATH="${QNN_SDK_ROOT}/lib/x86_64-linux-clang"
8080
export PYTHONPATH=".."
8181
cp schema/program.fbs exir/_serialize/program.fbs

.github/workflows/pull.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,3 +372,38 @@ jobs:
372372
373373
# Run pytest with coverage
374374
pytest -c /dev/null -v -n auto --cov=./ --cov-report=xml backends/arm/test
375+
376+
377+
test-llama-runner-qnn-linux:
378+
name: test-llama-runner-qnn-linux
379+
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
380+
strategy:
381+
matrix:
382+
dtype: [fp32]
383+
build-tool: [cmake]
384+
mode: [qnn]
385+
fail-fast: false
386+
with:
387+
runner: linux.2xlarge
388+
docker-image: executorch-ubuntu-22.04-clang12-android
389+
submodules: 'true'
390+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
391+
timeout: 900
392+
script: |
393+
# The generic Linux job chooses to use base env, not the one setup by the image
394+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
395+
conda activate "${CONDA_ENV}"
396+
397+
DTYPE=${{ matrix.dtype }}
398+
BUILD_TOOL=${{ matrix.build-tool }}
399+
MODE=${{ matrix.mode }}
400+
401+
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-qnn-deps.sh
402+
PYTHON_EXECUTABLE=python bash .ci/scripts/build-qnn-sdk.sh
403+
404+
# Setup executorch
405+
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh buck2
406+
# Install requirements for export_llama
407+
PYTHON_EXECUTABLE=python bash examples/models/llama2/install_requirements.sh
408+
# Test llama2
409+
PYTHON_EXECUTABLE=python bash .ci/scripts/test_llama.sh stories110M "${BUILD_TOOL}" "${DTYPE}" "${MODE}"

0 commit comments

Comments
 (0)