Qualcomm AI Engine Direct - Adding QNN backend support for diagonal core ATen op by qti-horodnic · Pull Request #20596 · pytorch/executorch · GitHub
Skip to content

Qualcomm AI Engine Direct - Adding QNN backend support for diagonal core ATen op#20596

Merged
psiddh merged 1 commit into
pytorch:mainfrom
CodeLinaro:diagonal
Jul 2, 2026
Merged

Qualcomm AI Engine Direct - Adding QNN backend support for diagonal core ATen op#20596
psiddh merged 1 commit into
pytorch:mainfrom
CodeLinaro:diagonal

Conversation

@qti-horodnic

Copy link
Copy Markdown
Contributor

Summary

Added support for the core ATen op diagonal using a decomposition pass and the permute, view, arange, index_select ops by:

  1. Permute input so dim1 and dim2 are the last two dimensions.
  2. Reshape (view) to flatten the last two dims: [..., M*N].
  3. Compute flat diagonal indices via arange(start, end, stride).
  4. Use index_select on the last dim with the computed indices.

Also made a small update to the new_op_development skill.

Test plan

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

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

@pytorch-bot

pytorch-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown

@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 Jun 29, 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 Jun 29, 2026
@psiddh

psiddh commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

@claude review this PR

@claude

claude Bot commented Jul 2, 2026

Copy link
Copy Markdown

@psiddh psiddh merged commit 7f1cf77 into pytorch:main Jul 2, 2026
189 of 192 checks passed
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.

2 participants