@@ -66,7 +66,6 @@ def cross_compile_for_windows(
66
66
Set [Union [torch .dtype , dtype ]], Tuple [Union [torch .dtype , dtype ]]
67
67
] = _defaults .ENABLED_PRECISIONS ,
68
68
engine_capability : EngineCapability = _defaults .ENGINE_CAPABILITY ,
69
- debug : bool = False ,
70
69
num_avg_timing_iters : int = _defaults .NUM_AVG_TIMING_ITERS ,
71
70
workspace_size : int = _defaults .WORKSPACE_SIZE ,
72
71
dla_sram_size : int = _defaults .DLA_SRAM_SIZE ,
@@ -140,7 +139,6 @@ def cross_compile_for_windows(
140
139
assume_dynamic_shape_support (bool): Setting this to true enables the converters work for both dynamic and static shapes. Default: False
141
140
sparse_weights (bool): Enable sparsity for convolution and fully connected layers.
142
141
enabled_precision (Set(Union(torch.dtype, torch_tensorrt.dtype))): The set of datatypes that TensorRT can use when selecting kernels
143
- debug (bool): Enable debuggable engine
144
142
capability (torch_tensorrt.EngineCapability): Restrict kernel selection to safe gpu kernels or safe dla kernels
145
143
num_avg_timing_iters (int): Number of averaging timing iterations used to select kernels
146
144
workspace_size (int): Maximum size of workspace given to TensorRT
@@ -187,9 +185,9 @@ def cross_compile_for_windows(
187
185
f"Cross compile for windows is only supported on x86-64 Linux architecture, current platform: { platform .system ()= } , { platform .architecture ()[0 ]= } "
188
186
)
189
187
190
- if debug :
188
+ if kwargs . get ( " debug" , False ) :
191
189
warnings .warn (
192
- "`debug` is deprecated. Please use `torch_tensorrt.dynamo.Debugger` to configure debugging options ." ,
190
+ "`debug` is deprecated. Please use `with torch_tensorrt.dynamo.Debugger(...) ` to wrap your compilation call to enable debugging functionality ." ,
193
191
DeprecationWarning ,
194
192
stacklevel = 2 ,
195
193
)
@@ -404,7 +402,6 @@ def compile(
404
402
Set [Union [torch .dtype , dtype ]], Tuple [Union [torch .dtype , dtype ]]
405
403
] = _defaults .ENABLED_PRECISIONS ,
406
404
engine_capability : EngineCapability = _defaults .ENGINE_CAPABILITY ,
407
- debug : bool = False ,
408
405
num_avg_timing_iters : int = _defaults .NUM_AVG_TIMING_ITERS ,
409
406
workspace_size : int = _defaults .WORKSPACE_SIZE ,
410
407
dla_sram_size : int = _defaults .DLA_SRAM_SIZE ,
@@ -480,7 +477,6 @@ def compile(
480
477
assume_dynamic_shape_support (bool): Setting this to true enables the converters work for both dynamic and static shapes. Default: False
481
478
sparse_weights (bool): Enable sparsity for convolution and fully connected layers.
482
479
enabled_precision (Set(Union(torch.dtype, torch_tensorrt.dtype))): The set of datatypes that TensorRT can use when selecting kernels
483
- debug (bool): Enable debuggable engine
484
480
capability (torch_tensorrt.EngineCapability): Restrict kernel selection to safe gpu kernels or safe dla kernels
485
481
num_avg_timing_iters (int): Number of averaging timing iterations used to select kernels
486
482
workspace_size (int): Maximum size of workspace given to TensorRT
@@ -523,9 +519,9 @@ def compile(
523
519
torch.fx.GraphModule: Compiled FX Module, when run it will execute via TensorRT
524
520
"""
525
521
526
- if debug :
522
+ if kwargs . get ( " debug" , False ) :
527
523
warnings .warn (
528
- "`debug` is deprecated. Please use `torch_tensorrt.dynamo.Debugger` for debugging functionality" ,
524
+ "`debug` is deprecated. Please use `with torch_tensorrt.dynamo.Debugger(...)` to wrap your compilation call to enable debugging functionality" ,
529
525
DeprecationWarning ,
530
526
stacklevel = 2 ,
531
527
)
@@ -732,7 +728,7 @@ def compile_module(
732
728
settings : CompilationSettings = CompilationSettings (),
733
729
engine_cache : Optional [BaseEngineCache ] = None ,
734
730
* ,
735
- _debugger_settings : Optional [DebuggerConfig ] = None ,
731
+ _debugger_config : Optional [DebuggerConfig ] = None ,
736
732
) -> torch .fx .GraphModule :
737
733
"""Compile a traced FX module
738
734
@@ -935,29 +931,36 @@ def contains_metadata(gm: torch.fx.GraphModule) -> bool:
935
931
936
932
trt_modules [name ] = trt_module
937
933
938
- if _debugger_settings :
934
+ if _debugger_config :
939
935
940
- if _debugger_settings .save_engine_profile :
936
+ if _debugger_config .save_engine_profile :
941
937
if settings .use_python_runtime :
942
- if _debugger_settings .profile_format == "trex " :
943
- logger . warning (
938
+ if _debugger_config .profile_format != "cudagraph " :
939
+ raise ValueError (
944
940
"Profiling with TREX can only be enabled when using the C++ runtime. Python runtime profiling only support cudagraph visualization."
945
941
)
942
+ else :
946
943
trt_module .enable_profiling ()
947
944
else :
948
- path = os .path .join (
949
- _debugger_settings .logging_dir , "engine_visualization"
950
- )
951
- os .makedirs (path , exist_ok = True )
952
- trt_module .enable_profiling (
953
- profiling_results_dir = path ,
954
- profile_format = _debugger_settings .profile_format ,
955
- )
956
-
957
- if _debugger_settings .save_layer_info :
945
+ if _debugger_config .profile_format == "cudagraph" :
946
+ raise ValueError (
947
+ "Profiling with Cudagraph can only be enabled when using the Python runtime. C++ runtime profiling only support TREX/Perfetto visualization."
948
+ )
949
+ else :
950
+ path = os .path .join (
951
+ _debugger_config .logging_dir ,
952
+ "engine_visualization_profile" ,
953
+ )
954
+ os .makedirs (path , exist_ok = True )
955
+ trt_module .enable_profiling (
956
+ profiling_results_dir = path ,
957
+ profile_format = _debugger_config .profile_format ,
958
+ )
959
+
960
+ if _debugger_config .save_layer_info :
958
961
with open (
959
962
os .path .join (
960
- _debugger_settings .logging_dir , "engine_layer_info.json"
963
+ _debugger_config .logging_dir , "engine_layer_info.json"
961
964
),
962
965
"w" ,
963
966
) as f :
@@ -990,7 +993,6 @@ def convert_exported_program_to_serialized_trt_engine(
990
993
enabled_precisions : (
991
994
Set [torch .dtype | dtype ] | Tuple [torch .dtype | dtype ]
992
995
) = _defaults .ENABLED_PRECISIONS ,
993
- debug : bool = False ,
994
996
assume_dynamic_shape_support : bool = _defaults .ASSUME_DYNAMIC_SHAPE_SUPPORT ,
995
997
workspace_size : int = _defaults .WORKSPACE_SIZE ,
996
998
min_block_size : int = _defaults .MIN_BLOCK_SIZE ,
@@ -1052,7 +1054,6 @@ def convert_exported_program_to_serialized_trt_engine(
1052
1054
torch.randn((1, 3, 224, 244)) # Use an example tensor and let torch_tensorrt infer settings
1053
1055
]
1054
1056
enabled_precisions (Optional[Set[torch.dtype | _enums.dtype]]): The set of datatypes that TensorRT can use
1055
- debug (bool): Whether to print out verbose debugging information
1056
1057
workspace_size (int): Workspace TRT is allowed to use for the module (0 is default)
1057
1058
min_block_size (int): Minimum number of operators per TRT-Engine Block
1058
1059
torch_executed_ops (Set[str]): Set of operations to run in Torch, regardless of converter coverage
@@ -1092,9 +1093,9 @@ def convert_exported_program_to_serialized_trt_engine(
1092
1093
Returns:
1093
1094
bytes: Serialized TensorRT engine, can either be saved to a file or deserialized via TensorRT APIs
1094
1095
"""
1095
- if debug :
1096
+ if kwargs . get ( " debug" , False ) :
1096
1097
warnings .warn (
1097
- "`debug` is deprecated. Please use `torch_tensorrt.dynamo.Debugger` to configure debugging options ." ,
1098
+ "`debug` is deprecated. Please use `with torch_tensorrt.dynamo.Debugger(...) ` to wrap your compilation call to enable debugging functionality ." ,
1098
1099
DeprecationWarning ,
1099
1100
stacklevel = 2 ,
1100
1101
)
@@ -1181,7 +1182,6 @@ def convert_exported_program_to_serialized_trt_engine(
1181
1182
compilation_options = {
1182
1183
"assume_dynamic_shape_support" : assume_dynamic_shape_support ,
1183
1184
"enabled_precisions" : enabled_precisions ,
1184
- "debug" : debug ,
1185
1185
"workspace_size" : workspace_size ,
1186
1186
"min_block_size" : min_block_size ,
1187
1187
"torch_executed_ops" : torch_executed_ops ,
0 commit comments