Skip to content

Commit 8f5fd59

Browse files
committed
editorial
1 parent 202342f commit 8f5fd59

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

recipes_source/torch_compile_caching_configuration_tutorial.rst

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Compile Time Caching Configurations
1+
Compile Time Caching Configuration
22
=========================================================
33
**Authors:** `Oguz Ulgen <https://github.com/oulgen>`_ and `Sam Larsen <https://github.com/masnesral>`_
44

@@ -27,17 +27,17 @@ Inductor Cache Settings
2727
Most of these caches are in-memory, only used within the same process, and are transparent to the user. An exception is caches that store compiled FX graphs (``FXGraphCache``, ``AOTAutogradCache``). These caches allow Inductor to avoid recompilation across process boundaries when it encounters the same graph with the same Tensor input shapes (and the same configuration). The default implementation stores compiled artifacts in the system temp directory. An optional feature also supports sharing those artifacts within a cluster by storing them in a Redis database.
2828

2929
There are a few settings relevant to caching and to FX graph caching in particular.
30-
The settings are accessible via environment variables listed below or can be hard-coded in Inductor’s config file.
30+
The settings are accessible via environment variables listed below or can be hard-coded in the Inductor’s config file.
3131

3232
TORCHINDUCTOR_FX_GRAPH_CACHE
3333
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34-
This setting enables the local FX graph cache feature, i.e., by storing artifacts in the host’s temp directory. ``1`` enables, and any other value disables it. By default, the disk location is per username, but users can enable sharing across usernames by specifying ``TORCHINDUCTOR_CACHE_DIR`` (below).
34+
This setting enables the local FX graph cache feature, which stores artifacts in the host’s temp directory. Setting it to ``1`` enables the feature while any other value disables it. By default, the disk location is per username, but users can enable sharing across usernames by specifying ``TORCHINDUCTOR_CACHE_DIR`` (below).
3535

3636
TORCHINDUCTOR_AUTOGRAD_CACHE
3737
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38-
This setting extends FXGraphCache to store cached results at the AOTAutograd level, instead of at the Inductor level. ``1`` enables, and any other value disables it.
38+
This setting extends ``FXGraphCache`` to store cached results at the ``AOTAutograd`` level, rather than at the Inductor level. Setting it to ``1`` enables this feature, while any other value disables it.
3939
By default, the disk location is per username, but users can enable sharing across usernames by specifying ``TORCHINDUCTOR_CACHE_DIR`` (below).
40-
`TORCHINDUCTOR_AUTOGRAD_CACHE` requires `TORCHINDUCTOR_FX_GRAPH_CACHE` to work. The same cache dir stores cache entries for ``AOTAutogradCache`` (under `{TORCHINDUCTOR_CACHE_DIR}/aotautograd`) and ``FXGraphCache`` (under `{TORCHINDUCTOR_CACHE_DIR}/fxgraph`).
40+
``TORCHINDUCTOR_AUTOGRAD_CACHE`` requires ``TORCHINDUCTOR_FX_GRAPH_CACHE`` to work. The same cache dir stores cache entries for ``AOTAutogradCache`` (under ``{TORCHINDUCTOR_CACHE_DIR}/aotautograd``) and ``FXGraphCache`` (under ``{TORCHINDUCTOR_CACHE_DIR}/fxgraph``).
4141

4242
TORCHINDUCTOR_CACHE_DIR
4343
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -52,19 +52,21 @@ This setting enables the remote FX graph cache feature. The current implementati
5252
``TORCHINDUCTOR_REDIS_HOST`` (defaults to ``localhost``)
5353
``TORCHINDUCTOR_REDIS_PORT`` (defaults to ``6379``)
5454

55-
Note that if Inductor locates a remote cache entry, it stores the compiled artifact in the local on-disk cache; that local artifact would be served on subsequent runs on the same machine.
55+
.. note::
56+
57+
Note that if Inductor locates a remote cache entry, it stores the compiled artifact in the local on-disk cache; that local artifact would be served on subsequent runs on the same machine.
5658

5759
TORCHINDUCTOR_AUTOGRAD_REMOTE_CACHE
5860
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59-
Like ``TORCHINDUCTOR_FX_GRAPH_REMOTE_CACHE``, this setting enables the remote ``AOTAutogradCache`` feature. The current implementation uses Redis. ``1`` enables caching, and any other value disables it. The following environment variables configure the host and port of the ``Redis`` server:
60-
``TORCHINDUCTOR_REDIS_HOST`` (defaults to ``localhost``)
61-
``TORCHINDUCTOR_REDIS_PORT`` (defaults to ``6379``)
61+
Similar to ``TORCHINDUCTOR_FX_GRAPH_REMOTE_CACHE``, this setting enables the remote ``AOTAutogradCache`` feature. The current implementation uses Redis. Setting it to ``1`` enables caching, while any other value disables it. The following environment variables are used to configure the host and port of the ``Redis`` server:
62+
* ``TORCHINDUCTOR_REDIS_HOST`` (defaults to ``localhost``)
63+
* ``TORCHINDUCTOR_REDIS_PORT`` (defaults to ``6379``)
6264

63-
`TORCHINDUCTOR_AUTOGRAD_REMOTE_CACHE`` depends on ``TORCHINDUCTOR_FX_GRAPH_REMOTE_CACHE`` to be enabled to work. The same Redis server can store both AOTAutograd and FXGraph cache results.
65+
`TORCHINDUCTOR_AUTOGRAD_REMOTE_CACHE`` requires ``TORCHINDUCTOR_FX_GRAPH_REMOTE_CACHE`` to be enabled in order to function. The same Redis server can be used to store both AOTAutograd and FXGraph cache results.
6466

6567
TORCHINDUCTOR_AUTOTUNE_REMOTE_CACHE
6668
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67-
This setting enables a remote cache for ``TorchInductor``’s autotuner. As with the remote FX graph cache, the current implementation uses Redis. ``1`` enables caching, and any other value disables it. The same host / port environment variables listed above apply to this cache.
69+
This setting enables a remote cache for ``TorchInductor``’s autotuner. Similar to remote FX graph cache, the current implementation uses Redis. Setting it to ``1`` enables caching, while any other value disables it. The same host / port environment variables mentioned above apply to this cache.
6870

6971
TORCHINDUCTOR_FORCE_DISABLE_CACHES
7072
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

recipes_source/torch_compile_caching_tutorial.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ Caching Offerings
3535

3636
It is important to note that caching validates that the cache artifacts are used with the same PyTorch and Triton version, as well as, same GPU when device is set to be cuda.
3737

38-
``torch.compile`` end-to-end caching (a.k.a. ``Mega-Cache``)
38+
``torch.compile`` end-to-end caching (``Mega-Cache``)
3939
------------------------------------------------------------
4040

41-
End to end caching, from here onwards referred to Mega-Cache, is the ideal solution for users looking for a portable caching solution that can be stored in a database and can later be fetched possibly on a separate machine.
41+
End to end caching, from here onwards referred to ``Mega-Cache``, is the ideal solution for users looking for a portable caching solution that can be stored in a database and can later be fetched possibly on a separate machine.
4242

43-
``Mega-Cache`` provides two compiler APIs
43+
``Mega-Cache`` provides two compiler APIs:
4444

4545
* ``torch.compiler.save_cache_artifacts()``
4646
* ``torch.compiler.load_cache_artifacts()``
4747

4848
The intended use case is after compiling and executing a model, the user calls ``torch.compiler.save_cache_artifacts()`` which will return the compiler artifacts in a portable form. Later, potentially on a different machine, the user may call ``torch.compiler.load_cache_artifacts()`` with these artifacts to pre-populate the ``torch.compile`` caches in order to jump-start their cache.
4949

50-
An example to this is as follows. First, compile and save the cache artifacts.
50+
Consider the following example. First, compile and save the cache artifacts.
5151

5252
.. code-block:: python
5353
@@ -64,7 +64,7 @@ An example to this is as follows. First, compile and save the cache artifacts.
6464
6565
# Now, potentially store these artifacts in a database
6666
67-
Later, the user can jump-start their cache by the following.
67+
Later, you can jump-start the cache by the following:
6868

6969
.. code-block:: python
7070
@@ -80,21 +80,21 @@ This operation populates all the modular caches that will be discussed in the ne
8080
Modular caching of ``TorchDynamo``, ``TorchInductor``, and ``Triton``
8181
-----------------------------------------------------------
8282

83-
The above described MegaCache is also compromised of individual components that can be used without any user intervention. By default, PyTorch Compiler comes with local on-disk caches for ``TorchDynamo``, ``TorchInductor``, and ``Triton``. These caches are as following.
83+
The aforementioned ``Mega-Cache`` is composed of individual components that can be used without any user intervention. By default, PyTorch Compiler comes with local on-disk caches for ``TorchDynamo``, ``TorchInductor``, and ``Triton``. These caches include:
8484

85-
* ``FXGraphCache``: cache of graph-based IR components used in compilation
86-
* ``Triton Cache``: cache of Triton-compilation results (``cubin`` files generated by ``Triton`` as well as other caching artifacts)
87-
* ``InductorCache``: bundling of ``FXGraphCache`` and ``Triton`` cache
88-
* ``AOTAutogradCache``: caching of joint graph artifacts
89-
* ``PGO-cache``: cache of dynamic shape decisions to reduce number of recompilations
85+
* ``FXGraphCache``: A cache of graph-based IR components used in compilation.
86+
* ``TritonCache``: A cache of Triton-compilation results, including ``cubin`` files generated by ``Triton`` and other caching artifacts.
87+
* ``InductorCache``: A bundle of ``FXGraphCache`` and ``Triton`` cache.
88+
* ``AOTAutogradCache``: A cache of joint graph artifacts.
89+
* ``PGO-cache``: A cache of dynamic shape decisions to reduce number of recompilations.
9090

9191
All these cache artifacts are written to ``TORCHINDUCTOR_CACHE_DIR`` which by default will look like ``/tmp/torchinductor_myusername``.
9292

9393

9494
Remote Caching
9595
----------------
9696

97-
We also provide a remote caching option for users who would like to take advantage of a ``Redis`` based cache. Check out `Compile Time Caching Configurations <https://pytorch.org/tutorials/recipes/torch_compile_caching_configuration_tutorial.html>`__ to learn more about how to enable the ``Redis`` based caching.
97+
We also provide a remote caching option for users who would like to take advantage of a Redis based cache. Check out `Compile Time Caching Configurations <https://pytorch.org/tutorials/recipes/torch_compile_caching_configuration_tutorial.html>`__ to learn more about how to enable the Redis-based caching.
9898

9999

100100
Conclusion

0 commit comments

Comments
 (0)