Skip to content

[ET-VK][runtime] Add prepack cache to avoid duplicate weight prepacking#18390

Merged
SS-JIA merged 1 commit into
mainfrom
ssj_manual_merge
Mar 21, 2026
Merged

[ET-VK][runtime] Add prepack cache to avoid duplicate weight prepacking#18390
SS-JIA merged 1 commit into
mainfrom
ssj_manual_merge

Conversation

@SS-JIA

@SS-JIA SS-JIA commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Pull Request resolved: #18361

When embedding and linear ops share tied weights and both use the same prepacking function (prepack_quantized_linear_weight), the weight gets prepacked twice, wasting GPU memory. Add a cache to ComputeGraph keyed by (input ValueRef, kernel name) that returns the already-prepacked tensor on cache hit, avoiding the duplicate allocation. ghstack-source-id: 355397958
@exported-using-ghexport

Differential Revision: D97430801

Pull Request resolved: #18361

When embedding and linear ops share tied weights and both use the same
prepacking function (prepack_quantized_linear_weight), the weight gets
prepacked twice, wasting GPU memory. Add a cache to ComputeGraph keyed
by (input ValueRef, kernel name) that returns the already-prepacked
tensor on cache hit, avoiding the duplicate allocation.
ghstack-source-id: 355397958
@exported-using-ghexport

Differential Revision: [D97430801](https://our.internmc.facebook.com/intern/diff/D97430801/)
@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 Mar 20, 2026
@pytorch-bot

pytorch-bot Bot commented Mar 20, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 1 New Failure, 8 Pending

As of commit 7e6f13a with merge base 93821ca (image):

NEW FAILURE - The following job has failed:

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

@github-actions

Copy link
Copy Markdown

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.

@SS-JIA SS-JIA merged commit 8764038 into main Mar 21, 2026
140 of 146 checks passed
@SS-JIA SS-JIA deleted the ssj_manual_merge branch March 21, 2026 01:28
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.

2 participants