Skip to content

Commit 6fe730c

Browse files
committed
revert arm_cpu strategy changes
1 parent 8828561 commit 6fe730c

File tree

6 files changed

+37
-9
lines changed

6 files changed

+37
-9
lines changed

python/tvm/relay/op/strategy/arm_cpu.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,11 @@ def conv2d_strategy_arm_cpu(attrs, inputs, out_type, target):
162162
)
163163
elif layout == "NHWC":
164164
if isa.has_dsp_support and kernel_layout == "HWOI":
165-
# TODO(mehrdadh): Only integer type due to
166-
# https://github.com/apache/tvm/issues/11351
167-
if data.dtype in ["int8", "int16"] and out_dtype == "int32":
168-
strategy.add_implementation(
169-
wrap_compute_conv2d(topi.arm_cpu.conv2d_nhwc_dsp),
170-
wrap_topi_schedule(topi.arm_cpu.schedule_conv2d_nhwc_dsp),
171-
name="conv2d_nhwc_dsp.arm_cpu",
172-
)
165+
strategy.add_implementation(
166+
wrap_compute_conv2d(topi.arm_cpu.conv2d_nhwc_dsp),
167+
wrap_topi_schedule(topi.arm_cpu.schedule_conv2d_nhwc_dsp),
168+
name="conv2d_nhwc_dsp.arm_cpu",
169+
)
173170
elif kernel_layout == "HWIO":
174171
is_aarch64 = topi.arm_cpu.arm_utils.is_aarch64_arm()
175172
has_dot_prod = topi.arm_cpu.arm_utils.is_dotprod_available()

tests/micro/zephyr/conftest.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,18 @@ def temp_dir(board, tvm_debug):
7979
keep_for_debug = tvm_debug if tvm_debug else None
8080
test_temp_dir = tempdir(custom_path=board_workspace, keep_for_debug=keep_for_debug)
8181
return test_temp_dir
82+
83+
84+
@pytest.fixture(autouse=True)
85+
def skip_by_board(request, board):
86+
"""Skip test if board is in the list."""
87+
if request.node.get_closest_marker("skip_boards"):
88+
if board in request.node.get_closest_marker("skip_boards").args[0]:
89+
pytest.skip("skipped on this board: {}".format(board))
90+
91+
92+
def pytest_configure(config):
93+
config.addinivalue_line(
94+
"markers",
95+
"skip_by_board(board): skip test for the given board",
96+
)

tests/micro/zephyr/test_zephyr.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from tvm.relay.testing import byoc
3333
from tvm.contrib import utils
3434
from tvm.micro.testing import check_tune_log
35+
from tvm.target import arm_isa
3536

3637
import test_utils
3738

@@ -87,6 +88,7 @@ def _make_add_sess(temp_dir, model, zephyr_board, west_cmd, build_config, dtype=
8788

8889
# The same test code can be executed on both the QEMU simulation and on real hardware.
8990
@tvm.testing.requires_micro
91+
@pytest.mark.skip_boards(["mps2_an521"])
9092
def test_add_uint(temp_dir, board, west_cmd, tvm_debug):
9193
"""Test compiling the on-device runtime."""
9294

@@ -112,6 +114,7 @@ def test_basic_add(sess):
112114

113115
# The same test code can be executed on both the QEMU simulation and on real hardware.
114116
@tvm.testing.requires_micro
117+
@pytest.mark.skip_boards(["mps2_an521"])
115118
def test_add_float(temp_dir, board, west_cmd, tvm_debug):
116119
"""Test compiling the on-device runtime."""
117120
model = test_utils.ZEPHYR_BOARDS[board]
@@ -138,6 +141,7 @@ def test_basic_add(sess):
138141

139142

140143
@tvm.testing.requires_micro
144+
@pytest.mark.skip_boards(["mps2_an521"])
141145
def test_platform_timer(temp_dir, board, west_cmd, tvm_debug):
142146
"""Test compiling the on-device runtime."""
143147

@@ -167,6 +171,7 @@ def test_basic_add(sess):
167171

168172

169173
@tvm.testing.requires_micro
174+
@pytest.mark.skip_boards(["mps2_an521"])
170175
def test_relay(temp_dir, board, west_cmd, tvm_debug):
171176
"""Testing a simple relay graph"""
172177
model = test_utils.ZEPHYR_BOARDS[board]
@@ -199,6 +204,7 @@ def test_relay(temp_dir, board, west_cmd, tvm_debug):
199204

200205

201206
@tvm.testing.requires_micro
207+
@pytest.mark.skip_boards(["mps2_an521"])
202208
def test_onnx(temp_dir, board, west_cmd, tvm_debug):
203209
"""Testing a simple ONNX model."""
204210
model = test_utils.ZEPHYR_BOARDS[board]
@@ -279,6 +285,7 @@ def check_result(
279285

280286

281287
@tvm.testing.requires_micro
288+
@pytest.mark.skip_boards(["mps2_an521"])
282289
def test_byoc_microtvm(temp_dir, board, west_cmd, tvm_debug):
283290
"""This is a simple test case to check BYOC capabilities of microTVM"""
284291
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
359366
],
360367
)
361368
@tvm.testing.requires_micro
369+
@pytest.mark.skip_boards(["mps2_an521"])
362370
def test_rpc_large_array(temp_dir, board, west_cmd, tvm_debug, shape):
363371
"""Test large RPC array transfer."""
364372
model = test_utils.ZEPHYR_BOARDS[board]
@@ -511,6 +519,11 @@ def test_schedule_build_with_cmsis_dependency(temp_dir, board, west_cmd, tvm_deb
511519
"""
512520
model = test_utils.ZEPHYR_BOARDS[board]
513521
build_config = {"debug": tvm_debug}
522+
target = tvm.target.target.micro(model, options=["-keys=arm_cpu,cpu"])
523+
524+
isa = arm_isa.IsaAnalyzer(target)
525+
if not isa.has_dsp_support:
526+
pytest.skip(f"ISA does not support DSP. target: {target}")
514527

515528
# Create a Relay conv2d
516529
data_shape = (1, 16, 16, 3)
@@ -530,7 +543,6 @@ def test_schedule_build_with_cmsis_dependency(temp_dir, board, west_cmd, tvm_deb
530543
ir_mod = tvm.IRModule.from_expr(func)
531544

532545
runtime = Runtime("crt", {"system-lib": True})
533-
target = tvm.target.target.micro(model, options=["-keys=arm_cpu,cpu"])
534546

535547
with tvm.transform.PassContext(opt_level=3, config={"tir.disable_vectorize": True}):
536548
mod = tvm.relay.build(ir_mod, target=target, runtime=runtime)

tests/micro/zephyr/test_zephyr_aot.py

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

4040

4141
@tvm.testing.requires_micro
42+
@pytest.mark.skip_boards(["mps2_an521"])
4243
def test_tflite(temp_dir, board, west_cmd, tvm_debug):
4344
"""Testing a TFLite model."""
4445
model = test_utils.ZEPHYR_BOARDS[board]
@@ -94,6 +95,7 @@ def test_tflite(temp_dir, board, west_cmd, tvm_debug):
9495

9596

9697
@tvm.testing.requires_micro
98+
@pytest.mark.skip_boards(["mps2_an521"])
9799
def test_qemu_make_fail(temp_dir, board, west_cmd, tvm_debug):
98100
"""Testing QEMU make fail."""
99101
if board not in ["qemu_x86", "mps2_an521", "mps3_an547"]:

tests/micro/zephyr/test_zephyr_armv7m.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def _apply_desired_layout_no_simd(relay_mod):
103103

104104

105105
@tvm.testing.requires_micro
106+
@pytest.mark.skip_boards(["mps2_an521"])
106107
def test_armv7m_intrinsic(temp_dir, board, west_cmd, tvm_debug):
107108
"""Testing a ARM v7m SIMD extension."""
108109

tests/scripts/task_python_microtvm.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ make cython3
2828
run_pytest ctypes python-microtvm-zephyr-qemu_x86 tests/micro/zephyr --zephyr-board=qemu_x86
2929
run_pytest ctypes python-microtvm-zephyr-qemu_riscv32 tests/micro/zephyr --zephyr-board=qemu_riscv32
3030
run_pytest ctypes python-microtvm-zephyr-qemu_riscv64 tests/micro/zephyr --zephyr-board=qemu_riscv64
31+
run_pytest ctypes python-microtvm-zephyr-mps2_an521 tests/micro/zephyr --zephyr-board=mps2_an521
3132

3233
# Arduino
3334
run_pytest ctypes python-microtvm-arduino apps/microtvm/arduino/template_project/tests

0 commit comments

Comments
 (0)