Skip to content

Conversation

mcr229
Copy link
Contributor

@mcr229 mcr229 commented Mar 20, 2025

Stack from ghstack (oldest at bottom):

There was a slight bug i found when lowering with:

XnnpackDynamicallyQuantizedPartitioner --> XnnpackPartitioner. The issue arrises because the second time we partition, delegation tags from the previous partitioner still exist. Specifically they exist on the getitem node because the metadata was propagated.

See:
https://github.com/pytorch/pytorch/blob/main/torch/fx/passes/utils/fuser_utils.py#L235

Since the getitem nodes created in by the XnnpackDynamicallyQuantizedPartitioner still have the delegation tags, they sneak into partitions from XnnpackPartitioner. This shouldn't happen because delegation tags from previous Partitioner should not exist after the previous lowering.

We update the code in to_backend here to erase all the "delegation_tags" from node.meta after we've performed all _partition_and_lower

Differential Revision: D71518362

There was a slight bug i found when lowering with:

XnnpackDynamicallyQuantizedPartitioner --> XnnpackPartitioner. The issue arrises because the second time we partition, delegation tags from the previous partitioner still exist. Specifically they exist on the getitem node because the metadata was propagated.

See:
https://github.com/pytorch/pytorch/blob/main/torch/fx/passes/utils/fuser_utils.py#L235

Since the getitem nodes created in by the XnnpackDynamicallyQuantizedPartitioner still have the delegation tags, they sneak into partitions from XnnpackPartitioner. This shouldn't happen because delegation tags from previous Partitioner should not exist after the previous lowering.

We update the code in to_backend here to erase all the "delegation_tags" from node.meta after we've performed all `_partition_and_lower`

Differential Revision: [D71518362](https://our.internmc.facebook.com/intern/diff/D71518362/)

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Mar 20, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit f372d4d with merge base 1300cda (image):

NEW FAILURE - The following job has failed:

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

@facebook-github-bot facebook-github-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 Mar 20, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D71518362

Comment on lines 407 to 408
if "delegation_tag" in node.meta:
del node.meta["delegation_tag"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if "delegation_tag" in node.meta:
del node.meta["delegation_tag"]
node.meta.pop("delegation_tag", None)

Copy link
Contributor

@cccclai cccclai left a comment

Choose a reason for hiding this comment

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

Thanks, just a minor comment

There was a slight bug i found when lowering with:

XnnpackDynamicallyQuantizedPartitioner --> XnnpackPartitioner. The issue arrises because the second time we partition, delegation tags from the previous partitioner still exist. Specifically they exist on the getitem node because the metadata was propagated.

See:
https://github.com/pytorch/pytorch/blob/main/torch/fx/passes/utils/fuser_utils.py#L235

Since the getitem nodes created in by the XnnpackDynamicallyQuantizedPartitioner still have the delegation tags, they sneak into partitions from XnnpackPartitioner. This shouldn't happen because delegation tags from previous Partitioner should not exist after the previous lowering.

We update the code in to_backend here to erase all the "delegation_tags" from node.meta after we've performed all `_partition_and_lower`

Differential Revision: [D71518362](https://our.internmc.facebook.com/intern/diff/D71518362/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D71518362

@facebook-github-bot facebook-github-bot merged commit 6f675f3 into gh/mcr229/15/base Mar 21, 2025
79 of 82 checks passed
@facebook-github-bot facebook-github-bot deleted the gh/mcr229/15/head branch March 21, 2025 18:04
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. fb-exported topic: not user facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants