Skip to content

Commit a4f33a7

Browse files
winskuo-quicjpiat
authored andcommitted
Qualcomm AI Engine Direct - AMD backend error (pytorch#18098)
1 parent 340e202 commit a4f33a7

5 files changed

Lines changed: 23 additions & 2 deletions

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ source "$(dirname "${BASH_SOURCE[0]}")/../../backends/qualcomm/scripts/install_q
1111

1212
setup_libcpp 12
1313
setup_android_ndk
14-
install_qnn
14+
install_qnn
15+
pip install -r backends/qualcomm/requirements.txt

.ci/scripts/test_wheel_package_qnn.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ PY
177177
"$PIPBIN" install . --no-build-isolation
178178
popd > /dev/null
179179

180+
# Install qualcomm backend dependencies
181+
"$PIPBIN" install -r "$REPO_ROOT/backends/qualcomm/requirements.txt"
182+
180183
echo "=== [$LABEL] Import smoke tests ==="
181184
"$PYBIN" -c "import executorch; print('executorch imported successfully')"
182185
"$PYBIN" -c "import executorch.backends.qualcomm; print('executorch.backends.qualcomm imported successfully')"

backends/qualcomm/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
import os
22

3+
import torch
4+
35
from .scripts.download_qnn_sdk import install_qnn_sdk, is_linux_x86, QNN_ZIP_URL
46

7+
try:
8+
import cpuinfo
9+
10+
info = cpuinfo.get_cpu_info()
11+
vendor = info.get("vendor_id_raw", "").lower()
12+
if "amd" in vendor:
13+
torch.backends.mkldnn.enabled = False
14+
except ImportError:
15+
raise ImportError("Please install the cpuinfo with pip install py-cpuinfo.")
16+
517

618
env_flag = os.getenv("EXECUTORCH_BUILDING_WHEEL", "0").lower()
719
# If users have preinstalled QNN_SDK_ROOT, we will use it.

backends/qualcomm/requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
graphviz
2+
pydot
3+
py-cpuinfo
4+
requests
5+
tabulate

backends/qualcomm/scripts/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# LICENSE file in the root directory of this source tree.
77
set -e
88

9-
pip install pydot
9+
pip install -r backends/qualcomm/requirements.txt
1010

1111
# Check if running on macOS/Darwin
1212
if [[ "$(uname -s)" == "Darwin" ]]; then

0 commit comments

Comments
 (0)