From 348c83f0b81e776d4afe1d0b0a8c29875e78f1fc Mon Sep 17 00:00:00 2001 From: Chris Sidebottom Date: Fri, 18 Mar 2022 13:46:18 +0000 Subject: [PATCH] Mark x86 specific test Currently this test crashes pytest on any other architecture, this introduces a decorator which can be used to mark future x86 tests. --- python/tvm/testing/utils.py | 17 +++++++++++++++++ tests/python/relay/test_op_level2.py | 1 + 2 files changed, 18 insertions(+) diff --git a/python/tvm/testing/utils.py b/python/tvm/testing/utils.py index 49a8aa796a64..b21e722be630 100644 --- a/python/tvm/testing/utils.py +++ b/python/tvm/testing/utils.py @@ -68,6 +68,7 @@ def test_something(): import functools import logging import os +import platform import sys import time import pickle @@ -545,6 +546,22 @@ def uses_gpu(*args): return _compose(args, _uses_gpu) +def requires_x86(*args): + """Mark a test as requiring the x86 Architecture to run. + + Tests with this mark will not be run unless on an x86 platform. + + Parameters + ---------- + f : function + Function to mark + """ + _requires_x86 = [ + pytest.mark.skipif(platform.machine() != "x86_64", reason="x86 Architecture Required"), + ] + return _compose(args, _requires_x86) + + def requires_gpu(*args): """Mark a test as requiring a GPU to run. diff --git a/tests/python/relay/test_op_level2.py b/tests/python/relay/test_op_level2.py index ab34324d4118..bd9536742a8b 100644 --- a/tests/python/relay/test_op_level2.py +++ b/tests/python/relay/test_op_level2.py @@ -1644,6 +1644,7 @@ def test_upsampling3d(): _test_upsampling3d("NDHWC", "trilinear", "align_corners") +@tvm.testing.requires_x86 @pytest.mark.skipif(tvm.target.codegen.llvm_version_major() < 8, reason="Requires LLVM 8") class TestConv2DInt8Intrinsics: supported_targets = [