[dynamo] Add documentation for guard_filter_fn (#156114)

Summary: Adding a section of doc for guard_filter_fn.

Test Plan:
CI

Rollback Plan:

Differential Revision: D76756743

Pull Request resolved: https://github.com/pytorch/pytorch/pull/156114
Approved by: https://github.com/jansel
This commit is contained in:
Zhengxu Chen 2025-06-19 16:13:12 +00:00 committed by PyTorch MergeBot
parent c9afcffed0
commit 7f0cddfb55

View File

@ -2571,6 +2571,14 @@ def compile(
- `trace.graph_diagram` which will show you a picture of your graph after fusion
- `guard_filter_fn` that controls which dynamo guards are saved with compilations.
This is an unsafe feature and there is no backward compatibility guarantee provided
for dynamo guards as data types.
For stable helper functions to use, see the documentations in `torch.compiler`, for example:
- `torch.compiler.skip_guard_on_inbuilt_nn_modules_unsafe`
- `torch.compiler.skip_guard_on_all_nn_modules_unsafe`
- `torch.compiler.keep_tensor_guards_unsafe`
- For inductor you can see the full list of configs that it supports by calling `torch._inductor.list_options()`
disable (bool): Turn torch.compile() into a no-op for testing