Skip to content

Improve QNN backend AOT user experience#17989

Merged
abhinaykukkadapu merged 6 commits intogh/abhinaykukkadapu/16/basefrom
gh/abhinaykukkadapu/16/head
Mar 23, 2026
Merged

Improve QNN backend AOT user experience#17989
abhinaykukkadapu merged 6 commits intogh/abhinaykukkadapu/16/basefrom
gh/abhinaykukkadapu/16/head

Conversation

@abhinaykukkadapu
Copy link
Copy Markdown
Contributor

@abhinaykukkadapu abhinaykukkadapu commented Mar 7, 2026

Stack from ghstack (oldest at bottom):

  • 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-/ 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

Test plan (user flows)

  1. Extracting and reusing QNN SDK from cache
Screenshot 2026-03-06 at 12 02 30 PM
  1. Show clear errors and actionable steps when there is a download failure
Screenshot 2026-03-06 at 12 02 58 PM
  1. Automatically detect and download latest QNN sdk basing from qnn_config.sh
Screenshot 2026-03-06 at 12 07 04 PM
  1. Set QNN_SDK_ROOT and LD_LIBRARY_PATH for the python process.
Screenshot 2026-03-06 at 12 42 49 PM

cc @cccclai @cbilgin

- 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-poisoned]
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Mar 7, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17989

Note: Links to docs will display an error until the docs builds have been completed.

⏳ 6 Pending, 2 Unrelated Failures

As of commit 54a68e6 with merge base eb92cec (image):

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 7, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 7, 2026

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

- 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-poisoned]
continue
key, _, val = line.partition("=")
# Strip quotes and resolve bash-style ${VAR} references
val = val.strip().strip('"').strip("'")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel like val.strip('"') is enough.


if total > 0:
pct = (i + 1) * 100 // total
_progress(f"\r[QNN] Extracting: {pct}%")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you want to align the message in L360?

Comment thread backends/qualcomm/__init__.py
- 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

## Test plan (user flows)

1. Extracting and reusing QNN SDK from cache

<img width="901" height="487" alt="Screenshot 2026-03-06 at 12 02 30 PM" src="https://github.com/user-attachments/assets/90be5a8a-f5f6-4228-847f-9f5fb1978c74" />

2. Show clear errors and actionable steps when there is a download failure
<img width="1943" height="246" alt="Screenshot 2026-03-06 at 12 02 58 PM" src="https://github.com/user-attachments/assets/c09d30fe-0bf3-49d5-8bff-48aec5c7b687" />

3. Automatically detect and download latest QNN sdk basing from `qnn_config.sh`
<img width="831" height="326" alt="Screenshot 2026-03-06 at 12 07 04 PM" src="https://github.com/user-attachments/assets/8799fd29-873a-4c3b-a36d-204b0d07dbe2" />

4. Set `QNN_SDK_ROOT` and `LD_LIBRARY_PATH` for the python process.
<img width="859" height="230" alt="Screenshot 2026-03-06 at 12 42 49 PM" src="https://github.com/user-attachments/assets/3e6bf0bc-6fe7-41dc-a013-032099ab35a3" />

[ghstack-poisoned]
@digantdesai digantdesai added the module: qnn Issues related to Qualcomm's QNN delegate and code under backends/qualcomm/ label Mar 11, 2026
@abhinaykukkadapu abhinaykukkadapu linked an issue Mar 12, 2026 that may be closed by this pull request
@abhinaykukkadapu
Copy link
Copy Markdown
Contributor Author

@haowhsu-quic addressed comments, can you please stamp these two pr stack if you are ok with the changes.

Copy link
Copy Markdown
Collaborator

@haowhsu-quic haowhsu-quic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

- 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

## Test plan (user flows)

1. Extracting and reusing QNN SDK from cache

<img width="901" height="487" alt="Screenshot 2026-03-06 at 12 02 30 PM" src="https://github.com/user-attachments/assets/90be5a8a-f5f6-4228-847f-9f5fb1978c74" />

2. Show clear errors and actionable steps when there is a download failure
<img width="1943" height="246" alt="Screenshot 2026-03-06 at 12 02 58 PM" src="https://github.com/user-attachments/assets/c09d30fe-0bf3-49d5-8bff-48aec5c7b687" />

3. Automatically detect and download latest QNN sdk basing from `qnn_config.sh`
<img width="831" height="326" alt="Screenshot 2026-03-06 at 12 07 04 PM" src="https://github.com/user-attachments/assets/8799fd29-873a-4c3b-a36d-204b0d07dbe2" />

4. Set `QNN_SDK_ROOT` and `LD_LIBRARY_PATH` for the python process.
<img width="859" height="230" alt="Screenshot 2026-03-06 at 12 42 49 PM" src="https://github.com/user-attachments/assets/3e6bf0bc-6fe7-41dc-a013-032099ab35a3" />

cc cccclai cbilgin

[ghstack-poisoned]
- 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

## Test plan (user flows)

1. Extracting and reusing QNN SDK from cache

<img width="901" height="487" alt="Screenshot 2026-03-06 at 12 02 30 PM" src="https://github.com/user-attachments/assets/90be5a8a-f5f6-4228-847f-9f5fb1978c74" />

2. Show clear errors and actionable steps when there is a download failure
<img width="1943" height="246" alt="Screenshot 2026-03-06 at 12 02 58 PM" src="https://github.com/user-attachments/assets/c09d30fe-0bf3-49d5-8bff-48aec5c7b687" />

3. Automatically detect and download latest QNN sdk basing from `qnn_config.sh`
<img width="831" height="326" alt="Screenshot 2026-03-06 at 12 07 04 PM" src="https://github.com/user-attachments/assets/8799fd29-873a-4c3b-a36d-204b0d07dbe2" />

4. Set `QNN_SDK_ROOT` and `LD_LIBRARY_PATH` for the python process.
<img width="859" height="230" alt="Screenshot 2026-03-06 at 12 42 49 PM" src="https://github.com/user-attachments/assets/3e6bf0bc-6fe7-41dc-a013-032099ab35a3" />

cc cccclai cbilgin

[ghstack-poisoned]
- 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

## Test plan (user flows)

1. Extracting and reusing QNN SDK from cache

<img width="901" height="487" alt="Screenshot 2026-03-06 at 12 02 30 PM" src="https://github.com/user-attachments/assets/90be5a8a-f5f6-4228-847f-9f5fb1978c74" />

2. Show clear errors and actionable steps when there is a download failure
<img width="1943" height="246" alt="Screenshot 2026-03-06 at 12 02 58 PM" src="https://github.com/user-attachments/assets/c09d30fe-0bf3-49d5-8bff-48aec5c7b687" />

3. Automatically detect and download latest QNN sdk basing from `qnn_config.sh`
<img width="831" height="326" alt="Screenshot 2026-03-06 at 12 07 04 PM" src="https://github.com/user-attachments/assets/8799fd29-873a-4c3b-a36d-204b0d07dbe2" />

4. Set `QNN_SDK_ROOT` and `LD_LIBRARY_PATH` for the python process.
<img width="859" height="230" alt="Screenshot 2026-03-06 at 12 42 49 PM" src="https://github.com/user-attachments/assets/3e6bf0bc-6fe7-41dc-a013-032099ab35a3" />

cc cccclai cbilgin

[ghstack-poisoned]
@abhinaykukkadapu
Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Mar 23, 2026

Mergebot is not configured for this repository. Please use the merge button provided by GitHub.

@abhinaykukkadapu abhinaykukkadapu merged commit 35396f6 into gh/abhinaykukkadapu/16/base Mar 23, 2026
135 of 137 checks passed
@abhinaykukkadapu abhinaykukkadapu deleted the gh/abhinaykukkadapu/16/head branch March 23, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: qnn Issues related to Qualcomm's QNN delegate and code under backends/qualcomm/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve qualcomm end-to-end user experience

4 participants