diff --git a/python/tvm/relay/op/strategy/arm_cpu.py b/python/tvm/relay/op/strategy/arm_cpu.py index a2079f9aa744..7f0e0db7185d 100644 --- a/python/tvm/relay/op/strategy/arm_cpu.py +++ b/python/tvm/relay/op/strategy/arm_cpu.py @@ -162,14 +162,11 @@ def conv2d_strategy_arm_cpu(attrs, inputs, out_type, target): ) elif layout == "NHWC": if isa.has_dsp_support and kernel_layout == "HWOI": - # TODO(mehrdadh): Only integer type due to - # https://github.com/apache/tvm/issues/11351 - if data.dtype in ["int8", "int16"] and out_dtype == "int32": - strategy.add_implementation( - wrap_compute_conv2d(topi.arm_cpu.conv2d_nhwc_dsp), - wrap_topi_schedule(topi.arm_cpu.schedule_conv2d_nhwc_dsp), - name="conv2d_nhwc_dsp.arm_cpu", - ) + strategy.add_implementation( + wrap_compute_conv2d(topi.arm_cpu.conv2d_nhwc_dsp), + wrap_topi_schedule(topi.arm_cpu.schedule_conv2d_nhwc_dsp), + name="conv2d_nhwc_dsp.arm_cpu", + ) elif kernel_layout == "HWIO": is_aarch64 = topi.arm_cpu.arm_utils.is_aarch64_arm() has_dot_prod = topi.arm_cpu.arm_utils.is_dotprod_available() diff --git a/tests/micro/zephyr/conftest.py b/tests/micro/zephyr/conftest.py index 0cfeed77abe2..997237d370a5 100644 --- a/tests/micro/zephyr/conftest.py +++ b/tests/micro/zephyr/conftest.py @@ -79,3 +79,18 @@ def temp_dir(board, tvm_debug): keep_for_debug = tvm_debug if tvm_debug else None test_temp_dir = tempdir(custom_path=board_workspace, keep_for_debug=keep_for_debug) return test_temp_dir + + +@pytest.fixture(autouse=True) +def skip_by_board(request, board): + """Skip test if board is in the list.""" + if request.node.get_closest_marker("skip_boards"): + if board in request.node.get_closest_marker("skip_boards").args[0]: + pytest.skip("skipped on this board: {}".format(board)) + + +def pytest_configure(config): + config.addinivalue_line( + "markers", + "skip_by_board(board): skip test for the given board", + ) diff --git a/tests/micro/zephyr/test_zephyr.py b/tests/micro/zephyr/test_zephyr.py index 0ea603837714..af5598cda8c7 100644 --- a/tests/micro/zephyr/test_zephyr.py +++ b/tests/micro/zephyr/test_zephyr.py @@ -32,6 +32,7 @@ from tvm.relay.testing import byoc from tvm.contrib import utils from tvm.micro.testing import check_tune_log +from tvm.target import arm_isa import test_utils @@ -87,6 +88,7 @@ def _make_add_sess(temp_dir, model, zephyr_board, west_cmd, build_config, dtype= # The same test code can be executed on both the QEMU simulation and on real hardware. @tvm.testing.requires_micro +@pytest.mark.skip_boards(["mps2_an521"]) def test_add_uint(temp_dir, board, west_cmd, tvm_debug): """Test compiling the on-device runtime.""" @@ -112,6 +114,7 @@ def test_basic_add(sess): # The same test code can be executed on both the QEMU simulation and on real hardware. @tvm.testing.requires_micro +@pytest.mark.skip_boards(["mps2_an521"]) def test_add_float(temp_dir, board, west_cmd, tvm_debug): """Test compiling the on-device runtime.""" model = test_utils.ZEPHYR_BOARDS[board] @@ -138,6 +141,7 @@ def test_basic_add(sess): @tvm.testing.requires_micro +@pytest.mark.skip_boards(["mps2_an521"]) def test_platform_timer(temp_dir, board, west_cmd, tvm_debug): """Test compiling the on-device runtime.""" @@ -167,6 +171,7 @@ def test_basic_add(sess): @tvm.testing.requires_micro +@pytest.mark.skip_boards(["mps2_an521"]) def test_relay(temp_dir, board, west_cmd, tvm_debug): """Testing a simple relay graph""" model = test_utils.ZEPHYR_BOARDS[board] @@ -199,6 +204,7 @@ def test_relay(temp_dir, board, west_cmd, tvm_debug): @tvm.testing.requires_micro +@pytest.mark.skip_boards(["mps2_an521"]) def test_onnx(temp_dir, board, west_cmd, tvm_debug): """Testing a simple ONNX model.""" model = test_utils.ZEPHYR_BOARDS[board] @@ -279,6 +285,7 @@ def check_result( @tvm.testing.requires_micro +@pytest.mark.skip_boards(["mps2_an521"]) def test_byoc_microtvm(temp_dir, board, west_cmd, tvm_debug): """This is a simple test case to check BYOC capabilities of microTVM""" model = test_utils.ZEPHYR_BOARDS[board] @@ -359,6 +366,7 @@ def _make_add_sess_with_shape(temp_dir, model, zephyr_board, west_cmd, shape, bu ], ) @tvm.testing.requires_micro +@pytest.mark.skip_boards(["mps2_an521"]) def test_rpc_large_array(temp_dir, board, west_cmd, tvm_debug, shape): """Test large RPC array transfer.""" model = test_utils.ZEPHYR_BOARDS[board] @@ -511,6 +519,11 @@ def test_schedule_build_with_cmsis_dependency(temp_dir, board, west_cmd, tvm_deb """ model = test_utils.ZEPHYR_BOARDS[board] build_config = {"debug": tvm_debug} + target = tvm.target.target.micro(model, options=["-keys=arm_cpu,cpu"]) + + isa = arm_isa.IsaAnalyzer(target) + if not isa.has_dsp_support: + pytest.skip(f"ISA does not support DSP. target: {target}") # Create a Relay conv2d data_shape = (1, 16, 16, 3) @@ -530,7 +543,6 @@ def test_schedule_build_with_cmsis_dependency(temp_dir, board, west_cmd, tvm_deb ir_mod = tvm.IRModule.from_expr(func) runtime = Runtime("crt", {"system-lib": True}) - target = tvm.target.target.micro(model, options=["-keys=arm_cpu,cpu"]) with tvm.transform.PassContext(opt_level=3, config={"tir.disable_vectorize": True}): mod = tvm.relay.build(ir_mod, target=target, runtime=runtime) diff --git a/tests/micro/zephyr/test_zephyr_aot.py b/tests/micro/zephyr/test_zephyr_aot.py index 87c7dc92fbda..9a8ff773973d 100644 --- a/tests/micro/zephyr/test_zephyr_aot.py +++ b/tests/micro/zephyr/test_zephyr_aot.py @@ -39,6 +39,7 @@ @tvm.testing.requires_micro +@pytest.mark.skip_boards(["mps2_an521"]) def test_tflite(temp_dir, board, west_cmd, tvm_debug): """Testing a TFLite model.""" model = test_utils.ZEPHYR_BOARDS[board] @@ -94,6 +95,7 @@ def test_tflite(temp_dir, board, west_cmd, tvm_debug): @tvm.testing.requires_micro +@pytest.mark.skip_boards(["mps2_an521"]) def test_qemu_make_fail(temp_dir, board, west_cmd, tvm_debug): """Testing QEMU make fail.""" if board not in ["qemu_x86", "mps2_an521", "mps3_an547"]: diff --git a/tests/micro/zephyr/test_zephyr_armv7m.py b/tests/micro/zephyr/test_zephyr_armv7m.py index 47b78994e039..de3af89b16b4 100644 --- a/tests/micro/zephyr/test_zephyr_armv7m.py +++ b/tests/micro/zephyr/test_zephyr_armv7m.py @@ -103,6 +103,7 @@ def _apply_desired_layout_no_simd(relay_mod): @tvm.testing.requires_micro +@pytest.mark.skip_boards(["mps2_an521"]) def test_armv7m_intrinsic(temp_dir, board, west_cmd, tvm_debug): """Testing a ARM v7m SIMD extension.""" diff --git a/tests/scripts/task_python_microtvm.sh b/tests/scripts/task_python_microtvm.sh index d13ee91a0ba8..96c3c7b75a16 100755 --- a/tests/scripts/task_python_microtvm.sh +++ b/tests/scripts/task_python_microtvm.sh @@ -28,6 +28,7 @@ make cython3 run_pytest ctypes python-microtvm-zephyr-qemu_x86 tests/micro/zephyr --zephyr-board=qemu_x86 run_pytest ctypes python-microtvm-zephyr-qemu_riscv32 tests/micro/zephyr --zephyr-board=qemu_riscv32 run_pytest ctypes python-microtvm-zephyr-qemu_riscv64 tests/micro/zephyr --zephyr-board=qemu_riscv64 +run_pytest ctypes python-microtvm-zephyr-mps2_an521 tests/micro/zephyr --zephyr-board=mps2_an521 # Arduino run_pytest ctypes python-microtvm-arduino apps/microtvm/arduino/template_project/tests