Skip to content

[Group Partitioner] Optimize Speed #12844

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 3 commits into from
Jul 25, 2025
Merged

[Group Partitioner] Optimize Speed #12844

merged 3 commits into from
Jul 25, 2025

Conversation

mcr229
Copy link
Contributor

@mcr229 mcr229 commented Jul 25, 2025

We do some optimizations on the group partitioner to improve its speed. Theoretically, since we've pre-grouped some partitions already, we should be faster than the capability based partitioner. For example, if we a dynamically quantized group, this could contain

[ choose_q_params, quantize, dequantize, op, dequantize_weight, weight, bias, get_item_scale, get_item_zp]

9 nodes. In capability-based partitioner they will have to run DFS on all 9 nodes in order to group these together. Based on the hints and purpose of the group based partitioenr, we don't perform these checks and instead group all these 9 nodes, saving time by avoiding these checks. Some stats when partitioning the mobile bert model:

elpased time old partitioner: 65.3421
old_partitioner num partitions: 170


elpased time new partitioner: 5.1964
new_partitioner num partitions: 170

we see a 13x improvement in partitioning when using the group based partitioner, while still partitioning around the same number of nodes.

Differential Revision: D79020720

[ghstack-poisoned]
@mcr229
Copy link
Contributor Author

mcr229 commented Jul 25, 2025

Copy link

pytorch-bot bot commented Jul 25, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit ec7a6b5 with merge base 21c8e67 (image):
💚 Looks good so far! There are no failures yet. 💚

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 Jul 25, 2025
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@mcr229 mcr229 requested a review from leafs1 July 25, 2025 01:31
mcr229 added 2 commits July 24, 2025 22:45
[ghstack-poisoned]
[ghstack-poisoned]
@mcr229 mcr229 merged commit 66e5591 into main Jul 25, 2025
99 checks passed
@mcr229 mcr229 deleted the gh/mcr229/43/head branch July 25, 2025 20:51
mcr229 added a commit to mcr229/executorch that referenced this pull request Jul 25, 2025
ghstack-source-id: 55182c1
ghstack-comment-id: 3115642422
Pull Request resolved: pytorch#12844
@mcr229
Copy link
Contributor Author

mcr229 commented Jul 25, 2025

@mcr229 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants