Skip to content

[precompile] Settle the public docs on the capture/save/load surface - #195929

Closed
bobrenjc93 wants to merge 61 commits into
gh/bobrenjc93/1131/basefrom
gh/bobrenjc93/1131/head
Closed

bobrenjc93 wants to merge 61 commits into
gh/bobrenjc93/1131/basefrom
gh/bobrenjc93/1131/head

Conversation

@bobrenjc93

@bobrenjc93 bobrenjc93 commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

The shipped public surface is two caller-driven entry points, and this commit
settles the documentation and the torch.compiler module comment on exactly
that surface. precompile.capture(fn, *, artifact_path, cache_path, tracer=DynamoTracer(), ...) is a context manager: the caller invokes the
returned capture around their own execution, and the (python_code, cache)
artifact is written to the two paths when the block exits. The default
DynamoTracer takes several calls and produces a guarded multi-graph
artifact spanning graph breaks and recompilations; MakeFxTracer takes a
single call and produces a self-contained Python source plus an acceleration
cache. cap.save() checkpoints the on-disk artifact partway through the
caller's own loop without ending the capture, and precompile.load reloads
one.

The API reference, the user-guide walkthrough, and the module comment are
rewritten to this surface. That retires the earlier draft vocabulary the docs
still carried -- the accumulate entry point, the example_inputs calling
convention (and its 2.14 positional spelling behind a FutureWarning) and
the precompile.artifact pair accessor -- none of which the shipped code
exposes. ExampleInput belonged to that convention and nothing else
references it, so its dataclass is removed from
torch/compiler/_precompile_types.py.

Test Plan:

Docs render through the existing eval-rst blocks. Removing the unused
ExampleInput is covered by the public-bindings and precompile suites:

python test/test_public_bindings.py
python test/test_precompile.py
python test/dynamo/test_precompile_package.py

Authored with an AI assistant.

[no ci]

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot Bot added ciflow/inductor ciflow/torchtitan Run TorchTitan integration tests module: dynamo labels Sep 3, 2026
This was referenced Sep 3, 2026
[ghstack-poisoned]
bobrenjc93 added a commit that referenced this pull request Sep 8, 2026
The shipped public surface is two caller-driven entry points, and this commit
settles the documentation and the ``torch.compiler`` module comment on exactly
that surface. ``precompile.capture(fn, *, artifact_path, cache_path,
tracer=DynamoTracer(), ...)`` is a context manager: the caller invokes the
returned capture around their own execution, and the ``(python_code, cache)``
artifact is written to the two paths when the block exits. The default
``DynamoTracer`` takes several calls and produces a guarded multi-graph
artifact spanning graph breaks and recompilations; ``MakeFxTracer`` takes a
single call and produces a self-contained Python source plus an acceleration
cache. ``cap.save()`` checkpoints the on-disk artifact partway through the
caller's own loop without ending the capture, and ``precompile.load`` reloads
one.

The API reference, the user-guide walkthrough, and the module comment are
rewritten to this surface. That retires the earlier draft vocabulary the docs
still carried -- the ``accumulate`` entry point, the ``example_inputs`` calling
convention (and its 2.14 positional spelling behind a ``FutureWarning``) and
the ``precompile.artifact`` pair accessor -- none of which the shipped code
exposes. ``ExampleInput`` belonged to that convention and nothing else
references it, so its dataclass is removed from
torch/compiler/_precompile_types.py.

Test Plan:

Docs render through the existing ``eval-rst`` blocks. Removing the unused
``ExampleInput`` is covered by the public-bindings and precompile suites:

```
python test/test_public_bindings.py
python test/test_precompile.py
python test/dynamo/test_precompile_package.py
```

Authored with an AI assistant.

ghstack-source-id: 6dd685d
Pull-Request: #195929
(cherry picked from commit 0b60519)
[ghstack-poisoned]
bobrenjc93 added a commit that referenced this pull request Sep 8, 2026
The shipped public surface is two caller-driven entry points, and this commit
settles the documentation and the ``torch.compiler`` module comment on exactly
that surface. ``precompile.capture(fn, *, artifact_path, cache_path,
tracer=DynamoTracer(), ...)`` is a context manager: the caller invokes the
returned capture around their own execution, and the ``(python_code, cache)``
artifact is written to the two paths when the block exits. The default
``DynamoTracer`` takes several calls and produces a guarded multi-graph
artifact spanning graph breaks and recompilations; ``MakeFxTracer`` takes a
single call and produces a self-contained Python source plus an acceleration
cache. ``cap.save()`` checkpoints the on-disk artifact partway through the
caller's own loop without ending the capture, and ``precompile.load`` reloads
one.

The API reference, the user-guide walkthrough, and the module comment are
rewritten to this surface. That retires the earlier draft vocabulary the docs
still carried -- the ``accumulate`` entry point, the ``example_inputs`` calling
convention (and its 2.14 positional spelling behind a ``FutureWarning``) and
the ``precompile.artifact`` pair accessor -- none of which the shipped code
exposes. ``ExampleInput`` belonged to that convention and nothing else
references it, so its dataclass is removed from
torch/compiler/_precompile_types.py.

Test Plan:

Docs render through the existing ``eval-rst`` blocks. Removing the unused
``ExampleInput`` is covered by the public-bindings and precompile suites:

```
python test/test_public_bindings.py
python test/test_precompile.py
python test/dynamo/test_precompile_package.py
```

Authored with an AI assistant.

ghstack-source-id: 7d5cbe8
Pull-Request: #195929
(cherry picked from commit 0b60519)
[ghstack-poisoned]
bobrenjc93 added a commit that referenced this pull request Sep 8, 2026
The shipped public surface is two caller-driven entry points, and this commit
settles the documentation and the ``torch.compiler`` module comment on exactly
that surface. ``precompile.capture(fn, *, artifact_path, cache_path,
tracer=DynamoTracer(), ...)`` is a context manager: the caller invokes the
returned capture around their own execution, and the ``(python_code, cache)``
artifact is written to the two paths when the block exits. The default
``DynamoTracer`` takes several calls and produces a guarded multi-graph
artifact spanning graph breaks and recompilations; ``MakeFxTracer`` takes a
single call and produces a self-contained Python source plus an acceleration
cache. ``cap.save()`` checkpoints the on-disk artifact partway through the
caller's own loop without ending the capture, and ``precompile.load`` reloads
one.

The API reference, the user-guide walkthrough, and the module comment are
rewritten to this surface. That retires the earlier draft vocabulary the docs
still carried -- the ``accumulate`` entry point, the ``example_inputs`` calling
convention (and its 2.14 positional spelling behind a ``FutureWarning``) and
the ``precompile.artifact`` pair accessor -- none of which the shipped code
exposes. ``ExampleInput`` belonged to that convention and nothing else
references it, so its dataclass is removed from
torch/compiler/_precompile_types.py.

Test Plan:

Docs render through the existing ``eval-rst`` blocks. Removing the unused
``ExampleInput`` is covered by the public-bindings and precompile suites:

```
python test/test_public_bindings.py
python test/test_precompile.py
python test/dynamo/test_precompile_package.py
```

Authored with an AI assistant.

ghstack-source-id: 1db19b4
Pull-Request: #195929
(cherry picked from commit 0b60519)
[ghstack-poisoned]
bobrenjc93 added a commit that referenced this pull request Sep 8, 2026
The shipped public surface is two caller-driven entry points, and this commit
settles the documentation and the ``torch.compiler`` module comment on exactly
that surface. ``precompile.capture(fn, *, artifact_path, cache_path,
tracer=DynamoTracer(), ...)`` is a context manager: the caller invokes the
returned capture around their own execution, and the ``(python_code, cache)``
artifact is written to the two paths when the block exits. The default
``DynamoTracer`` takes several calls and produces a guarded multi-graph
artifact spanning graph breaks and recompilations; ``MakeFxTracer`` takes a
single call and produces a self-contained Python source plus an acceleration
cache. ``cap.save()`` checkpoints the on-disk artifact partway through the
caller's own loop without ending the capture, and ``precompile.load`` reloads
one.

The API reference, the user-guide walkthrough, and the module comment are
rewritten to this surface. That retires the earlier draft vocabulary the docs
still carried -- the ``accumulate`` entry point, the ``example_inputs`` calling
convention (and its 2.14 positional spelling behind a ``FutureWarning``) and
the ``precompile.artifact`` pair accessor -- none of which the shipped code
exposes. ``ExampleInput`` belonged to that convention and nothing else
references it, so its dataclass is removed from
torch/compiler/_precompile_types.py.

Test Plan:

Docs render through the existing ``eval-rst`` blocks. Removing the unused
``ExampleInput`` is covered by the public-bindings and precompile suites:

```
python test/test_public_bindings.py
python test/test_precompile.py
python test/dynamo/test_precompile_package.py
```

Authored with an AI assistant.

ghstack-source-id: 4261cb4
Pull-Request: #195929
(cherry picked from commit 0b60519)
[ghstack-poisoned]
bobrenjc93 added a commit that referenced this pull request Sep 8, 2026
The shipped public surface is two caller-driven entry points, and this commit
settles the documentation and the ``torch.compiler`` module comment on exactly
that surface. ``precompile.capture(fn, *, artifact_path, cache_path,
tracer=DynamoTracer(), ...)`` is a context manager: the caller invokes the
returned capture around their own execution, and the ``(python_code, cache)``
artifact is written to the two paths when the block exits. The default
``DynamoTracer`` takes several calls and produces a guarded multi-graph
artifact spanning graph breaks and recompilations; ``MakeFxTracer`` takes a
single call and produces a self-contained Python source plus an acceleration
cache. ``cap.save()`` checkpoints the on-disk artifact partway through the
caller's own loop without ending the capture, and ``precompile.load`` reloads
one.

The API reference, the user-guide walkthrough, and the module comment are
rewritten to this surface. That retires the earlier draft vocabulary the docs
still carried -- the ``accumulate`` entry point, the ``example_inputs`` calling
convention (and its 2.14 positional spelling behind a ``FutureWarning``) and
the ``precompile.artifact`` pair accessor -- none of which the shipped code
exposes. ``ExampleInput`` belonged to that convention and nothing else
references it, so its dataclass is removed from
torch/compiler/_precompile_types.py.

Test Plan:

Docs render through the existing ``eval-rst`` blocks. Removing the unused
``ExampleInput`` is covered by the public-bindings and precompile suites:

```
python test/test_public_bindings.py
python test/test_precompile.py
python test/dynamo/test_precompile_package.py
```

Authored with an AI assistant.

ghstack-source-id: 93346c2
Pull-Request: #195929
(cherry picked from commit 0b60519)
[ghstack-poisoned]
bobrenjc93 added a commit that referenced this pull request Sep 8, 2026
The shipped public surface is two caller-driven entry points, and this commit
settles the documentation and the ``torch.compiler`` module comment on exactly
that surface. ``precompile.capture(fn, *, artifact_path, cache_path,
tracer=DynamoTracer(), ...)`` is a context manager: the caller invokes the
returned capture around their own execution, and the ``(python_code, cache)``
artifact is written to the two paths when the block exits. The default
``DynamoTracer`` takes several calls and produces a guarded multi-graph
artifact spanning graph breaks and recompilations; ``MakeFxTracer`` takes a
single call and produces a self-contained Python source plus an acceleration
cache. ``cap.save()`` checkpoints the on-disk artifact partway through the
caller's own loop without ending the capture, and ``precompile.load`` reloads
one.

The API reference, the user-guide walkthrough, and the module comment are
rewritten to this surface. That retires the earlier draft vocabulary the docs
still carried -- the ``accumulate`` entry point, the ``example_inputs`` calling
convention (and its 2.14 positional spelling behind a ``FutureWarning``) and
the ``precompile.artifact`` pair accessor -- none of which the shipped code
exposes. ``ExampleInput`` belonged to that convention and nothing else
references it, so its dataclass is removed from
torch/compiler/_precompile_types.py.

Test Plan:

Docs render through the existing ``eval-rst`` blocks. Removing the unused
``ExampleInput`` is covered by the public-bindings and precompile suites:

```
python test/test_public_bindings.py
python test/test_precompile.py
python test/dynamo/test_precompile_package.py
```

Authored with an AI assistant.

ghstack-source-id: 823d52c
Pull-Request: #195929
(cherry picked from commit 0b60519)
[ghstack-poisoned]
bobrenjc93 added a commit that referenced this pull request Sep 8, 2026
The shipped public surface is two caller-driven entry points, and this commit
settles the documentation and the ``torch.compiler`` module comment on exactly
that surface. ``precompile.capture(fn, *, artifact_path, cache_path,
tracer=DynamoTracer(), ...)`` is a context manager: the caller invokes the
returned capture around their own execution, and the ``(python_code, cache)``
artifact is written to the two paths when the block exits. The default
``DynamoTracer`` takes several calls and produces a guarded multi-graph
artifact spanning graph breaks and recompilations; ``MakeFxTracer`` takes a
single call and produces a self-contained Python source plus an acceleration
cache. ``cap.save()`` checkpoints the on-disk artifact partway through the
caller's own loop without ending the capture, and ``precompile.load`` reloads
one.

The API reference, the user-guide walkthrough, and the module comment are
rewritten to this surface. That retires the earlier draft vocabulary the docs
still carried -- the ``accumulate`` entry point, the ``example_inputs`` calling
convention (and its 2.14 positional spelling behind a ``FutureWarning``) and
the ``precompile.artifact`` pair accessor -- none of which the shipped code
exposes. ``ExampleInput`` belonged to that convention and nothing else
references it, so its dataclass is removed from
torch/compiler/_precompile_types.py.

Test Plan:

Docs render through the existing ``eval-rst`` blocks. Removing the unused
``ExampleInput`` is covered by the public-bindings and precompile suites:

```
python test/test_public_bindings.py
python test/test_precompile.py
python test/dynamo/test_precompile_package.py
```

Authored with an AI assistant.

ghstack-source-id: 49bf1c7
Pull-Request: #195929
bobrenjc93 added a commit that referenced this pull request Sep 8, 2026
The shipped public surface is two caller-driven entry points, and this commit
settles the documentation and the ``torch.compiler`` module comment on exactly
that surface. ``precompile.capture(fn, *, artifact_path, cache_path,
tracer=DynamoTracer(), ...)`` is a context manager: the caller invokes the
returned capture around their own execution, and the ``(python_code, cache)``
artifact is written to the two paths when the block exits. The default
``DynamoTracer`` takes several calls and produces a guarded multi-graph
artifact spanning graph breaks and recompilations; ``MakeFxTracer`` takes a
single call and produces a self-contained Python source plus an acceleration
cache. ``cap.save()`` checkpoints the on-disk artifact partway through the
caller's own loop without ending the capture, and ``precompile.load`` reloads
one.

The API reference, the user-guide walkthrough, and the module comment are
rewritten to this surface. That retires the earlier draft vocabulary the docs
still carried -- the ``accumulate`` entry point, the ``example_inputs`` calling
convention (and its 2.14 positional spelling behind a ``FutureWarning``) and
the ``precompile.artifact`` pair accessor -- none of which the shipped code
exposes. ``ExampleInput`` belonged to that convention and nothing else
references it, so its dataclass is removed from
torch/compiler/_precompile_types.py.

Test Plan:

Docs render through the existing ``eval-rst`` blocks. Removing the unused
``ExampleInput`` is covered by the public-bindings and precompile suites:

```
python test/test_public_bindings.py
python test/test_precompile.py
python test/dynamo/test_precompile_package.py
```

Authored with an AI assistant.

ghstack-source-id: 49bf1c7
Pull-Request: #195929
[ghstack-poisoned]
bobrenjc93 added a commit that referenced this pull request Sep 8, 2026
The shipped public surface is two caller-driven entry points, and this commit
settles the documentation and the ``torch.compiler`` module comment on exactly
that surface. ``precompile.capture(fn, *, artifact_path, cache_path,
tracer=DynamoTracer(), ...)`` is a context manager: the caller invokes the
returned capture around their own execution, and the ``(python_code, cache)``
artifact is written to the two paths when the block exits. The default
``DynamoTracer`` takes several calls and produces a guarded multi-graph
artifact spanning graph breaks and recompilations; ``MakeFxTracer`` takes a
single call and produces a self-contained Python source plus an acceleration
cache. ``cap.save()`` checkpoints the on-disk artifact partway through the
caller's own loop without ending the capture, and ``precompile.load`` reloads
one.

The API reference, the user-guide walkthrough, and the module comment are
rewritten to this surface. That retires the earlier draft vocabulary the docs
still carried -- the ``accumulate`` entry point, the ``example_inputs`` calling
convention (and its 2.14 positional spelling behind a ``FutureWarning``) and
the ``precompile.artifact`` pair accessor -- none of which the shipped code
exposes. ``ExampleInput`` belonged to that convention and nothing else
references it, so its dataclass is removed from
torch/compiler/_precompile_types.py.

Test Plan:

Docs render through the existing ``eval-rst`` blocks. Removing the unused
``ExampleInput`` is covered by the public-bindings and precompile suites:

```
python test/test_public_bindings.py
python test/test_precompile.py
python test/dynamo/test_precompile_package.py
```

Authored with an AI assistant.

ghstack-source-id: c4344dd
Pull-Request: #195929
bobrenjc93 added a commit that referenced this pull request Sep 8, 2026
The shipped public surface is two caller-driven entry points, and this commit
settles the documentation and the ``torch.compiler`` module comment on exactly
that surface. ``precompile.capture(fn, *, artifact_path, cache_path,
tracer=DynamoTracer(), ...)`` is a context manager: the caller invokes the
returned capture around their own execution, and the ``(python_code, cache)``
artifact is written to the two paths when the block exits. The default
``DynamoTracer`` takes several calls and produces a guarded multi-graph
artifact spanning graph breaks and recompilations; ``MakeFxTracer`` takes a
single call and produces a self-contained Python source plus an acceleration
cache. ``cap.save()`` checkpoints the on-disk artifact partway through the
caller's own loop without ending the capture, and ``precompile.load`` reloads
one.

The API reference, the user-guide walkthrough, and the module comment are
rewritten to this surface. That retires the earlier draft vocabulary the docs
still carried -- the ``accumulate`` entry point, the ``example_inputs`` calling
convention (and its 2.14 positional spelling behind a ``FutureWarning``) and
the ``precompile.artifact`` pair accessor -- none of which the shipped code
exposes. ``ExampleInput`` belonged to that convention and nothing else
references it, so its dataclass is removed from
torch/compiler/_precompile_types.py.

Test Plan:

Docs render through the existing ``eval-rst`` blocks. Removing the unused
``ExampleInput`` is covered by the public-bindings and precompile suites:

```
python test/test_public_bindings.py
python test/test_precompile.py
python test/dynamo/test_precompile_package.py
```

Authored with an AI assistant.

ghstack-source-id: c4344dd
Pull-Request: #195929
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/torchtitan Run TorchTitan integration tests ciflow/trunk Trigger trunk jobs on your pull request module: dynamo release notes: dynamo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant