Skip to content

Qualcomm AI Engine Direct - Keep the selected element when removing a 0D select - #24078

Closed
msluszniak wants to merge 1 commit into
pytorch:mainfrom
msluszniak:ms/qnn-remove-0d-select-keeps-element
Closed

msluszniak wants to merge 1 commit into
pytorch:mainfrom
msluszniak:ms/qnn-remove-0d-select-keeps-element

Conversation

@msluszniak

Copy link
Copy Markdown
Contributor

Summary

Remove0DTensor replaced a 0D select with its whole source, which is only right for a 1-element source: y + x[1] became y + x, and torch.full(shape, t[i]) (YOLO26's anchor grid) became a copy of all of t. It now keeps the selected element as a 1-element slice_copy.

Test plan

New test_qnn_backend_select_element (FP and quantized) fails on main and passes here (x86 simulator); the Remove0DTensor rework test now checks the slice. test_passes.py, rework/passes/test.py and the full TestQNNFloatingPointOperator / TestQNNQuantizedOperator / TestQNNFloatingPointModel suites give the same results as main.

cc @cccclai @winskuo-quic @shewu-quic @haowhsu-quic @DannyYuyang-quic @cbilgin @abhinaykukkadapu @psiddh @nil-is-all

… 0D select

Remove0DTensor replaced a 0D select with its whole source, which is only right for a
1-element source: y + x[1] became y + x, and torch.full(shape, t[i]) became a copy of
all of t (lowering then failed with "expand: ... length 3 -> 1"). A 1-element slice of
the selected element replaces it instead.
@pytorch-bot

pytorch-bot Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 2 New Failures, 2 Unclassified Failures

As of commit 9641725 with merge base e6cfbf8 (image):

NEW FAILURES - The following jobs have failed:

UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:

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

@msluszniak
msluszniak requested a review from psiddh as a code owner October 22, 2026 09:24
@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 Oct 22, 2026
@github-actions

Copy link
Copy Markdown

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.

msluszniak added a commit to software-mansion-labs/executorch that referenced this pull request Oct 22, 2026
… 0D select

Remove0DTensor replaced a 0D select with its whole source, which is only right for a
1-element source: y + x[1] became y + x, and torch.full(shape, t[i]) became a copy of
all of t (lowering then failed with "expand: ... length 3 -> 1"). A 1-element slice of
the selected element replaces it instead.

Backport of pytorch/executorch#24078. 1.4.1 has no rework pass tests.
@executorch-triage executorch-triage Bot added the community: contribution PRs coming from community (excluding hardware partners) label Oct 22, 2026
@nil-is-all nil-is-all added partner: qualcomm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Qualcomm module: qnn Issues related to Qualcomm's QNN delegate and code under backends/qualcomm/ labels Oct 23, 2026
@nil-is-all

nil-is-all commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

@msluszniak

Copy link
Copy Markdown
Contributor Author

Closing: superseded by #24222, which fixes the same wrong output in Remove0DTensor by only removing a 0D select whose source has one element.

@msluszniak msluszniak closed this Oct 30, 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. community: contribution PRs coming from community (excluding hardware partners) module: qnn Issues related to Qualcomm's QNN delegate and code under backends/qualcomm/ partner: qualcomm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Qualcomm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants