Improve QNN backend build-from-source user experience#18413
Merged
Conversation
- Read QNN_VERSION from qnn_config.sh instead of hardcoding in download_qnn_sdk.py, eliminating version duplication - Add download progress bars for SDK (~2.4GB), libc++ (~575MB), and glibc (~10MB) downloads with percentage and MB counters - Add extraction progress for SDK, libc++, and tar archives - Add retry + resume for SDK download — on mid-stream failures (ChunkedEncodingError, ConnectionError), resumes from where it left off using HTTP Range headers instead of restarting - Replace NullHandler logger with configured StreamHandler so users see status messages (previously all output was swallowed) - Cache SDK at ~/.cache/executorch/qnn/sdk-<version>/ instead of inside the pip package directory, surviving pip reinstalls - Include version in cache directory name for automatic upgrade detection when qnn_config.sh version changes - Set both QNN_SDK_ROOT and LD_LIBRARY_PATH after auto-download - Print SDK version and path on first import (cached or fresh) - Print user-provided QNN_SDK_ROOT path when set via env var - Add visible warning before glibc re-exec with guidance - Replace unhelpful "check logs above" error with actionable message including full SDK download URL and env var setup instructions ghstack-source-id: ddb21d7 Pull Request resolved: #17989
- Remove EXECUTORCH_BUILD_WHEEL_DO_NOT_USE gate in CMakeLists.txt so QNN SDK auto-downloads for all build paths (editable installs, build.sh), not just wheel builds - Use shared cache dir (~/.cache/executorch/qnn/) instead of cmake build dir, so SDK survives build dir cleans and is shared across all build flows - Remove hard QNN_SDK_ROOT requirement from build.sh — cmake handles auto-download during configure when SDK is not set - Auto-download Android NDK in build.sh via install_qnn_sdk.sh when ANDROID_NDK_ROOT is not set - Fix PYTHON_EXECUTABLE default in build.sh (was checked before being used, with a buggy test that never triggered) - Default EXECUTORCH_BUILD_QNN to ON on Linux x86 in pybind preset, matching wheel behavior so editable installs build QNN out of the box - Redirect download_qnn_sdk.py progress output to stderr when --print-sdk-path is used, so cmake can capture the path cleanly ghstack-source-id: 7a0428c Pull Request resolved: #17990
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18413
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
abhinaykukkadapu
approved these changes
Mar 23, 2026
abhinaykukkadapu
approved these changes
Mar 23, 2026
This PR needs a
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was created by the merge bot to help merge the original PR into the main branch.
ghstack PR number: #17990 by @abhinaykukkadapu
^ Please use this as the source of truth for the PR details, comments, and reviews
ghstack PR base: https://github.com/pytorch/executorch/tree/gh/abhinaykukkadapu/17/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/abhinaykukkadapu/17/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/abhinaykukkadapu/16/orig
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/abhinaykukkadapu/17/orig
@diff-train-skip-merge