Skip to content

Commit d43d408

Browse files
committed
do not clear UncachedCompile between node runs
1 parent 1a82b70 commit d43d408

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

torch_xla/_dynamo/dynamo_bridge.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ def run_node(self, n: torch.fx.Node):
643643
# We need to restore this metric count later, so save it in a separate variable
644644
dynamo_extract_graph_helper_metric_count = metrics.counter_value(
645645
'DynamoExtractCompiledGraph')
646+
uncached_compile_metric_count = metrics.counter_value('UncachedCompile')
646647

647648
metrics.clear_counters()
648649
result = super().run_node(n)
@@ -681,6 +682,8 @@ def all_tensors_on_xla_device(value):
681682
# Restore this metric counter
682683
torch_xla._XLAC._xla_increment_counter(
683684
'DynamoExtractCompiledGraph', dynamo_extract_graph_helper_metric_count)
685+
torch_xla._XLAC._xla_increment_counter('UncachedCompile',
686+
uncached_compile_metric_count)
684687

685688
return result
686689

@@ -725,6 +728,7 @@ def allow_cpu_device(self, node: torch.fx.Node):
725728

726729
def extract_compiled_graph(xla_model: torch.fx.GraphModule, xla_args):
727730
torch_xla._XLAC._xla_increment_counter('DynamoExtractCompiledGraph', 1)
731+
torch_xla._XLAC._xla_increment_counter('UncachedCompile', 1)
728732

729733
with torch_xla.experimental.eager_mode_context(False):
730734
return extract_compiled_graph_helper(xla_model, xla_args)

0 commit comments

Comments
 (0)