Skip to content

Qualcomm AI Engine Direct - Adding QNN backend support for reflection_pad1/2d core ATen ops#18963

Merged
abhinaykukkadapu merged 1 commit intopytorch:mainfrom
CodeLinaro:reflection_pad
Apr 20, 2026
Merged

Qualcomm AI Engine Direct - Adding QNN backend support for reflection_pad1/2d core ATen ops#18963
abhinaykukkadapu merged 1 commit intopytorch:mainfrom
CodeLinaro:reflection_pad

Conversation

@qti-horodnic
Copy link
Copy Markdown
Contributor

Summary

Added support for the aten ops reflection_pad1d and reflection_pad2d. Both ops use the QNN pad op using mode=reflect with a decomposition during to_edge and extra padding in the 2d case. The op_pad builder was extended to handle these ops.

Note that we cannot currently support reflection_pad3d easily, because the input rank for MIRROR_REFLECT is constrained to <5 for the QNN op. We can support it by decomposing the op into 2d slices, but that seems complicated and bug-prone, so I just added implementation for the 1d and 2d reflection_pad ops for now.

Test plan

python backends/qualcomm/tests/test_qnn_delegate.py -k TestQNNQuantizedOperator.test_qnn_backend_reflection_pad1d --model SM8750 --host aisw-vm19-labsd --device abf5cb1 --build_folder build-android
python backends/qualcomm/tests/test_qnn_delegate.py -k TestQNNFloatingPointOperator.test_qnn_backend_reflection_pad1d --model SM8750 --host aisw-vm19-labsd --device abf5cb1 --build_folder build-android
python backends/qualcomm/tests/test_qnn_delegate.py -k TestQNNQuantizedOperator.test_qnn_backend_reflection_pad2d --model SM8750 --host aisw-vm19-labsd --device abf5cb1 --build_folder build-android
python backends/qualcomm/tests/test_qnn_delegate.py -k TestQNNFloatingPointOperator.test_qnn_backend_reflection_pad2d --model SM8750 --host aisw-vm19-labsd --device abf5cb1 --build_folder build-android

Also ran the existing tests for the pad op to make sure nothing was broken with the existing implementation:

python backends/qualcomm/tests/test_qnn_delegate.py -k TestQNNQuantizedOperator.test_qnn_backend_pad --model SM8750 --host aisw-vm19-labsd --device abf5cb1 --build_folder build-android
python backends/qualcomm/tests/test_qnn_delegate.py -k TestQNNFloatingPointOperator.test_qnn_backend_pad --model SM8750 --host aisw-vm19-labsd --device abf5cb1 --build_folder build-android

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Apr 17, 2026

🔗 Helpful Links

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

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

⏳ 33 Pending, 1 Unrelated Failure

As of commit 8b7a7bd with merge base 401ea8e (image):

FLAKY - The following job failed but was likely due to flakiness present on trunk:

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 Apr 17, 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 Apr 17, 2026
@abhinaykukkadapu
Copy link
Copy Markdown
Contributor

Thanks for adding support.

Comment thread backends/qualcomm/_passes/decompose_pad.py
Comment thread backends/qualcomm/quantizer/annotators/lpai_rules.py
@abhinaykukkadapu abhinaykukkadapu merged commit 8ed6e85 into pytorch:main Apr 20, 2026
154 of 161 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