Skip to content

Commit 5e7314f

Browse files
committed
Code Review
1 parent e6b0d04 commit 5e7314f

4 files changed

Lines changed: 19 additions & 9 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

backends/qualcomm/__init__.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
import os
22

3-
import cpuinfo
43
import torch
54

65
from .scripts.download_qnn_sdk import install_qnn_sdk, is_linux_x86, QNN_ZIP_URL
76

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+
17+
818
env_flag = os.getenv("EXECUTORCH_BUILDING_WHEEL", "0").lower()
919
# If users have preinstalled QNN_SDK_ROOT, we will use it.
1020
qnn_sdk_root_flag = os.getenv("QNN_SDK_ROOT", None)
@@ -29,8 +39,3 @@
2939
" export LD_LIBRARY_PATH="
3040
"$QNN_SDK_ROOT/lib/x86_64-linux-clang/:$LD_LIBRARY_PATH"
3141
)
32-
33-
info = cpuinfo.get_cpu_info()
34-
vendor = info.get("vendor_id_raw", "").lower()
35-
if "amd" in vendor:
36-
torch.backends.mkldnn.enabled = False

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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
# LICENSE file in the root directory of this source tree.
77
set -e
88

9-
pip install pydot
10-
pip install py-cpuinfo
9+
pip install -r backends/qualcomm/requirements.txt
1110

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

0 commit comments

Comments
 (0)