Skip to content

Qualcomm AI Engine Direct - Enabling Support for Qualcomm Chipsets for Snapdragon 7+ Gen 3 - #22542

Open
qti-horodnic wants to merge 1 commit into
pytorch:mainfrom
CodeLinaro:enable_snapdragon_7+_Gen3
Open

Qualcomm AI Engine Direct - Enabling Support for Qualcomm Chipsets for Snapdragon 7+ Gen 3#22542
qti-horodnic wants to merge 1 commit into
pytorch:mainfrom
CodeLinaro:enable_snapdragon_7+_Gen3

Conversation

@qti-horodnic

@qti-horodnic qti-horodnic commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Adding SoC support for SM7675 (Snapdragon 7+ Gen 3) and SM8635 (Snapdragon 8s Gen 3), both HTP V73.

Scope of Support:

  • Quantized HTP: supported*. Quantized HTP validated across 8a8w/16a4w/16a2w, per-channel, block-wise, and QAT paths, plus the full quantized utils suite. See test cases in the Test Plan section. I did not run the whole quantized ops/model suite, which is why support is denoted with a (*).
  • FP16: not supported. QNN rejects these SoCs for FP16 ("The SocModel doesn't support FP16"), so FP16 lowering does not produce a delegated graph. Note it also does not degrade gracefully today: models containing ops on the partitioner's non-decompose list (e.g. linear, layer_norm) fail to export rather than falling back to CPU.

Note that these changes need the fix added in #22543 for the tests to pass.

Test plan

python backends/qualcomm/tests/test_qnn_delegate.py \
  TestQNNQuantizedOperator.test_qnn_backend_16a4w_conv2d \
  TestQNNQuantizedOperator.test_qnn_backend_16a4w_linear \
  TestQNNQuantizedOperator.test_qnn_backend_16a4w_layer_norm \
  TestQNNQuantizedOperator.test_qnn_backend_16a4w_conv2d \
  -v --soc_model SM8635 --host aisw-local-vm3 --device 4603496b \
  --build_folder build-android

python backends/qualcomm/tests/test_qnn_delegate.py \
 TestQNNQuantizedOperator.test_qnn_backend_sort \
 TestQNNQuantizedOperator.test_qnn_backend_conv2d \
 TestQNNQuantizedOperator.test_qnn_backend_linear \
 TestQNNQuantizedOperator.test_qnn_backend_layer_norm \
 TestQNNQuantizedOperator.test_qnn_backend_element_wise_add \
  -v --soc_model SM8635 --host aisw-local-vm3 --device 4603496b \
  --build_folder build-android

python backends/qualcomm/tests/test_qnn_delegate.py \
  TestQNNQuantizedOperator.test_qnn_backend_16a2w_conv2d \
  TestQNNQuantizedOperator.test_qnn_backend_16a2w_linear \
  TestQNNQuantizedOperator.test_qnn_backend_16a4w_per_channel_linear \
  TestQNNQuantizedOperator.test_qnn_backend_16a4w_per_channel_linear_with_bias \
  TestQNNQuantizedOperator.test_qnn_backend_16a4w_conv2d_qat \
  TestQNNQuantizedOperator.test_qnn_backend_16a4w_block_conv2d_qat \
  -v --soc_model SM8635 --host aisw-local-vm3 --device 4603496b \
  --build_folder build-android

python backends/qualcomm/tests/test_qnn_delegate.py   TestQNNQuantizedUtils -v   --soc_model SM8635   --host aisw-local-vm3   --device 4603496b   --build_folder build-android

@pytorch-bot

pytorch-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 4 New Failures

As of commit 1bec087 with merge base 843f77e (image):

NEW FAILURES - The following jobs have failed:

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 Sep 3, 2026
@qti-horodnic

Copy link
Copy Markdown
Contributor Author

@pytorchbot label "release notes: qualcomm"

@pytorch-bot pytorch-bot Bot added the release notes: qualcomm Changes to the Qualcomm backend delegate label Sep 3, 2026
psiddh pushed a commit that referenced this pull request Sep 4, 2026
### Summary

Fixed a crash on AMD hosts when PyTorch's global backend flags are
frozen.

`QnnQuantizer.__init__` calls `disable_mkldnn_on_amd()`, which assigns
`torch.backends.mkldnn.enabled = False`. PyTorch forbids that assignment
once `disable_global_flags()` has been called, which happens whenever
`torch.testing._internal.common_utils` is imported — as the Qualcomm
test suite does. The result is that constructing a quantizer on an AMD
host fails with:

```
RuntimeError: not allowed to set torch.backends.mkldnn flags after disable_global_flags;
please use flags() context manager instead
```

The assignment is now guarded, so a frozen-flags environment leaves the
existing MKLDNN setting in place instead of raising. Disabling MKLDNN is
a workaround for AMD-host crashes, not a correctness requirement, so
skipping it when the flag is locked is safe.

Note that this is a temporary workaround for an issue introduced in a
previous [pr](#22395), not a
root-cause fix, I haven't validated that this change has not broken
anything else.

### Test plan

Ran the tests mentioned in the test plan section of
#22542.
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. release notes: qualcomm Changes to the Qualcomm backend delegate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant