Skip to content

add a quick fail fast feed-back actions before the full tests is triggered #3541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/scripts/install-torch-tensorrt.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#set -exou pipefail
set -x

dnf install -y sqlite-devel

ldconfig -p | grep sqlite

find /usr -print | grep libsqlite3.so

TORCH_TORCHVISION=$(grep "^torch" ${PWD}/py/requirements.txt)
INDEX_URL=https://download.pytorch.org/whl/${CHANNEL}/${CU_VERSION}
PLATFORM=$(python -c "import sys; print(sys.platform)")
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/build-test-linux-aarch64-jetpack.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: Build and test Linux aarch64 wheels for Jetpack

on:
pull_request:
#pull_request:
workflow_run:
workflows: ["Build and test Linux x86_64 wheels"]
types:
- completed
push:
branches:
- main
Expand All @@ -15,6 +19,7 @@ on:

jobs:
generate-matrix:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
with:
package-type: wheel
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/build-test-linux-aarch64.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: Build and test Linux aarch64 wheels

on:
pull_request:
#pull_request:
workflow_run:
workflows: ["Build and test Linux x86_64 wheels"]
types:
- completed
push:
branches:
- main
Expand All @@ -15,6 +19,7 @@ on:

jobs:
generate-matrix:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
with:
package-type: wheel
Expand Down
69 changes: 61 additions & 8 deletions .github/workflows/build-test-linux-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,62 @@ jobs:
smoke-test-script: ${{ matrix.smoke-test-script }}
trigger-event: ${{ github.event_name }}

tests-py-fail-fast:
name: Test fail fast [Python]
needs: [filter-matrix, build]
strategy:
fail-fast: false
matrix:
include:
- repository: pytorch/tensorrt
package-name: torch_tensorrt
pre-script: packaging/pre_build_script.sh
post-script: packaging/post_build_script.sh
smoke-test-script: packaging/smoke_test_script.sh
uses: ./.github/workflows/linux-test.yml
with:
job-name: tests-py-critical-fail-fast
repository: "pytorch/tensorrt"
ref: ""
test-infra-repository: pytorch/test-infra
test-infra-ref: main
build-matrix: ${{ needs.filter-matrix.outputs.matrix }}
pre-script: ${{ matrix.pre-script }}
script: |
export USE_HOST_DEPS=1
export CI_BUILD=1
export LD_LIBRARY_PATH=/usr/lib64:$LD_LIBRARY_PATH
pushd .
python -m pip install -r tests/py/requirements.txt
cov_param="--cov=torch_tensorrt --cov-report= --cov-config=pyproject.toml"

# test dynamo backend
python -m pytest -m critical ${cov_param} -n 4 tests/py/dynamo/backend/

# test dynamo models
python -m pytest -m critical ${cov_param} -ra --cov-append --ir dynamo tests/py/dynamo/models/

# test dynamo automatic plugin
python -m pytest -m critical ${cov_param} --cov-append tests/py/dynamo/automatic_plugin/

# test dynamo partitioning
python -m pytest -m critical ${cov_param} --cov-append tests/py/dynamo/partitioning/

# test dynamo lowering
python -m pytest -m critical ${cov_param} --cov-append tests/py/dynamo/lowering/

# test dynamo runtime
python -m pytest ${cov_param} --cov-append tests/py/dynamo/runtime/test_000_*
python -m pytest -m critical ${cov_param} --cov-append --ignore tests/py/dynamo/runtime/test_000_* tests/py/dynamo/runtime/

# test core
python -m pytest -m critical ${cov_param} --cov-append tests/py/core/

coverage report --fail-under=20

tests-py-torchscript-fe:
name: Test torchscript frontend [Python]
needs: [filter-matrix, build]
needs: [filter-matrix, build, tests-py-fail-fast]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -113,7 +166,7 @@ jobs:

tests-py-dynamo-converters:
name: Test dynamo converters [Python]
needs: [filter-matrix, build]
needs: [filter-matrix, build, tests-py-fail-fast]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -147,7 +200,7 @@ jobs:

tests-py-dynamo-fe:
name: Test dynamo frontend [Python]
needs: [filter-matrix, build]
needs: [filter-matrix, build, tests-py-fail-fast]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -178,7 +231,7 @@ jobs:

tests-py-dynamo-serde:
name: Test dynamo export serde [Python]
needs: [filter-matrix, build]
needs: [filter-matrix, build, tests-py-fail-fast]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -210,7 +263,7 @@ jobs:

tests-py-torch-compile-be:
name: Test torch compile backend [Python]
needs: [filter-matrix, build]
needs: [filter-matrix, build, tests-py-fail-fast]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -243,7 +296,7 @@ jobs:

tests-py-dynamo-core:
name: Test dynamo core [Python]
needs: [filter-matrix, build]
needs: [filter-matrix, build, tests-py-fail-fast]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -276,7 +329,7 @@ jobs:

tests-py-dynamo-cudagraphs:
name: Test dynamo cudagraphs [Python]
needs: [filter-matrix, build]
needs: [filter-matrix, build, tests-py-fail-fast]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -309,7 +362,7 @@ jobs:

tests-py-core:
name: Test core [Python]
needs: [filter-matrix, build]
needs: [filter-matrix, build, tests-py-fail-fast]
strategy:
fail-fast: false
matrix:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/build-test-windows.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: Build and test Windows wheels

on:
pull_request:
#pull_request:
workflow_run:
workflows: ["Build and test Linux x86_64 wheels"]
types:
- completed
push:
branches:
- main
Expand All @@ -15,6 +19,7 @@ on:

jobs:
generate-matrix:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
with:
package-type: wheel
Expand Down
39 changes: 39 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ dev = [
"isort",
"ruff",
"pytest",
"pytest-cov",
"pytest-xdist",
"parameterized>=0.2.0",
"expecttest==0.1.6",
Expand All @@ -113,6 +114,44 @@ Changelog = "https://github.com/pytorch/tensorrt/releases"
package-dir = { "" = "py" }
include-package-data = false

[tool.coverage.paths]
source = [
"py/torch_tensorrt",
"*/site-packages/torch_tensorrt"
]

[tool.coverage.run]
source = ["torch_tensorrt"]
omit = [
"tests/*"
]
data_file=".coverage"
relative_files=true
branch = true

[tool.coverage.report]
skip_covered = true
ignore_errors = true
exclude_lines = [
"pragma: no cover",
# Don't complain about missing debug or verbose code
"def __repr__",
"if verbose",
# Don't complain if tests don't hit defensive exception handling code
"raise AssertionError",
"raise NotImplementedError",
"raise RuntimeError",
"raise ValueError",
"raise KeyError",
"raise AttributeError",
"except ImportError",
# Don't complain if non-runnable code isn't run
"if __name__ == \"__main__\":",
"if TYPE_CHECKING:",
# Don't complain about abstract methods, they aren't run
"@(abc\\.)?abstractmethod",
]

[tool.uv]
package = true
environments = ["sys_platform == 'linux'", "sys_platform == 'windows'"]
Expand Down
5 changes: 3 additions & 2 deletions tests/py/core/test_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
import unittest
from typing import Dict

import pytest
import tensorrt as trt
import torch
import torch_tensorrt
import torch_tensorrt as torchtrt
import torchvision.models as models
from torch_tensorrt.dynamo.runtime._TorchTensorRTModule import TorchTensorRTModule

import tensorrt as trt


class TestDevice(unittest.TestCase):
@pytest.mark.critical
def test_from_string_constructor(self):
device = torchtrt.Device("cuda:0")
self.assertEqual(device.device_type, torchtrt.DeviceType.GPU)
Expand Down
2 changes: 2 additions & 0 deletions tests/py/dynamo/automatic_plugin/test_automatic_plugin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Tuple

import pytest
import torch
import torch.nn as nn
import torch_tensorrt
Expand Down Expand Up @@ -66,6 +67,7 @@ class TestAutomaticPlugin(DispatchTestCase):
((256, 256), torch.int),
]
)
@pytest.mark.critical
def test_mul_plugin_float(self, input_shape, dtype):
class elementwise_mul(nn.Module):
def forward(self, lhs, rhs):
Expand Down
2 changes: 2 additions & 0 deletions tests/py/dynamo/backend/test_backend_compiler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# type: ignore
from copy import deepcopy

import pytest
import torch
import torch_tensorrt
from torch.testing._internal.common_utils import TestCase, run_tests
Expand All @@ -10,6 +11,7 @@


class TestTRTModuleNextCompilation(TestCase):
@pytest.mark.critical
def test_trt_module_next_full_support(self):
class FullySupportedMultiOp(torch.nn.Module):
def forward(self, x, y):
Expand Down
2 changes: 2 additions & 0 deletions tests/py/dynamo/distributed/test_nccl_ops.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os

import pytest
import torch
import torch.distributed as dist
import torch.nn as nn
Expand All @@ -17,6 +18,7 @@


class TestGatherNcclOpsConverter(DispatchTestCase):
@pytest.mark.critical
@parameterized.expand([8])
def test_nccl_ops(self, linear_layer_dim):
class DistributedGatherModel(nn.Module):
Expand Down
3 changes: 3 additions & 0 deletions tests/py/dynamo/lowering/test_aten_lowering_passes.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pytest
import torch
import torch_tensorrt
from torch.testing._internal.common_utils import TestCase, run_tests
Expand All @@ -6,6 +7,7 @@


class TestInputAsOutput(TestCase):
@pytest.mark.critical
def test_input_as_output(self):
class InputAsOutput(torch.nn.Module):
def forward(self, x, y):
Expand Down Expand Up @@ -56,6 +58,7 @@ def forward(self, x, y):


class TestLoweringPassMembership(TestCase):
@pytest.mark.critical
def insert_at_end(self):
from torch_tensorrt.dynamo.lowering.passes import (
ATEN_LOWERING_PASSES,
Expand Down
3 changes: 2 additions & 1 deletion tests/py/dynamo/lowering/test_decompositions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
)
from torch.testing._internal.common_utils import TestCase, run_tests
from torch_tensorrt.dynamo.utils import ATOL, RTOL

import pytest
from ..testing_utilities import DECIMALS_OF_AGREEMENT, lower_graph_testing


class TestLowering(TestCase):
@pytest.mark.critical
def test_lowering_inplace_op(self):
class InPlace(torch.nn.Module):
def __init__(self, *args, **kwargs) -> None:
Expand Down
2 changes: 2 additions & 0 deletions tests/py/dynamo/models/test_dyn_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
assertions = unittest.TestCase()


@pytest.mark.critical
@pytest.mark.unit
def test_base_dynamic(ir):
"""
Expand Down Expand Up @@ -175,6 +176,7 @@ def forward(self, x):
)


@pytest.mark.critical
@pytest.mark.unit
def test_resnet_dynamic(ir):
"""
Expand Down
1 change: 1 addition & 0 deletions tests/py/dynamo/models/test_engine_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def load(self, hash: str, prefix: str = "blob") -> Optional[bytes]:


class TestHashFunction(TestCase):
@pytest.mark.critical
def test_reexport_is_equal(self):
pyt_model = models.resnet18(pretrained=True).eval().to("cuda")
example_inputs = (torch.randn((100, 3, 224, 224)).to("cuda"),)
Expand Down
2 changes: 2 additions & 0 deletions tests/py/dynamo/models/test_export_kwargs_serde.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@


@pytest.mark.unit
@pytest.mark.critical
def test_custom_model():
class net(nn.Module):
def __init__(self):
Expand Down Expand Up @@ -83,6 +84,7 @@ def forward(self, x, b=5, c=None, d=None):


@pytest.mark.unit
@pytest.mark.critical
def test_custom_model_with_dynamo_trace():
class net(nn.Module):
def __init__(self):
Expand Down
Loading
Loading