-
Notifications
You must be signed in to change notification settings - Fork 26.2k
[inductor][caching] applying PersistentMemoizer to _should_pad #170256
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
Open
nmacchioni
wants to merge
5
commits into
pytorch:main
Choose a base branch
from
nmacchioni:export-D88999540
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/170256
Note: Links to docs will display an error until the docs builds have been completed. ❌ 8 New Failures, 4 Cancelled Jobs, 1 Unrelated FailureAs of commit 7a4bbbe with merge base 52c7ad7 ( NEW FAILURES - The following jobs have failed:
CANCELLED JOBS - The following jobs were cancelled. Please retry:
FLAKY - The following job failed but was likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@nmacchioni has exported this pull request. If you are a Meta employee, you can view the originating Diff in D88999540. |
f744c3f to
1b88fa8
Compare
nmacchioni
added a commit
to nmacchioni/pytorch
that referenced
this pull request
Dec 12, 2025
…ch#170256) Summary: Similar to D85684098, but using the new PersistentMemoizer, one readable, and less constrictive keys (since _should_pad was refactored) Test Plan: ```buck test fbcode//mode/opt caffe2/test/inductor:caching``` Differential Revision: D88999540
1b88fa8 to
81bd47f
Compare
nmacchioni
added a commit
to nmacchioni/pytorch
that referenced
this pull request
Dec 12, 2025
…ch#170256) Summary: Similar to D85684098, but using the new PersistentMemoizer, one readable, and less constrictive keys (since _should_pad was refactored) ``` { "cache_entries": { "should_pad": { "d05c99fdf8e1a35e43ba573d1a1acfa5": { "params": { "mat1": { "shape": [ 4096, 4096 ], "stride": [ 4096, 1 ], "dtype": "torch.bfloat16" }, "mat2": { "shape": [ 4096, 4096 ], "stride": [ 4096, 1 ], "dtype": "torch.bfloat16" }, "op": "aten.mm", "input": null, "mat1_exclude_padding_time": false, "mat2_exclude_padding_time": false }, "result": false } } }, "cache_size": 1 } ``` Test Plan: ```buck test fbcode//mode/opt caffe2/test/inductor:caching``` Differential Revision: D88999540
Summary: Previously, when the interfaces were quite complex it made sense to abstract away the types that we put into the cache implementations. That way we shared complexity between interfaces and implementations. Not that the interfaces are less complex, we can move this abstraction out of the implementations. Mainly: - cache impls now take str keys and bytes values - except for the InMemoryCache, which takes Any values (with the assumption that Any is JSON-able) This also has the added benefit of making InMemoryCache memory completely human readable (whether it is human readable in a way that actually makes sense is up to the user's encoding of results) Test Plan: ```buck test fbcode//mode/opt caffe2/test/inductor:caching``` Reviewed By: aorenste Differential Revision: D88979063
…70228) Summary: Similar to the OG impls, but heavily simplified. Introduces Memoizer and PersistentMemoizer classes. Memoizer supports record, replay, and memoize functionality. Record simply caches the result of a function call. Replay checks for cached function call results and returns the cached result on hit, otherwise the function is called directly. Memoize is a combination of record and replay. Memoizer is supported by an underlying _InMemoryCacheImpl instance. PersistentMemoizer is nearly identical to Memoizer, other than also having an underlying _OnDiskCacheImpl instance such that cached results persist across program boundaries. Test Plan: ```buck test fbcode//mode/opt caffe2/test/inductor:caching``` Differential Revision: D88979804
…h#170236) Summary: tldr; added a method to dump Memoizer's memory to disk in JSON format at program exit in addition, we now include the encoded params in the cache entry (since the keys are hashes they don't provide much clues as to the origin of the entry by themself, hence why the params are now included) note: the testing for the new dump method is actually included in the subsequent diff Test Plan: ```buck test fbcode//mode/opt caffe2/test/inductor:caching``` Differential Revision: D88984165
Summary: the reverse of dump Test Plan: ```buck test fbcode//mode/opt caffe2/test/inductor:caching``` Differential Revision: D88984164
…ch#170256) Summary: Similar to D85684098, but using the new PersistentMemoizer, one readable, and less constrictive keys (since _should_pad was refactored) ``` { "cache_entries": { "should_pad": { "d05c99fdf8e1a35e43ba573d1a1acfa5": { "params": { "mat1": { "shape": [ 4096, 4096 ], "stride": [ 4096, 1 ], "dtype": "torch.bfloat16" }, "mat2": { "shape": [ 4096, 4096 ], "stride": [ 4096, 1 ], "dtype": "torch.bfloat16" }, "op": "aten.mm", "input": null, "mat1_exclude_padding_time": false, "mat2_exclude_padding_time": false }, "result": false } } }, "cache_size": 1 } ``` Test Plan: ```buck test fbcode//mode/opt caffe2/test/inductor:caching``` Reviewed By: v0i0 Differential Revision: D88999540
81bd47f to
7a4bbbe
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary: Similar to D85684098, but using the new PersistentMemoizer, one readable, and less constrictive keys (since _should_pad was refactored)
Test Plan:
buck test fbcode//mode/opt caffe2/test/inductor:cachingDifferential Revision: D88999540
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo