Skip to content

Qualcomm AI Engine Direct - Adding QNN backend support for the sort core ATen op#21386

Open
qti-horodnic wants to merge 1 commit into
pytorch:mainfrom
CodeLinaro:sort
Open

Qualcomm AI Engine Direct - Adding QNN backend support for the sort core ATen op#21386
qti-horodnic wants to merge 1 commit into
pytorch:mainfrom
CodeLinaro:sort

Conversation

@qti-horodnic

@qti-horodnic qti-horodnic commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Added support for the aten.sort core ATen op for QNN HTP backend.
Implements aten.sort.default delegation to QNN HTP by reusing the existing TopK op with k = dim_size. Supports both ascending and descending sort order.

Note that this op faces the same limitations as the existing TopK op:

  • Only supports sorting along the last dimension (QNN constraint).
  • Sort indices are output as int32; consuming them with gather in quantized models may cause dtype mismatches. Added a floating point sort_and_index test for this use-case.

Test plan

pytest backends/qualcomm/tests/rework/htp/op/v68/test.py -k "test_sort"


python backends/qualcomm/tests/test_qnn_delegate.py TestQNNQuantizedOperator.test_qnn_backend_sort --soc_model SM8750 --host aisw-vm15-labsd --device 545ee4aa --build_folder build-android

python backends/qualcomm/tests/test_qnn_delegate.py TestQNNFloatingPointOperator.test_qnn_backend_sort --soc_model SM8750 --host aisw-vm15-labsd --device 545ee4aa --build_folder build-android

python backends/qualcomm/tests/test_qnn_delegate.py TestQNNFloatingPointOperator.test_qnn_backend_sort_and_index --soc_model SM8750 --host aisw-vm15-labsd --device 545ee4aa --build_folder build-android

@pytorch-bot

pytorch-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⚠️ 12 Awaiting Approval

As of commit b07b564 with merge base ff0f92e (image):

AWAITING APPROVAL - The following workflows need approval before CI can run:

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 Jul 24, 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 Jul 24, 2026
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