Skip to content

Commit 94cf2b5

Browse files
committed
add fail fast actions
1 parent 727cbd2 commit 94cf2b5

18 files changed

+79
-11
lines changed

.github/workflows/build-test-linux-x86_64.yml

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,50 @@ jobs:
7575
smoke-test-script: ${{ matrix.smoke-test-script }}
7676
trigger-event: ${{ github.event_name }}
7777

78+
tests-py-fail-fast:
79+
name: Test fail fast [Python]
80+
needs: [filter-matrix, build]
81+
strategy:
82+
fail-fast: false
83+
matrix:
84+
include:
85+
- repository: pytorch/tensorrt
86+
package-name: torch_tensorrt
87+
pre-script: packaging/pre_build_script.sh
88+
post-script: packaging/post_build_script.sh
89+
smoke-test-script: packaging/smoke_test_script.sh
90+
uses: ./.github/workflows/linux-test.yml
91+
with:
92+
job-name: tests-py-critical-fail-fast
93+
repository: "pytorch/tensorrt"
94+
ref: ""
95+
test-infra-repository: pytorch/test-infra
96+
test-infra-ref: main
97+
build-matrix: ${{ needs.filter-matrix.outputs.matrix }}
98+
pre-script: ${{ matrix.pre-script }}
99+
script: |
100+
export USE_HOST_DEPS=1
101+
export CI_BUILD=1
102+
export LD_LIBRARY_PATH=/usr/lib64:$LD_LIBRARY_PATH
103+
pushd .
104+
cd tests/py
105+
python -m pip install -r requirements.txt
106+
107+
# test dynamo
108+
python -m pytest -m critical --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_backend_test_results.xml -n 4 dynamo/backend/
109+
python -m pytest -m critical -ra --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_models_result.xml --ir dynamo dynamo/models/
110+
python -m pytest -m critical --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_automatic_plugin_results.xml dynamo/automatic_plugin/
111+
python -m pytest -m critical --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_partitioning_results.xml dynamo/partitioning/
112+
python -m pytest -m critical --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_lowering_results.xml dynamo/lowering/
113+
python -m pytest -m critical --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_runtime_results.xml dynamo/runtime/
114+
115+
# test core
116+
python -m pytest -m critical --junitxml=${RUNNER_TEST_RESULTS_DIR}/core_test_results.xml core/
117+
popd
118+
78119
tests-py-torchscript-fe:
79120
name: Test torchscript frontend [Python]
80-
needs: [filter-matrix, build]
121+
needs: [filter-matrix, build, tests-py-fail-fast]
81122
strategy:
82123
fail-fast: false
83124
matrix:
@@ -113,7 +154,7 @@ jobs:
113154
114155
tests-py-dynamo-converters:
115156
name: Test dynamo converters [Python]
116-
needs: [filter-matrix, build]
157+
needs: [filter-matrix, build, tests-py-fail-fast]
117158
strategy:
118159
fail-fast: false
119160
matrix:
@@ -148,7 +189,7 @@ jobs:
148189
149190
tests-py-dynamo-fe:
150191
name: Test dynamo frontend [Python]
151-
needs: [filter-matrix, build]
192+
needs: [filter-matrix, build, tests-py-fail-fast]
152193
strategy:
153194
fail-fast: false
154195
matrix:
@@ -180,7 +221,7 @@ jobs:
180221
181222
tests-py-dynamo-serde:
182223
name: Test dynamo export serde [Python]
183-
needs: [filter-matrix, build]
224+
needs: [filter-matrix, build, tests-py-fail-fast]
184225
strategy:
185226
fail-fast: false
186227
matrix:
@@ -245,7 +286,7 @@ jobs:
245286
246287
tests-py-dynamo-core:
247288
name: Test dynamo core [Python]
248-
needs: [filter-matrix, build]
289+
needs: [filter-matrix, build, tests-py-fail-fast]
249290
strategy:
250291
fail-fast: false
251292
matrix:
@@ -278,7 +319,7 @@ jobs:
278319
279320
tests-py-dynamo-cudagraphs:
280321
name: Test dynamo cudagraphs [Python]
281-
needs: [filter-matrix, build]
322+
needs: [filter-matrix, build, tests-py-fail-fast]
282323
strategy:
283324
fail-fast: false
284325
matrix:
@@ -311,7 +352,7 @@ jobs:
311352
312353
tests-py-core:
313354
name: Test core [Python]
314-
needs: [filter-matrix, build]
355+
needs: [filter-matrix, build, tests-py-fail-fast]
315356
strategy:
316357
fail-fast: false
317358
matrix:

tests/py/core/test_classes.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
import unittest
33
from typing import Dict
44

5+
import pytest
6+
import tensorrt as trt
57
import torch
68
import torch_tensorrt
79
import torch_tensorrt as torchtrt
810
import torchvision.models as models
911
from torch_tensorrt.dynamo.runtime._TorchTensorRTModule import TorchTensorRTModule
1012

11-
import tensorrt as trt
12-
1313

1414
class TestDevice(unittest.TestCase):
15+
@pytest.mark.critical
1516
def test_from_string_constructor(self):
1617
device = torchtrt.Device("cuda:0")
1718
self.assertEqual(device.device_type, torchtrt.DeviceType.GPU)

tests/py/dynamo/automatic_plugin/test_automatic_plugin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from typing import Tuple
22

3+
import pytest
34
import torch
45
import torch.nn as nn
56
import torch_tensorrt
@@ -66,6 +67,7 @@ class TestAutomaticPlugin(DispatchTestCase):
6667
((256, 256), torch.int),
6768
]
6869
)
70+
@pytest.mark.critical
6971
def test_mul_plugin_float(self, input_shape, dtype):
7072
class elementwise_mul(nn.Module):
7173
def forward(self, lhs, rhs):

tests/py/dynamo/backend/test_backend_compiler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# type: ignore
22
from copy import deepcopy
33

4+
import pytest
45
import torch
56
import torch_tensorrt
67
from torch.testing._internal.common_utils import TestCase, run_tests
@@ -10,6 +11,7 @@
1011

1112

1213
class TestTRTModuleNextCompilation(TestCase):
14+
@pytest.mark.critical
1315
def test_trt_module_next_full_support(self):
1416
class FullySupportedMultiOp(torch.nn.Module):
1517
def forward(self, x, y):

tests/py/dynamo/distributed/test_nccl_ops.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22

3+
import pytest
34
import torch
45
import torch.distributed as dist
56
import torch.nn as nn
@@ -17,6 +18,7 @@
1718

1819

1920
class TestGatherNcclOpsConverter(DispatchTestCase):
21+
@pytest.mark.critical
2022
@parameterized.expand([8])
2123
def test_nccl_ops(self, linear_layer_dim):
2224
class DistributedGatherModel(nn.Module):

tests/py/dynamo/lowering/test_aten_lowering_passes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import pytest
12
import torch
23
import torch_tensorrt
34
from torch.testing._internal.common_utils import TestCase, run_tests
@@ -6,6 +7,7 @@
67

78

89
class TestInputAsOutput(TestCase):
10+
@pytest.mark.critical
911
def test_input_as_output(self):
1012
class InputAsOutput(torch.nn.Module):
1113
def forward(self, x, y):
@@ -56,6 +58,7 @@ def forward(self, x, y):
5658

5759

5860
class TestLoweringPassMembership(TestCase):
61+
@pytest.mark.critical
5962
def insert_at_end(self):
6063
from torch_tensorrt.dynamo.lowering.passes import (
6164
ATEN_LOWERING_PASSES,

tests/py/dynamo/lowering/test_decompositions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515

1616
class TestLowering(TestCase):
17+
@pytest.mark.critical
1718
def test_lowering_inplace_op(self):
1819
class InPlace(torch.nn.Module):
1920
def __init__(self, *args, **kwargs) -> None:

tests/py/dynamo/models/test_dyn_models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
assertions = unittest.TestCase()
1212

1313

14+
@pytest.mark.critical
1415
@pytest.mark.unit
1516
def test_base_dynamic(ir):
1617
"""
@@ -175,6 +176,7 @@ def forward(self, x):
175176
)
176177

177178

179+
@pytest.mark.critical
178180
@pytest.mark.unit
179181
def test_resnet_dynamic(ir):
180182
"""

tests/py/dynamo/models/test_engine_cache.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def load(self, hash: str, prefix: str = "blob") -> Optional[bytes]:
5757

5858

5959
class TestHashFunction(TestCase):
60+
@pytest.mark.critical
6061
def test_reexport_is_equal(self):
6162
pyt_model = models.resnet18(pretrained=True).eval().to("cuda")
6263
example_inputs = (torch.randn((100, 3, 224, 224)).to("cuda"),)

tests/py/dynamo/models/test_export_kwargs_serde.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424

2525
@pytest.mark.unit
26+
@pytest.mark.critical
2627
def test_custom_model():
2728
class net(nn.Module):
2829
def __init__(self):
@@ -83,6 +84,7 @@ def forward(self, x, b=5, c=None, d=None):
8384

8485

8586
@pytest.mark.unit
87+
@pytest.mark.critical
8688
def test_custom_model_with_dynamo_trace():
8789
class net(nn.Module):
8890
def __init__(self):

tests/py/dynamo/models/test_export_serde.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
trt_ep_path = os.path.join(tempfile.gettempdir(), "trt.ep")
1818

1919

20+
@pytest.mark.critical
2021
@pytest.mark.unit
2122
def test_base_full_compile(ir):
2223
"""

tests/py/dynamo/models/test_models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def test_resnet18_cpu_offload(ir):
8585

8686

8787
@pytest.mark.unit
88+
@pytest.mark.critical
8889
def test_mobilenet_v2(ir):
8990
model = models.mobilenet_v2(pretrained=True).eval().to("cuda")
9091
input = torch.randn((1, 3, 224, 224)).to("cuda")

tests/py/dynamo/models/test_models_export.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def test_mobilenet_v2(ir):
8181

8282

8383
@pytest.mark.unit
84+
@pytest.mark.critical
8485
def test_efficientnet_b0(ir):
8586
model = timm.create_model("efficientnet_b0", pretrained=True).eval().to("cuda")
8687
input = torch.randn((1, 3, 224, 224)).to("cuda")

tests/py/dynamo/partitioning/test_fast_partitioning.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from copy import deepcopy
22

33
import numpy as np
4+
import pytest
45
import torch
56
from torch.testing._internal.common_utils import TestCase, run_tests
67
from torch_tensorrt.dynamo import partitioning
@@ -55,6 +56,7 @@ def forward(self, x, y):
5556
"Single operators can be segmented if full compilation is required",
5657
)
5758

59+
@pytest.mark.critical
5860
def test_partition_fully_supported_multi_op(self):
5961
class FullySupportedMultiOp(torch.nn.Module):
6062
def __init__(self, *args, **kwargs) -> None:

tests/py/dynamo/partitioning/test_global_partitioning.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def forward(self, x, y):
9595
"Single operators can be segmented if full compilation is required",
9696
)
9797

98+
@pytest.mark.critical
9899
def test_partition_fully_supported_multi_op(self):
99100
class FullySupportedMultiOp(torch.nn.Module):
100101
def __init__(self, *args, **kwargs) -> None:

tests/py/dynamo/runtime/test_000_convert_module_to_trt_engine.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import unittest
22

3+
import pytest
4+
import tensorrt as trt
35
import torch
46
import torch_tensorrt
57
from torch_tensorrt.dynamo.runtime import PythonTorchTensorRTModule
68
from torch_tensorrt.dynamo.utils import COSINE_THRESHOLD, cosine_similarity
79

8-
import tensorrt as trt
9-
1010

1111
class TestConvertModuleToTrtEngine(unittest.TestCase):
12+
@pytest.mark.critical
1213
def test_convert_module(self):
1314
class Test(torch.nn.Module):
1415
def forward(self, a, b):

tests/py/dynamo/runtime/test_output_allocator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class TestOutputAllocatorStaticModel(TestCase):
4848
("cpp_runtime", False),
4949
]
5050
)
51+
@pytest.mark.critical
5152
def test_cudagraphs_and_output_allocator(self, _, use_python_runtime):
5253
model = StaticModel().eval().cuda()
5354
inputs = [torch.randn((2, 3), dtype=torch.float).cuda()]
@@ -157,6 +158,7 @@ class TestOutputAllocatorDDSModel(TestCase):
157158
("cpp_runtime", False),
158159
]
159160
)
161+
@pytest.mark.critical
160162
def test_cudagraphs_and_output_allocator(self, _, use_python_runtime):
161163
model = DDSModel().eval().cuda()
162164
inputs = (torch.randint(low=0, high=3, size=(10,), dtype=torch.int).to("cuda"),)

tests/py/dynamo/runtime/test_pre_allocated_outputs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import pytest
12
import torch
23
import torch_tensorrt as torchtrt
34
from parameterized import parameterized
@@ -14,6 +15,7 @@ class TestPreAllocatedOutputs(TestCase):
1415
("cpp_runtime", False),
1516
]
1617
)
18+
@pytest.mark.critical
1719
def test_pre_allocated_outputs_default(self, _, use_python_runtime):
1820
class SampleModel(torch.nn.Module):
1921
def forward(self, x):

0 commit comments

Comments
 (0)