Skip to content

Commit

Permalink
Introduce cache hot loading APIs (a.k.a. "Mega-cache") (#143341)
Browse files Browse the repository at this point in the history
Summary:
This PR essentially introduces two new APIs
* torch.compiler.save_cache_artifacts
* torch.compiler.load_cache_artifacts

which aim to create a mega cache experience where the user can start collecting cache artifacts, and later call the save API to fetch them. In the next attempt, the user can "hot load" the cache artifacts via the load function.

This bundling approach reduces the need to rely on porting individual files one by one, or relying on many network requests.

Note that these APIs CANNOT log to structured logging as these functions will be called before and after compilation, as opposed to during compilation. Due to this limitation, the API returns a struct that the user can log with.

X-link: pytorch/pytorch#143341
Approved by: https://github.com/jansel

Reviewed By: clee2000

Differential Revision: D67927135

Pulled By: oulgen

fbshipit-source-id: 00c4f3955bd098a61b40760a9a29cdf58caf04cf
  • Loading branch information
oulgen authored and facebook-github-bot committed Jan 8, 2025
1 parent 1e7ed46 commit 31cc1a4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions userbenchmark/dynamo/dynamobench/_dynamo/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@ def __call__(
self.graphs.append(gm)
return lookup_backend(self.backend)(gm, example_inputs)

def clear(self) -> None:
self.frame_count = 0
self.op_count = 0
self.graphs = []


# Equivalent to backend="eager", but also records graphs that
# we can assert on
Expand Down

0 comments on commit 31cc1a4

Please sign in to comment.