pytorch/torch/_dynamo/variables
William Wen 2c372a0502 [dynamo] add set_fullgraph decorator/context manager (#154289)
Implements https://github.com/pytorch/pytorch/issues/144908.

Implementation notes:
- `set_fullgraph` is implemented using `patch_config`, which changes config correctly during runtime and tracing.
- Moved setting `config.error_on_graph_break` from convert_frame.py to eval_frame.py. This is because this should only be done at the top-level decorated function. If we kept this in convert_frame.py, we would be changing `config.error_on_graph_break` on every top-level frame, which causes confusing behavior (see added test for example).
- InstructionTranslator reads from `config.error_on_graph_break` every `step()`. This is to determine the value of `config.error_on_graph_break` at the time of the graph break, because tracer cleanup will restore the value of `config.error_on_graph_break` .
- `convert_frame.py` determines whether we should abort tracing (fullgraph=True) or continue (fullgraph=False) by reading the value of the tracer's `error_on_graph_break`. If there is no tracer (failed to initialize), then default to reading `config.error_on_graph_break`.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/154289
Approved by: https://github.com/jansel, https://github.com/zou3519
ghstack dependencies: #154283
2025-06-20 07:03:07 +00:00
..
__init__.py [dynamo] Support tracing of functools.lru_cached method (#156125) 2025-06-17 18:11:32 +00:00
base.py [dynamo] Fix cycle reference problem caused by recursive collect_temp_source in codegen (#155791) 2025-06-19 19:37:44 +00:00
builder.py [user triton] dynamo support for new host-side TMA API (#155662) 2025-06-12 12:56:23 +00:00
builtin.py Migrate from lru_cache to cache (#155613) 2025-06-11 19:44:18 +00:00
constant.py [Set] Handle exception in ConstantVariable operation (#152987) 2025-05-16 14:28:32 +00:00
ctx_manager.py [dynamo] dynamic gb_type -> static gb_type (#154435) 2025-05-28 03:14:26 +00:00
dicts.py [dynamo] Reconstruct defaultdict properly (#154931) 2025-06-03 18:18:40 +00:00
distributed.py [Dyamo] Replace unimplemented with unimplemented_v2 for variables/distributed (#148500) 2025-03-05 20:41:43 +00:00
functions.py [dynamo] Support tracing of functools.lru_cached method (#156125) 2025-06-17 18:11:32 +00:00
higher_order_ops.py flex attention: fix dispatch order for tensor subclasses, avoid hardcoding call to faketensor impl in dynamo (#151719) 2025-06-18 07:02:04 +00:00
iter.py [dynamo] updating gb_type names for uniqueness (#154452) 2025-05-28 16:54:10 +00:00
lazy.py [Dynamo] Use LazyVariableTracker in base VT (#151847) 2025-04-23 18:18:01 +00:00
lists.py [Dynamo] Replace unimplemented with unimplemented_v2 in torch/_dynamo/variables/lists.py (#151873) 2025-04-27 11:59:45 +00:00
misc.py [dynamo] add set_fullgraph decorator/context manager (#154289) 2025-06-20 07:03:07 +00:00
nn_module.py Migrate from lru_cache to cache (#155613) 2025-06-11 19:44:18 +00:00
optimizer.py [dynamo] Guard serialization for NAME_MATCH (#152332) 2025-04-29 20:16:00 +00:00
script_object.py Document dynamo (#146736) 2025-02-13 00:02:21 +00:00
sdpa.py [Dynamo][Misc] Apply typing hints for codegen (#150289) 2025-04-04 14:26:22 +00:00
tensor.py [Hierarchical-Compile] Track mutations for setitem (#155880) 2025-06-13 18:59:31 +00:00
torch_function.py Typo fixes for "overridden" in comments and function names (#155944) 2025-06-14 03:37:38 +00:00
torch.py Add view_simple as meta function for view, and avoid calling reshape_view_helper for unbacked (#154757) 2025-06-19 04:50:18 +00:00
user_defined.py [dynamo] Support tracing of functools.lru_cached method (#156125) 2025-06-17 18:11:32 +00:00