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