Skip to content

Conversation

@MartinPavella
Copy link
Collaborator

@MartinPavella MartinPavella commented Jan 7, 2026

Summary

This PR integrates the RemoveUselessOpPass edge dialect pass from the Samsung backend into the NXP backend. This feature is required to support an internal model.

Test plan

Tested internally by NXP on a private model.

cc @robert-kalmar

@pytorch-bot
Copy link

pytorch-bot bot commented Jan 7, 2026

🔗 Helpful Links

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

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

❌ 4 New Failures, 1 Unrelated Failure

As of commit 276e961 with merge base e847384 (image):

NEW FAILURES - The following jobs have failed:

UNSTABLE - The following job is marked as unstable, possibly due to flakiness 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 Jan 7, 2026
@MartinPavella MartinPavella added module: nxp Issues related to NXP Neutron NPU delegation and code under backends/nxp/ release notes: nxp Changes to the NXP Neutron backend delegate labels Jan 7, 2026
passes: list[NeutronEdgePass] = passes or [
MoveLeadingAuxiliaryOperatorIntoSeparateQDQClusterPass(),
MoveTrailingAuxiliaryOperatorIntoSeparateQDQClusterPass(),
RemoveUselessOpPass(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MartinPavella , you mentioned the RemoveUselessOpPass handled specifically the case of mean followed by the as_strided_copy, but seems it handles more "useless" op cases - https://github.com/pytorch/executorch/blob/main/backends/samsung/_passes/remove_useless_ops.py#L15

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that you mention it, I thought about it a bit more. For our use case we actually mustn't remove the other "useless ops". Since we need to run this pass before partitioning, some of the ops (like dim_order_ops._to_dim_order_copy) are not useless at all, and are actually vital in case they don't get delegated.

Therefore, I will create our own pass based on this one, to only remove the as_strided_copy for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@robert-kalmar
Copy link
Collaborator

@Jiseong-oh, we also need a pass to remove the as_strided_copy preceeded by the mean, what handled by the executorch.backends.samsung._passes.remove_useless_ops.RemoveUselessOpPass. Do you mind to reuse it in NXP backend?

@robert-kalmar
Copy link
Collaborator

@Jiseong-oh, we also need a pass to remove the as_strided_copy preceeded by the mean, what handled by the executorch.backends.samsung._passes.remove_useless_ops.RemoveUselessOpPass. Do you mind to reuse it in NXP backend?

@Jiseong-oh , based on the feedback from Martin, the question is not anymore relevant.

@robert-kalmar robert-kalmar requested review from robert-kalmar and removed request for Jiseong-oh January 8, 2026 15:33
@MartinPavella MartinPavella force-pushed the nxg01483/feature/EIEX-674-add-support-for-as_strided.copy branch from 7321573 to cf43233 Compare January 8, 2026 15:44
Copy link
Collaborator

@robert-kalmar robert-kalmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine to me.
Let the CI's finish.

@MartinPavella MartinPavella force-pushed the nxg01483/feature/EIEX-674-add-support-for-as_strided.copy branch from cf43233 to 276e961 Compare January 9, 2026 09:10
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. module: nxp Issues related to NXP Neutron NPU delegation and code under backends/nxp/ release notes: nxp Changes to the NXP Neutron backend delegate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants