Repository navigation
Qualcomm AI Engine Direct - Move QCOM_AXIS_ORDER pop into LayoutTransform pass - #21932
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21932
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 1 Unrelated FailureAs of commit e209ca4 with merge base 273cb33 ( NEW FAILURE - The following job has failed:
BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Hi @paul1106! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
This PR needs a
|
There was a problem hiding this comment.
Pull request overview
This PR relocates cleanup of the QCOM_AXIS_ORDER node metadata from QnnBackend._build_op_wrappers into the LayoutTransform pass itself (specifically when insert_permute=True), so the metadata invalidation happens next to the logic that depends on it. This prevents inherited QCOM_AXIS_ORDER tags (carried via deepcopy) from making LayoutTransform.is_transformed_node() incorrectly treat all sensitive nodes as already-processed, which would otherwise suppress permute insertion during preprocessing.
Changes:
- Remove the
QCOM_AXIS_ORDERmetadata pop frombackends/qualcomm/qnn_preprocess.pypreprocessing entrypoint. - Add a targeted
QCOM_AXIS_ORDERmetadata pop insideLayoutTransform.call()when running the permute-inserting mode (insert_permute=True).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| backends/qualcomm/qnn_preprocess.py | Removes early QCOM_AXIS_ORDER meta cleanup from _build_op_wrappers, delegating it to the pass that relies on it. |
| backends/qualcomm/_passes/layout_transform.py | Clears inherited QCOM_AXIS_ORDER tags before the main sensitive-node traversal when insert_permute=True, ensuring permute insertion logic executes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…form pass
Summary:
- The pop of QCOM_AXIS_ORDER was previously done in
QnnBackend._build_op_wrappers before calling
transform_for_preprocess_pipeline. Moving it into
LayoutTransform.call() when insert_permute=True keeps the cleanup
logic co-located with the code that depends on it.
The pop is necessary because the delegated subgraph is created via
deepcopy, which carries over the QCOM_AXIS_ORDER tags written by the
to-edge LayoutTransform run. Without clearing them, is_transformed_node()
returns True for every sensitive node in the
main for-loop, causing all traversals to be skipped and no permute
nodes to be inserted.
…es_helper The manual QCOM_AXIS_ORDER strip loop in PassPipeline.lower_preprocess_gm() was added to mirror qnn_preprocess.py. Now that the pop is handled inside LayoutTransform.call() when insert_permute=True, this block is dead code. Generated with Claude Code
f701d62 to
e209ca4
Compare
|
MetaCLA Is no longer needed, merginf |
…ransform Stack from [ghstack](https://github.com/ezyang/ghstack/tree/0.15.0) (oldest at bottom): * __->__ #23528 D123733351 (#21932) moved the `QCOM_AXIS_ORDER` pop from `QnnBackend._build_op_wrappers` into `LayoutTransform`. `test_qnn_backend_draw_graph` calls `transform_for_preprocess_pipeline` directly, so it previously never cleared the stale to-edge tags and `LayoutTransform` inserted no permutes. Its goldens captured that graph, which real lowering never produces. The test now sees the same graph as `preprocess`: an NCHW->NHWC `permute_copy` feeding both convs, the graph input at its original `[1, 32, 28, 28]` shape, and (quantized only) an NHWC->NCHW `permute_copy` before the output dequantize. Update both goldens to match. Authored with Claude Code. Differential Revision: D123874998 Pull Request resolved: #23528
…ransform D123733351 (#21932) moved the `QCOM_AXIS_ORDER` pop from `QnnBackend._build_op_wrappers` into `LayoutTransform`. `test_qnn_backend_draw_graph` calls `transform_for_preprocess_pipeline` directly, so it previously never cleared the stale to-edge tags and `LayoutTransform` inserted no permutes. Its goldens captured that graph, which real lowering never produces. The test now sees the same graph as `preprocess`: an NCHW->NHWC `permute_copy` feeding both convs, the graph input at its original `[1, 32, 28, 28]` shape, and (quantized only) an NHWC->NCHW `permute_copy` before the output dequantize. Update both goldens to match. Authored with Claude Code. Differential Revision: [D123874998](https://our.internmc.facebook.com/intern/diff/D123874998/) ghstack-source-id: 443606972 Pull-Request: #23528
Context
This PR supersedes #21630.
The original PR was closed due to CLA issues.
This new PR is created from a new branch to track CLA status and continue the review process.
Please refer to #21630 for previous review comments and discussion.
Summary:
The pop of QCOM_AXIS_ORDER was previously done in
QnnBackend._build_op_wrappers before calling
transform_for_preprocess_pipeline. Moving it into
LayoutTransform.call() when insert_permute=True keeps the cleanup
logic co-located with the code that depends on it.
The pop is necessary because the delegated subgraph is created via
deepcopy, which carries over the QCOM_AXIS_ORDER tags written by the
to-edge LayoutTransform run. Without clearing them, is_transformed_node()
returns True for every sensitive node in the
main for-loop, causing all traversals to be skipped and no permute
nodes to be inserted.
Test plan
cc @cccclai @winskuo-quic @shewu-quic @haowhsu-quic @DannyYuyang-quic @cbilgin @abhinaykukkadapu @psiddh