Skip to content

Commit 1ac8fb7

Browse files
Improve QNN backend AOT user experience (pytorch#18412)
Co-authored-by: Abhinay Kukkadapu <abhinayk@meta.com>
1 parent b24b6ab commit 1ac8fb7

2 files changed

Lines changed: 269 additions & 111 deletions

File tree

backends/qualcomm/__init__.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
11
import os
22

3-
from .scripts.download_qnn_sdk import install_qnn_sdk, is_linux_x86
3+
from .scripts.download_qnn_sdk import install_qnn_sdk, is_linux_x86, QNN_ZIP_URL
44

55

66
env_flag = os.getenv("EXECUTORCH_BUILDING_WHEEL", "0").lower()
77
# If users have preinstalled QNN_SDK_ROOT, we will use it.
88
qnn_sdk_root_flag = os.getenv("QNN_SDK_ROOT", None)
99

10-
if env_flag not in ("1", "true", "yes") and not qnn_sdk_root_flag and is_linux_x86():
11-
ok = install_qnn_sdk()
12-
if not ok:
13-
raise RuntimeError("Failed to install QNN SDK. Please check the logs above.")
10+
if env_flag not in ("1", "true", "yes"):
11+
if qnn_sdk_root_flag:
12+
print(
13+
f"[QNN] Using QNN SDK at {qnn_sdk_root_flag} (from QNN_SDK_ROOT)",
14+
flush=True,
15+
)
16+
elif is_linux_x86():
17+
ok = install_qnn_sdk()
18+
if not ok:
19+
raise RuntimeError(
20+
"Failed to set up QNN SDK.\n\n"
21+
"To resolve, try one of:\n"
22+
" 1. Download the SDK manually from:\n"
23+
f" {QNN_ZIP_URL}\n"
24+
" Or go to step 2 if QNN SDK already exists.\n"
25+
" 2. Set QNN_SDK_ROOT to an existing SDK installation:\n"
26+
" export QNN_SDK_ROOT=/path/to/qualcomm/sdk\n"
27+
" export LD_LIBRARY_PATH="
28+
"$QNN_SDK_ROOT/lib/x86_64-linux-clang/:$LD_LIBRARY_PATH"
29+
)

0 commit comments

Comments
 (0)