Qualcomm AI Engine Direct - Move QCOM_AXIS_ORDER pop into LayoutTransform pass - #21932
Qualcomm AI Engine Direct - Move QCOM_AXIS_ORDER pop into LayoutTransform pass#21932paul1106 wants to merge 2 commits into
Conversation
…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.
🔗 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.
|
|
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.
…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
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