18
18
is_node_output_tensor ,
19
19
)
20
20
from torch_tensorrt .dynamo ._defaults import (
21
- DEBUG ,
22
21
MIN_BLOCK_SIZE ,
23
22
REQUIRE_FULL_COMPILATION ,
24
23
)
@@ -390,8 +389,8 @@ def put_nodes_into_subgraphs(self) -> list[Subgraph]:
390
389
391
390
return subgraphs
392
391
393
- def tag (self , subgraphs : list [Subgraph ]):
394
- self .tags = []
392
+ def tag (self , subgraphs : list [Subgraph ]) -> None :
393
+ self .tags : list [ str ] = []
395
394
for subgraph in subgraphs :
396
395
tag = (
397
396
f"_run_on_acc_{ subgraph .backend } _{ len (self .tags )} "
@@ -403,7 +402,7 @@ def tag(self, subgraphs: list[Subgraph]):
403
402
if hasattr (node , "tag" ):
404
403
raise FxNetSplitterInternalError (f"Node { node } was already tagged" )
405
404
406
- node .tag = tag # type: ignore[attr-defined]
405
+ node .tag = tag
407
406
self ._node_submodule_map [node .name ] = tag
408
407
409
408
@@ -433,7 +432,7 @@ def __init__(
433
432
self .allow_non_tensor = allow_non_tensor
434
433
self .acc_nodes : NodeSet = set ()
435
434
436
- def reduce_acc_nodes_non_tensor_input_helper (self , cpu_worklist : NodeList ):
435
+ def reduce_acc_nodes_non_tensor_input_helper (self , cpu_worklist : NodeList ) -> None :
437
436
"""
438
437
Transitively excludes nodes from ACC supported set.
439
438
For every node in the worklist:
@@ -450,7 +449,7 @@ def reduce_acc_nodes_non_tensor_input_helper(self, cpu_worklist: NodeList):
450
449
if not is_node_output_tensor (user ):
451
450
cpu_worklist .append (user )
452
451
453
- def reduce_acc_nodes_non_tensor_input (self ):
452
+ def reduce_acc_nodes_non_tensor_input (self ) -> None :
454
453
"""
455
454
Excludes nodes from ACC supported set that have direct
456
455
upstream CPU nodes that produce non-tensor outputs.
@@ -468,7 +467,7 @@ def reduce_acc_nodes_non_tensor_input(self):
468
467
469
468
self .reduce_acc_nodes_non_tensor_input_helper (non_tensor_cpu_nodes )
470
469
471
- def reduce_acc_nodes_non_tensor_output (self ):
470
+ def reduce_acc_nodes_non_tensor_output (self ) -> None :
472
471
"""
473
472
Excludes nodes from ACC supported set that produce non-tensor
474
473
outputs and have downstream CPU nodes.
@@ -527,7 +526,6 @@ class FxNetSplitterInternalError(Exception):
527
526
528
527
def hierarchical_adjacency_partition (
529
528
gm : torch .fx .GraphModule ,
530
- verbose : bool = DEBUG ,
531
529
min_block_size : int = MIN_BLOCK_SIZE ,
532
530
torch_executed_ops : Collection [Target ] = set (),
533
531
backend_support_map : Optional [Dict [str , Collection [Target ]]] = None ,
@@ -540,7 +538,6 @@ def hierarchical_adjacency_partition(
540
538
541
539
Args:
542
540
gm: FX GraphModule to partition
543
- verbose: Bool representing whether to print operator support
544
541
min_block_size: Minimum number of operators per TRT-Engine Block
545
542
backend_support_map: Dictionary mapping backend names to sets of supported operators
546
543
backend_priority: Ordered list of backend names, from highest to lowest priority
@@ -583,7 +580,6 @@ def hierarchical_adjacency_partition(
583
580
584
581
partitioned_graph = partitioner .partition_graph ()
585
582
586
- if verbose :
587
- supported_ops .print_support_overview (partitioner .num_accelerated_subgraphs )
583
+ supported_ops .print_support_overview (partitioner .num_accelerated_subgraphs )
588
584
589
585
return partitioned_graph , supported_ops
0 commit comments