Skip to content

Add cache to value_and_grad_partitioned #9163

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 6 commits into from
Jun 5, 2025
Merged

Conversation

iwknow
Copy link
Contributor

@iwknow iwknow commented May 14, 2025

Add cache to value_and_grad_partitioned, which perform AOTAutograd tracing that is time consuming.
The cache is controlled by is_fn_pure. the cache key is composed of all the inputs of scan (i.e. fn, init, xs, partition_fn).

this addresses #8632

@iwknow
Copy link
Contributor Author

iwknow commented May 14, 2025

@tengyifei please review

@iwknow
Copy link
Contributor Author

iwknow commented May 16, 2025

@tengyifei a kindly ping

@tengyifei
Copy link
Collaborator

Hi @iwknow I was on vacation. I'll review this soon.

@iwknow
Copy link
Contributor Author

iwknow commented May 29, 2025

@tengyifei a kindly ping

Copy link
Collaborator

@tengyifei tengyifei left a comment

Choose a reason for hiding this comment

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

Thanks again for the contribution! Sorry it took so long -- the past few weeks were especially busy.

iwknow and others added 2 commits June 4, 2025 18:14
…`setUp()` to clear cache. 3. update `test_scan_computation_cache` test to count how many times the fn is called
@iwknow
Copy link
Contributor Author

iwknow commented Jun 4, 2025

@tengyifei updated. please review again. thanks!

@iwknow iwknow requested a review from tengyifei June 5, 2025 02:55
@tengyifei
Copy link
Collaborator

Thanks!

@tengyifei tengyifei merged commit d1ddeed into pytorch:master Jun 5, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants