Skip to content

Commit cbc282a

Browse files
committed
fix comments
1 parent 7ee35f1 commit cbc282a

File tree

8 files changed

+28
-27
lines changed

8 files changed

+28
-27
lines changed

core/runtime/execute_engine.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -520,19 +520,20 @@ std::vector<at::Tensor> execute_engine(std::vector<at::Tensor> inputs, c10::intr
520520
if (compiled_engine->requires_output_allocator) { // engine requires OA
521521
if (cudagraphs_enabled) {
522522
TORCHTRT_THROW_ERROR(
523-
"This module requires OutputAllocator which is not compatible with CUDA Graphs. Please disable CUDA Graphs.");
523+
"The model contains submodules that require a dynamic output allocator at runtime, which is incompatible with CUDA Graphs. Please disable CUDA Graphs.");
524524
}
525-
LOG_DEBUG("Using OutputAllocator in runtime.");
525+
LOG_DEBUG("Using the dynamic allocator runtime mode.");
526526
return run_output_allocator();
527527
} else {
528528
if (compiled_engine->use_output_allocator_outputs) { // users call OA context manager
529529
if (cudagraphs_enabled) {
530-
TORCHTRT_THROW_ERROR("Both CUDA Graphs and OutputAllocator are enabled. Please disable either one.");
530+
TORCHTRT_THROW_ERROR(
531+
"Both CUDA Graphs and dynamic output allocation are enabled, which are incompatible runtime modes. Please disable one of the two.");
531532
}
532-
LOG_DEBUG("Using OutputAllocator in runtime.");
533+
LOG_DEBUG("Using the dynamic allocator runtime mode.");
533534
return run_output_allocator();
534535
} else {
535-
LOG_DEBUG("Using standard execution with cudagraphs=" << cudagraphs_enabled << ".");
536+
LOG_DEBUG("Using the standard execution runtime mode with cudagraphs=" << cudagraphs_enabled << ".");
536537
return run_standard_execution();
537538
}
538539
}

core/runtime/runtime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace core {
1616
namespace runtime {
1717

1818
using EngineID = int64_t;
19-
const std::string ABI_VERSION = "6";
19+
const std::string ABI_VERSION = "7";
2020
extern bool MULTI_DEVICE_SAFE_MODE;
2121

2222
typedef enum {

py/torch_tensorrt/dynamo/runtime/_CudaGraphsTorchTensorRTModule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def __del__(self) -> None:
7474
if self.cudagraph:
7575
self.cudagraph.reset()
7676

77-
def set_output_allocator_outputs(self, enable: bool) -> None:
77+
def set_use_output_allocator(self, enable: bool) -> None:
7878
self.use_output_allocator_outputs = enable
7979

8080
def forward(self, *inputs: torch.Tensor) -> torch.Tensor | Tuple[torch.Tensor, ...]:

py/torch_tensorrt/dynamo/runtime/_PythonTorchTensorRTModule.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def create_output_tensors(self) -> List[torch.Tensor]:
404404
def set_pre_allocated_outputs(self, enable: bool) -> None:
405405
self.use_pre_allocated_outputs = enable
406406

407-
def set_output_allocator_outputs(self, enable: bool) -> None:
407+
def set_use_output_allocator(self, enable: bool) -> None:
408408
self.use_output_allocator_outputs = enable
409409

410410
def create_output_allocator(self) -> None:
@@ -683,21 +683,21 @@ def run_output_allocator() -> torch.Tensor | Tuple[torch.Tensor, ...]:
683683
if self.requires_output_allocator: # engine requires OA
684684
if self.cudagraphs_enabled:
685685
raise RuntimeError(
686-
"This module requires OutputAllocator which is not compatible with CUDA Graphs. Please disable CUDA Graphs."
686+
"The model contains submodules that require a dynamic output allocator at runtime, which is incompatible with CUDA Graphs. Please disable CUDA Graphs."
687687
)
688-
logger.debug("Using OutputAllocator in runtime.")
688+
logger.debug("Using the dynamic allocator runtime mode.")
689689
return run_output_allocator()
690690
else:
691691
if self.use_output_allocator_outputs: # users call OA context manager
692692
if self.cudagraphs_enabled:
693693
raise RuntimeError(
694-
"Both CUDA Graphs and OutputAllocator are enabled. Please disable either one."
694+
"Both CUDA Graphs and dynamic output allocation are enabled, which are incompatible runtime modes. Please disable one of the two."
695695
)
696-
logger.debug("Using OutputAllocator in runtime.")
696+
logger.debug("Using the dynamic allocator runtime mode.")
697697
return run_output_allocator()
698698
else:
699699
logger.debug(
700-
f"Using standard execution with cudagraphs={self.cudagraphs_enabled}."
700+
f"Using the standard execution runtime mode with cudagraphs={self.cudagraphs_enabled}."
701701
)
702702
return run_standard_execution()
703703

py/torch_tensorrt/dynamo/runtime/_TorchTensorRTModule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def set_extra_state(self, state: SerializedTorchTensorRTModuleFmt) -> None:
293293
def set_pre_allocated_outputs(self, enable: bool) -> None:
294294
self.engine.use_pre_allocated_outputs = enable
295295

296-
def set_output_allocator_outputs(self, enable: bool) -> None:
296+
def set_use_output_allocator(self, enable: bool) -> None:
297297
self.engine.use_output_allocator_outputs = enable
298298

299299
def forward(self, *inputs: Any) -> torch.Tensor | Tuple[torch.Tensor, ...]:

py/torch_tensorrt/runtime/_cudagraphs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def __enter__(self) -> torch.nn.Module:
8181
and module.requires_output_allocator
8282
):
8383
raise RuntimeError(
84-
"There are converters that require Output Allocator. Please disable CUDA Graphs."
84+
"The model contains submodules that require a dynamic output allocator at runtime, which is incompatible with CUDA Graphs. Please disable CUDA Graphs."
8585
)
8686
if "_run_on_acc" in name:
8787
num_trt_module += 1

py/torch_tensorrt/runtime/_output_allocator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(
3333

3434
def set_output_allocator_output(self, enable: bool) -> None:
3535
for mod in self.rt_mods:
36-
mod.set_output_allocator_outputs(enable)
36+
mod.set_use_output_allocator(enable)
3737

3838
def __enter__(self) -> "_OutputAllocatorContextManager":
3939
# Enable output_allocator for TRT submodules

tests/py/dynamo/runtime/test_output_allocator_py.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def test_combination_of_cg_and_oa(self, _, use_python_runtime):
126126

127127
with pytest.raises(
128128
RuntimeError,
129-
match="Both CUDA Graphs and OutputAllocator are enabled. Please disable either one.",
129+
match="Both CUDA Graphs and dynamic output allocation are enabled, which are incompatible runtime modes. Please disable one of the two.",
130130
):
131131
with torch_tensorrt.runtime.enable_cudagraphs(
132132
compiled_model
@@ -136,7 +136,7 @@ def test_combination_of_cg_and_oa(self, _, use_python_runtime):
136136

137137
with pytest.raises(
138138
RuntimeError,
139-
match="Both CUDA Graphs and OutputAllocator are enabled. Please disable either one.",
139+
match="Both CUDA Graphs and dynamic output allocation are enabled, which are incompatible runtime modes. Please disable one of the two.",
140140
):
141141
with torch_tensorrt.runtime.enable_output_allocator(compiled_model):
142142
with torch_tensorrt.runtime.enable_cudagraphs(
@@ -165,7 +165,7 @@ def test_cudagraphs_and_output_allocator(self, _, use_python_runtime):
165165

166166
with pytest.raises(
167167
RuntimeError,
168-
match="There are converters that require Output Allocator. Please disable CUDA Graphs.",
168+
match="The model contains submodules that require a dynamic output allocator at runtime, which is incompatible with CUDA Graphs. Please disable CUDA Graphs.",
169169
):
170170
with torch_tensorrt.runtime.enable_cudagraphs(
171171
compiled_model
@@ -232,7 +232,7 @@ def test_combination_of_cg_and_oa(self, _, use_python_runtime):
232232

233233
with pytest.raises(
234234
RuntimeError,
235-
match="There are converters that require Output Allocator. Please disable CUDA Graphs.",
235+
match="The model contains submodules that require a dynamic output allocator at runtime, which is incompatible with CUDA Graphs. Please disable CUDA Graphs.",
236236
):
237237
with torch_tensorrt.runtime.enable_cudagraphs(
238238
compiled_model
@@ -242,7 +242,7 @@ def test_combination_of_cg_and_oa(self, _, use_python_runtime):
242242

243243
with pytest.raises(
244244
RuntimeError,
245-
match="There are converters that require Output Allocator. Please disable CUDA Graphs.",
245+
match="The model contains submodules that require a dynamic output allocator at runtime, which is incompatible with CUDA Graphs. Please disable CUDA Graphs.",
246246
):
247247
with torch_tensorrt.runtime.enable_output_allocator(compiled_model):
248248
with torch_tensorrt.runtime.enable_cudagraphs(
@@ -275,7 +275,7 @@ def test_cudagraphs_and_output_allocator(self, _, use_python_runtime):
275275

276276
with pytest.raises(
277277
RuntimeError,
278-
match="There are converters that require Output Allocator. Please disable CUDA Graphs.",
278+
match="The model contains submodules that require a dynamic output allocator at runtime, which is incompatible with CUDA Graphs. Please disable CUDA Graphs.",
279279
):
280280
with torch_tensorrt.runtime.enable_cudagraphs(
281281
compiled_model
@@ -342,7 +342,7 @@ def test_combination_of_cg_and_oa(self, _, use_python_runtime):
342342

343343
with pytest.raises(
344344
RuntimeError,
345-
match="There are converters that require Output Allocator. Please disable CUDA Graphs.",
345+
match="The model contains submodules that require a dynamic output allocator at runtime, which is incompatible with CUDA Graphs. Please disable CUDA Graphs.",
346346
):
347347
with torch_tensorrt.runtime.enable_cudagraphs(
348348
compiled_model
@@ -352,7 +352,7 @@ def test_combination_of_cg_and_oa(self, _, use_python_runtime):
352352

353353
with pytest.raises(
354354
RuntimeError,
355-
match="There are converters that require Output Allocator. Please disable CUDA Graphs.",
355+
match="The model contains submodules that require a dynamic output allocator at runtime, which is incompatible with CUDA Graphs. Please disable CUDA Graphs.",
356356
):
357357
with torch_tensorrt.runtime.enable_output_allocator(compiled_model):
358358
with torch_tensorrt.runtime.enable_cudagraphs(
@@ -382,7 +382,7 @@ def test_cudagraphs_and_output_allocator(self, _, use_python_runtime):
382382

383383
with pytest.raises(
384384
RuntimeError,
385-
match="There are converters that require Output Allocator. Please disable CUDA Graphs.",
385+
match="The model contains submodules that require a dynamic output allocator at runtime, which is incompatible with CUDA Graphs. Please disable CUDA Graphs.",
386386
):
387387
with torch_tensorrt.runtime.enable_cudagraphs(
388388
compiled_model
@@ -451,7 +451,7 @@ def test_combination_of_cg_and_oa(self, _, use_python_runtime):
451451

452452
with pytest.raises(
453453
RuntimeError,
454-
match="There are converters that require Output Allocator. Please disable CUDA Graphs.",
454+
match="The model contains submodules that require a dynamic output allocator at runtime, which is incompatible with CUDA Graphs. Please disable CUDA Graphs.",
455455
):
456456
with torch_tensorrt.runtime.enable_cudagraphs(
457457
compiled_model
@@ -461,7 +461,7 @@ def test_combination_of_cg_and_oa(self, _, use_python_runtime):
461461

462462
with pytest.raises(
463463
RuntimeError,
464-
match="There are converters that require Output Allocator. Please disable CUDA Graphs.",
464+
match="The model contains submodules that require a dynamic output allocator at runtime, which is incompatible with CUDA Graphs. Please disable CUDA Graphs.",
465465
):
466466
with torch_tensorrt.runtime.enable_output_allocator(compiled_model):
467467
with torch_tensorrt.runtime.enable_cudagraphs(

0 commit comments

Comments
 (0)