Skip to content

Commit e00d951

Browse files
tp5uiuccodex
andauthored
feat : enable TRT API model tests for TensorRT-RTX (#4926)
Co-authored-by: Codex <noreply@openai.com>
1 parent 45fabc8 commit e00d951

4 files changed

Lines changed: 21 additions & 2 deletions

File tree

‎tests/ci/suites.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ def __post_init__(self) -> None:
203203
"dynamo/conversion/",
204204
"dynamo/runtime/",
205205
"dynamo/automatic_plugin/",
206+
"dynamo/models/test_cuda_graph_strategy_models.py",
207+
"dynamo/models/test_dynamic_shapes_kernel_strategy_models.py",
208+
"dynamo/models/test_runtime_cache_models.py",
206209
"dynamo/models/test_model_refit.py",
207210
"dynamo/models/test_models_export.py",
208211
"dynamo/models/test_weight_stripped_engine.py",

‎tests/py/dynamo/models/test_cuda_graph_strategy_models.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33

44
import unittest
55

6+
import pytest
67
import torch
78
import torch.nn.functional as F
89
import torch_tensorrt as torchtrt
910
from torch.testing._internal.common_utils import TestCase, run_tests
1011
from torch_tensorrt._features import ENABLED_FEATURES
1112
from torch_tensorrt.runtime import RuntimeSettings, apply_runtime_settings
1213

14+
pytestmark = [pytest.mark.trt_api, pytest.mark.trt_rtx_only]
15+
1316

1417
class ConvModel(torch.nn.Module):
1518
def __init__(self):

‎tests/py/dynamo/models/test_dynamic_shapes_kernel_strategy_models.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
import importlib
55
import unittest
66

7+
import pytest
78
import torch
89
import torch_tensorrt as torchtrt
910
from torch.testing._internal.common_utils import TestCase, run_tests
1011
from torch_tensorrt._features import ENABLED_FEATURES
1112
from torch_tensorrt.dynamo.utils import COSINE_THRESHOLD, cosine_similarity
1213
from torch_tensorrt.runtime import RuntimeSettings, apply_runtime_settings
1314

15+
pytestmark = [pytest.mark.trt_api, pytest.mark.trt_rtx_only]
16+
1417

1518
@unittest.skipIf(
1619
not ENABLED_FEATURES.tensorrt_rtx,

‎tests/py/dynamo/models/test_runtime_cache_models.py‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@
99
import time
1010
import unittest
1111

12+
import pytest
1213
import torch
1314
import torch_tensorrt as torchtrt
1415
from torch.testing._internal.common_utils import TestCase, run_tests
1516
from torch_tensorrt._features import ENABLED_FEATURES
17+
from torch_tensorrt._utils import is_tensorrt_rtx_version_supported
1618
from torch_tensorrt.dynamo.utils import COSINE_THRESHOLD, cosine_similarity
1719
from torch_tensorrt.runtime import RuntimeSettings, apply_runtime_settings
1820

21+
pytestmark = [pytest.mark.trt_api, pytest.mark.trt_rtx_only]
22+
1923

2024
@unittest.skipIf(
2125
not ENABLED_FEATURES.tensorrt_rtx,
@@ -130,10 +134,16 @@ def test_mobilenet_v2_with_runtime_cache(self):
130134
ref_output = model(input_tensor)
131135
trt_output = compiled(input_tensor)
132136

137+
is_turing = torch.cuda.get_device_capability() == (7, 5)
138+
threshold = COSINE_THRESHOLD
139+
if is_turing and not is_tensorrt_rtx_version_supported("1.8"):
140+
# The FP32 projection convolution returns inaccurate values on Turing.
141+
threshold = 0.98
142+
133143
cos_sim = cosine_similarity(ref_output, trt_output)
134144
self.assertTrue(
135-
cos_sim > COSINE_THRESHOLD,
136-
f"MobileNetV2 cosine similarity {cos_sim} below threshold {COSINE_THRESHOLD}",
145+
cos_sim > threshold,
146+
f"MobileNetV2 cosine similarity {cos_sim} below threshold {threshold}",
137147
)
138148

139149
del compiled

0 commit comments

Comments
 (0)