Skip to content
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

Restore "pytest.mark.gpu" for RELAX tests #16741

Merged
merged 5 commits into from
Apr 23, 2024
Merged
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
10 changes: 2 additions & 8 deletions tests/python/relax/test_codegen_cublas.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,7 @@ def reset_seed():
np.random.seed(0)


has_cublas = tvm.get_global_func("relax.ext.cublas", True)

cublas_enabled = pytest.mark.skipif(
not has_cublas,
reason="CUBLAS not enabled.",
)

pytestmark = [cublas_enabled]
pytestmark = tvm.testing.requires_cublas.marks()


def build_and_run(mod, inputs_np, target, legalize=False, cuda_graph=False):
Expand Down Expand Up @@ -231,6 +224,7 @@ def test_matmul_igemm_offload(
tvm.testing.assert_allclose(out, ref, rtol=1e-2, atol=1e-2)


@tvm.testing.requires_cuda_compute_version(9)
@pytest.mark.skipif(ml_dtypes is None, reason="requires ml_dtypes to be installed")
@pytest.mark.parametrize(
"x_shape, y_shape, transpose_y, out_dtype",
Expand Down
9 changes: 1 addition & 8 deletions tests/python/relax/test_codegen_cudnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,7 @@ def reset_seed():
np.random.seed(0)


has_cudnn = tvm.get_global_func("relax.ext.cudnn", True)

cudnn_enabled = pytest.mark.skipif(
not has_cudnn,
reason="cuDNN not enabled.",
)

pytestmark = [cudnn_enabled]
pytestmark = tvm.testing.requires_cudnn.marks()


_activation_table = {
Expand Down
9 changes: 1 addition & 8 deletions tests/python/relax/test_codegen_cutlass.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,7 @@ def main(
return conv2


has_cutlass = tvm.get_global_func("relax.ext.cutlass", True)

cutlass_enabled = pytest.mark.skipif(
not has_cutlass,
reason="CUTLASS not enabled.",
)

pytestmark = [cutlass_enabled]
pytestmark = tvm.testing.requires_cutlass.marks()


def build_and_run(mod, inputs_np, target, legalize=True, cuda_graph=False):
Expand Down
13 changes: 11 additions & 2 deletions tests/python/relax/test_codegen_tensorrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,22 @@ def main(


has_tensorrt = tvm.get_global_func("relax.ext.tensorrt", True)
env_checker_runtime = tvm.get_global_func("relax.is_tensorrt_runtime_enabled", True)

tensorrt_enabled = pytest.mark.skipif(
requires_tensorrt_codegen = pytest.mark.skipif(
not has_tensorrt,
reason="TENSORRT not enabled.",
)

pytestmark = [tensorrt_enabled]
requires_tensorrt_runtime = pytest.mark.skipif(
not env_checker_runtime or not env_checker_runtime(),
reason="TensorRT runtime not available",
)

pytestmark = [
requires_tensorrt_codegen,
requires_tensorrt_runtime,
] + tvm.testing.requires_cuda.marks()


def build_and_run(mod, inputs_np, target, legalize=False):
Expand Down
2 changes: 1 addition & 1 deletion tests/python/relax/test_contrib_vllm.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
reason="VLLM not enabled.",
)

pytestmark = [vllm_enabled]
pytestmark = [vllm_enabled] + tvm.testing.requires_cuda.marks()


def build_and_run(mod, inputs_np, target, legalize=True):
Expand Down
10 changes: 6 additions & 4 deletions tests/python/relax/test_transform_codegen_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@
env_checker_codegen = tvm.get_global_func("relax.ext.tensorrt", True)
env_checker_runtime = tvm.get_global_func("relax.is_tensorrt_runtime_enabled", True)

has_tensorrt_codegen = pytest.mark.skipif(
requires_tensorrt_codegen = pytest.mark.skipif(
not env_checker_codegen,
reason="TensorRT codegen not available",
)
has_tensorrt_runtime = pytest.mark.skipif(
requires_tensorrt_runtime = pytest.mark.skipif(
not env_checker_runtime or not env_checker_runtime(),
reason="TensorRT runtime not available",
)

# Global variable in pytest that applies markers to all tests.
pytestmark = [has_tensorrt_codegen, has_tensorrt_runtime]
pytestmark = [requires_tensorrt_codegen] + tvm.testing.requires_cuda.marks()

# Target gpu
target_str = "nvidia/nvidia-t4"
Expand Down Expand Up @@ -117,6 +117,7 @@ def setup_test():


@tvm.testing.requires_gpu
@requires_tensorrt_runtime
def test_tensorrt_only(entry_func_name):
mod, inputs, expected = setup_test()

Expand Down Expand Up @@ -146,6 +147,7 @@ def test_tensorrt_only(entry_func_name):


@tvm.testing.requires_gpu
@requires_tensorrt_runtime
def test_mix_use_tensorrt_and_tvm():
mod, inputs, expected = setup_test()

Expand Down Expand Up @@ -367,7 +369,7 @@ def test_no_op_for_call_to_tir():
@tvm.script.ir_module
class Before:
@R.function
def main(x: R.Tensor):
def main(x: R.Tensor([4], "int64")):
R.func_attr({"relax.force_pure": True})
_ = Before.shape_func(x)
return x
Expand Down
Loading