mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
[Dynamo] Add debug linting option for graph dedupe (#150053)
As title Pull Request resolved: https://github.com/pytorch/pytorch/pull/150053 Approved by: https://github.com/StrongerXi, https://github.com/anijain2305
This commit is contained in:
parent
25309a17f0
commit
d2c0c65ea1
|
|
@ -432,6 +432,10 @@ use_graph_deduplication = False
|
|||
# This flag is ignored if use_graph_deduplication is True
|
||||
track_nodes_for_deduplication = False
|
||||
|
||||
# Whether to lint the graph after each region is replaced
|
||||
# (Debug)
|
||||
graph_deduplication_lint = False
|
||||
|
||||
# Issues a warning in Python 3.13.0 for possibly slower guard evaluation and
|
||||
# instructs user to attempt using 3.13.1+, where the CPython bug is fixed.
|
||||
# Should be disabled in dynamo-wrapped tests since some tests check that no warnings are issued.
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ from collections.abc import Iterable
|
|||
from typing import Any
|
||||
|
||||
import torch.fx
|
||||
from torch._dynamo import config
|
||||
from torch._higher_order_ops.utils import has_potential_input_alias_or_mutation
|
||||
from torch.utils._pytree import tree_flatten
|
||||
|
||||
|
|
@ -154,6 +155,9 @@ def _replace_region_with_subgraph(
|
|||
for node in reversed(region):
|
||||
graph.erase_node(node)
|
||||
|
||||
if config.graph_deduplication_lint:
|
||||
graph.lint()
|
||||
|
||||
|
||||
def _get_external_inputs(
|
||||
region: Region,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user