Repository: pytorch/TensorRT

Issue:
Add back 1.13 testing to CI for legacy support
We are looking to support both 1.13 and 2.0 in Torch-TRT 1.4. We need to add it back to CI for testing (ideally weekly/nightly). 


Discussion:

Resolving patch:
diff --git a/py/setup.py b/py/setup.py
--- a/py/setup.py
+++ b/py/setup.py
@@ -380,7 +380,7 @@ def run(self):
     long_description=long_description,
     ext_modules=ext_modules,
     install_requires=[
-        "torch>=1.14.0.dev0",
+        "torch>=1.13.1",
     ],
     setup_requires=[],
     cmdclass={
diff --git a/py/torch_tensorrt/fx/tracer/dispatch_tracer/aten_tracer.py b/py/torch_tensorrt/fx/tracer/dispatch_tracer/aten_tracer.py
--- a/py/torch_tensorrt/fx/tracer/dispatch_tracer/aten_tracer.py
+++ b/py/torch_tensorrt/fx/tracer/dispatch_tracer/aten_tracer.py
@@ -4,8 +4,10 @@
 from typing import Any, Callable, Dict, Generator, List, Optional, Set, Tuple, Union
 
 import torch
-import torch._dynamo as torchdynamo
-from torch._dynamo.guards import Guard
+
+if not torch.__version__.startswith("1"):
+    import torch._dynamo as torchdynamo
+
 from torch.fx.passes.infra.pass_base import PassResult
 
 from torch_tensorrt.fx.passes.lower_basic_pass_aten import (
@@ -96,12 +98,17 @@ def dynamo_trace(
     aten_graph: bool,
     tracing_mode: str = "real",
     dynamo_config: Optional[DynamoConfig] = None,
-) -> Tuple[torch.fx.GraphModule, Set[Guard]]:
+) -> Tuple[torch.fx.GraphModule, Set]:
     """
     TODO: Once we fully migrate to torchdynamo frontend, we will remove
     this config option alltogether.  For now, it helps with quick
     experiments with playing around with TorchDynamo
     """
+    if torch.__version__.startswith("1"):
+        raise ValueError(
+            f"The aten tracer requires Torch version >= 2.0. Detected version {torch.__version__}"
+        )
+
     if dynamo_config is None:
         dynamo_config = DynamoConfig()
     with using_config(dynamo_config), setting_python_recursive_limit(2000):


Test patch:
diff --git a/py/torch_tensorrt/fx/test/quant/test_quant_trt.py b/py/torch_tensorrt/fx/test/quant/test_quant_trt.py
--- a/py/torch_tensorrt/fx/test/quant/test_quant_trt.py
+++ b/py/torch_tensorrt/fx/test/quant/test_quant_trt.py
@@ -696,7 +696,6 @@ def conv_add_extra_inputs_getter(pattern):
             return [extra_input]
 
         conv_add_config = {
-            "pattern_complex_format": (operator.add, torch.nn.Conv2d, MatchAllNode),
             "observation_type": ObservationType.OUTPUT_USE_DIFFERENT_OBSERVER_AS_INPUT,
             "dtype_configs": [
                 weighted_op_qint8_dtype_config,
@@ -707,6 +706,15 @@ def conv_add_extra_inputs_getter(pattern):
             "reference_quantized_module_for_root": torch.nn.quantized._reference.Conv2d,
         }
 
+        if torch.__version__.startswith("1"):
+            conv_add_config["pattern"] = (operator.add, torch.nn.Conv2d, MatchAllNode)
+        else:
+            conv_add_config["pattern_complex_format"] = (
+                operator.add,
+                torch.nn.Conv2d,
+                MatchAllNode,
+            )
+
         m = M().eval()
         modified_backend_config_dict = copy.deepcopy(self.trt_backend_config_dict)
         modified_backend_config_dict["configs"].insert(0, conv_add_config)
@@ -764,10 +772,6 @@ def forward(self, x):
         }
 
         conv_add_config = {
-            "pattern_complex_format": (
-                torch.nn.ReLU,
-                (operator.add, torch.nn.Conv2d, MatchAllNode),
-            ),
             "observation_type": ObservationType.OUTPUT_USE_DIFFERENT_OBSERVER_AS_INPUT,
             "dtype_configs": [
                 weighted_op_quint8_dtype_config,
@@ -776,6 +780,17 @@ def forward(self, x):
             # "reference_quantized_module_for_root": torch.nn.quantized._reference.Conv2d,
         }
 
+        if torch.__version__.startswith("1"):
+            conv_add_config["pattern"] = (
+                torch.nn.ReLU,
+                (operator.add, torch.nn.Conv2d, MatchAllNode),
+            )
+        else:
+            conv_add_config["pattern_complex_format"] = (
+                torch.nn.ReLU,
+                (operator.add, torch.nn.Conv2d, MatchAllNode),
+            )
+
         conv_config = {
             "pattern": torch.nn.Conv2d,
             "observation_type": ObservationType.OUTPUT_USE_DIFFERENT_OBSERVER_AS_INPUT,