Skip to content

Commit 4972fe0

Browse files
authored
chore: adding additional logging to the converter registry system (#3199)
1 parent f17fd5f commit 4972fe0

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

py/torch_tensorrt/dynamo/conversion/_ConverterRegistry.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
cast,
1919
)
2020

21-
import tensorrt as trt
2221
import torch
2322
from torch import SymBool, SymFloat, SymInt
2423
from torch._ops import OpOverloadPacket
@@ -27,6 +26,8 @@
2726
from torch_tensorrt.dynamo.conversion._ConversionContext import ConversionContext
2827
from torch_tensorrt.fx.converter_registry import CONVERTERS as FX_CONVERTERS
2928

29+
import tensorrt as trt
30+
3031
logger = logging.getLogger(__name__)
3132

3233
LegacyConverterImplSignature = Callable[
@@ -440,25 +441,33 @@ def __getitem__(
440441
):
441442
if key in registry:
442443
converters = registry[key]
443-
444444
if isinstance(converters, (list, tuple)):
445-
for candidate in converters:
445+
logger.debug(f"Converter options for {key}: {len(converters)}")
446+
for i, candidate in enumerate(converters):
446447
# We enable the converter under 4 conditions
447448
# 1) capability validator is True
448449
# 2) Assume dynamic_shape support is True
449450
# 3) Node only has static shaped inputs
450451
# 4) Node has dynamic inputs and the converter has supports_dynamic_shapes=True
451-
if candidate.capability_validator(
452+
if is_valid := candidate.capability_validator(
452453
node, self.compilation_settings
453454
) and (
454455
assume_dynamic_shape_support
455456
or not node_has_dynamic_shapes(node)
456457
or candidate.supports_dynamic_shapes
457458
):
459+
logger.debug(
460+
f"Selecting converter option {i} for converting {key}"
461+
)
458462
return (
459463
candidate.converter_implementation,
460464
calling_convention,
461465
)
466+
else:
467+
logger.debug(
468+
f"Skipping option {i} for {key}: (validator: {is_valid}, supports dynamic shapes: {candidate.supports_dynamic_shapes})"
469+
)
470+
continue
462471
else:
463472
# Assuming FX converters don't have dynamic shapes supported
464473
if not node_has_dynamic_shapes(node):

py/torch_tensorrt/dynamo/conversion/impl/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
from torch_tensorrt.fx.converters.impl import convolution
2-
3-
from . import (
1+
from torch_tensorrt.dynamo.conversion.impl import (
42
activation,
53
addmm,
64
arange,

0 commit comments

Comments
 (0)