Skip to content

[torchao][pt2e] Make prepare and convert faster by caching#162550

Closed
navsud wants to merge 1 commit intopytorch:mainfrom
navsud:export-D82073679
Closed

[torchao][pt2e] Make prepare and convert faster by caching#162550
navsud wants to merge 1 commit intopytorch:mainfrom
navsud:export-D82073679

Conversation

@navsud
Copy link
Contributor

@navsud navsud commented Sep 10, 2025

Summary: D79674759 tried to fix the expensive prepare and convert steps, as assert_and_get_unique_device was called multiple times. This change fixes that issue by using functools.cache decorator.

Test Plan:
Verified on llm export to QNN.
LLM Quantization prepare time of ~20min reduced to ~3min.

Rollback Plan:

Differential Revision: D82073679

cc @ezyang @SherlockNoMad @EikanWang @jgong5 @wenzhe-nrv

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 10, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: navsud / name: Naveen Suda (09e2172)

@pytorch-bot
Copy link

pytorch-bot bot commented Sep 10, 2025

🔗 Helpful Links

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

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

⏳ No Failures, 1 Pending

As of commit 09e2172 with merge base 36338fc (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
Copy link
Contributor

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

Copy link
Contributor

@andrewor14 andrewor14 left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Sep 10, 2025
@andrewor14 andrewor14 added the release notes: quantization release notes category label Sep 10, 2025
Summary:
D79674759 tried to fix the expensive prepare and convert steps, as `assert_and_get_unique_device` was called multiple times. This change fixes that issue by using `functools.cache` decorator.

bypass-github-export-checks

Test Plan:
Verified on llm export to QNN.
Prepare time of ~20min reduced to ~3min.

Rollback Plan:

Reviewed By: andrewor14

Differential Revision: D82073679
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

@pytorchbot merge

(Initiating merge automatically since Phabricator Diff has merged)

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

andrewor14 added a commit to pytorch/ao that referenced this pull request Sep 11, 2025
**Summary:** This is the torchao version of pytorch/pytorch#162550
by @navsud. Including the PR description here again:

D79674759 tried to fix the expensive prepare and convert steps,
as assert_and_get_unique_device was called multiple times.
This change fixes that issue by using functools.cache decorator.

**Test Plan:**
Verified on llm export to QNN.
LLM Quantization prepare time of ~20min reduced to ~3min.
andrewor14 added a commit to pytorch/ao that referenced this pull request Sep 11, 2025
**Summary:** This is the torchao version of pytorch/pytorch#162550
by @navsud. Including the PR description here again:

D79674759 tried to fix the expensive prepare and convert steps,
as assert_and_get_unique_device was called multiple times.
This change fixes that issue by using functools.cache decorator.

**Test Plan:**
Verified on llm export to QNN.
LLM Quantization prepare time of ~20min reduced to ~3min.
markc-614 pushed a commit to markc-614/pytorch that referenced this pull request Sep 17, 2025
…62550)

Summary: D79674759 tried to fix the expensive prepare and convert steps, as `assert_and_get_unique_device` was called multiple times. This change fixes that issue by using `functools.cache` decorator.

Test Plan:
Verified on llm export to QNN.
LLM Quantization prepare time of ~20min reduced to ~3min.

Rollback Plan:

Differential Revision: D82073679

Pull Request resolved: pytorch#162550
Approved by: https://github.com/andrewor14
mansiag05 pushed a commit to mansiag05/pytorch that referenced this pull request Sep 22, 2025
…62550)

Summary: D79674759 tried to fix the expensive prepare and convert steps, as `assert_and_get_unique_device` was called multiple times. This change fixes that issue by using `functools.cache` decorator.

Test Plan:
Verified on llm export to QNN.
LLM Quantization prepare time of ~20min reduced to ~3min.

Rollback Plan:

Differential Revision: D82073679

Pull Request resolved: pytorch#162550
Approved by: https://github.com/andrewor14
cleonard530 pushed a commit to cleonard530/pytorch that referenced this pull request Sep 22, 2025
…62550)

Summary: D79674759 tried to fix the expensive prepare and convert steps, as `assert_and_get_unique_device` was called multiple times. This change fixes that issue by using `functools.cache` decorator.

Test Plan:
Verified on llm export to QNN.
LLM Quantization prepare time of ~20min reduced to ~3min.

Rollback Plan:

Differential Revision: D82073679

Pull Request resolved: pytorch#162550
Approved by: https://github.com/andrewor14
dsashidh pushed a commit to dsashidh/pytorch that referenced this pull request Sep 26, 2025
…62550)

Summary: D79674759 tried to fix the expensive prepare and convert steps, as `assert_and_get_unique_device` was called multiple times. This change fixes that issue by using `functools.cache` decorator.

Test Plan:
Verified on llm export to QNN.
LLM Quantization prepare time of ~20min reduced to ~3min.

Rollback Plan:

Differential Revision: D82073679

Pull Request resolved: pytorch#162550
Approved by: https://github.com/andrewor14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request fb-exported fx Merged release notes: quantization release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants