Skip to content

Add pass to tag external constants for delegates #10328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 23, 2025

Conversation

lucylq
Copy link
Contributor

@lucylq lucylq commented Apr 21, 2025

Stack from ghstack (oldest at bottom):

generate pte+ptd file for a delegated linear example

Differential Revision: D73281924

generate pte+ptd file for a delegated linear example

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

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Apr 21, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit 6974372 with merge base 334af4a (image):

NEW FAILURE - The following job has failed:

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

lucylq added a commit that referenced this pull request Apr 21, 2025
generate pte+ptd file for a delegated linear example

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

ghstack-source-id: 279347167
Pull Request resolved: #10328
@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 Apr 21, 2025
@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor

@JacobSzwejbka JacobSzwejbka left a comment

Choose a reason for hiding this comment

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

Does the main schema support named data?

@@ -74,3 +76,30 @@ def external_mutable_weights_pass(
node.meta["constant_tag"] = "_default_external_constant"
mutated = True
return PassResult(gm, mutated)


def xnnpack_external_constants_pass(
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this xnnpack specific.

Copy link
Contributor Author

@lucylq lucylq Apr 21, 2025

Choose a reason for hiding this comment

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

Hmn, it doesn't have to be xnnpack-specific but I think it has to be delegate-specific; if we use the same tag as portable ('constant_tag'), then constants that are not lowered will be tagged and error out in the emitter. eg. for linear, we have weight, bias and arg0 as constants. weight and bias are lowered, but arg0 makes it through to the emitter and errors out there.

I'm not sure if there will be similar issues with other delegates, as xnnpack will tag arg0 when it isn't lowered, so made it xnnpack-specific to be safe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cc @mcr229 maybe worthwhile to not tag arg0 (by checking node name for linear/conv) and make the pass more generic?

generate pte+ptd file for a delegated linear example

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

[ghstack-poisoned]
lucylq added a commit that referenced this pull request Apr 21, 2025
Pull Request resolved: #10328

generate pte+ptd file for a delegated linear example
ghstack-source-id: 279382617

Differential Revision: [D73281924](https://our.internmc.facebook.com/intern/diff/D73281924/)
@facebook-github-bot
Copy link
Contributor

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

generate pte+ptd file for a delegated linear example

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

[ghstack-poisoned]
lucylq added a commit that referenced this pull request Apr 21, 2025
Pull Request resolved: #10328

generate pte+ptd file for a delegated linear example
ghstack-source-id: 279396874

Differential Revision: [D73281924](https://our.internmc.facebook.com/intern/diff/D73281924/)
@facebook-github-bot
Copy link
Contributor

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

@lucylq
Copy link
Contributor Author

lucylq commented Apr 21, 2025

Does the main schema support named data?

Yes it does now with weight sharing: https://github.com/pytorch/executorch/blob/main/schema/program.fbs#L437

generate pte+ptd file for a delegated linear example

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

[ghstack-poisoned]
lucylq added a commit that referenced this pull request Apr 21, 2025
Pull Request resolved: #10328

generate pte+ptd file for a delegated linear example
ghstack-source-id: 279425325

Differential Revision: [D73281924](https://our.internmc.facebook.com/intern/diff/D73281924/)
@facebook-github-bot
Copy link
Contributor

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

generate pte+ptd file for a delegated linear example

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

[ghstack-poisoned]
lucylq added a commit that referenced this pull request Apr 21, 2025
Pull Request resolved: #10328

generate pte+ptd file for a delegated linear example
ghstack-source-id: 279426784

Differential Revision: [D73281924](https://our.internmc.facebook.com/intern/diff/D73281924/)
@facebook-github-bot
Copy link
Contributor

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

@lucylq lucylq requested a review from angelayi April 22, 2025 00:00
generate pte+ptd file for a delegated linear example

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

[ghstack-poisoned]
lucylq added a commit that referenced this pull request Apr 23, 2025
Pull Request resolved: #10328

generate pte+ptd file for a delegated linear example
ghstack-source-id: 279626429

Differential Revision: [D73281924](https://our.internmc.facebook.com/intern/diff/D73281924/)
@facebook-github-bot
Copy link
Contributor

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

generate pte+ptd file for a delegated linear example

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

[ghstack-poisoned]
lucylq added a commit that referenced this pull request Apr 23, 2025
Pull Request resolved: #10328

generate pte+ptd file for a delegated linear example
ghstack-source-id: 279823594

Differential Revision: [D73281924](https://our.internmc.facebook.com/intern/diff/D73281924/)
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot facebook-github-bot merged commit f38dbc3 into gh/lucylq/63/base Apr 23, 2025
83 of 86 checks passed
@facebook-github-bot facebook-github-bot deleted the gh/lucylq/63/head branch April 23, 2025 23:45
jackzhxng pushed a commit that referenced this pull request Apr 24, 2025
This PR was created by the merge bot to help merge the original PR into
the main branch.
ghstack PR number: #10328 by
@lucylq
^ Please use this as the source of truth for the PR details, comments,
and reviews
ghstack PR base:
https://github.com/pytorch/executorch/tree/gh/lucylq/63/base
ghstack PR head:
https://github.com/pytorch/executorch/tree/gh/lucylq/63/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/main
Merge bot PR head:
https://github.com/pytorch/executorch/tree/gh/lucylq/63/orig
@diff-train-skip-merge

Co-authored-by: lucylq <[email protected]>
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.

5 participants