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

[microTVM] Add fixture to zephyr test #8393

Merged
merged 2 commits into from
Jul 8, 2021
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
7 changes: 7 additions & 0 deletions tests/micro/zephyr/test_zephyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import tvm
import tvm.rpc
import tvm.micro
import tvm.testing
import tvm.relay as relay

from tvm.micro.contrib import zephyr
Expand Down Expand Up @@ -124,6 +125,7 @@ def _make_add_sess(model, zephyr_board, west_cmd, build_config):


# The same test code can be executed on both the QEMU simulation and on real hardware.
@tvm.testing.requires_micro
def test_compile_runtime(platform, west_cmd, skip_build, tvm_debug):
"""Test compiling the on-device runtime."""

Expand All @@ -147,6 +149,7 @@ def test_basic_add(sess):
test_basic_add(sess)


@tvm.testing.requires_micro
def test_platform_timer(platform, west_cmd, skip_build, tvm_debug):
"""Test compiling the on-device runtime."""

Expand Down Expand Up @@ -175,6 +178,7 @@ def test_basic_add(sess):
test_basic_add(sess)


@tvm.testing.requires_micro
def test_relay(platform, west_cmd, skip_build, tvm_debug):
"""Testing a simple relay graph"""
model, zephyr_board = PLATFORMS[platform]
Expand Down Expand Up @@ -204,6 +208,7 @@ def test_relay(platform, west_cmd, skip_build, tvm_debug):
tvm.testing.assert_allclose(result, x_in * x_in + 1)


@tvm.testing.requires_micro
def test_onnx(platform, west_cmd, skip_build, tvm_debug):
"""Testing a simple ONNX model."""
model, zephyr_board = PLATFORMS[platform]
Expand Down Expand Up @@ -334,6 +339,7 @@ def check_result(
tvm.testing.assert_allclose(out.numpy(), results[idx], rtol=TOL, atol=TOL)


@tvm.testing.requires_micro
def test_byoc_microtvm(platform, west_cmd, skip_build, tvm_debug):
"""This is a simple test case to check BYOC capabilities of microTVM"""
model, zephyr_board = PLATFORMS[platform]
Expand Down Expand Up @@ -410,6 +416,7 @@ def _make_add_sess_with_shape(model, zephyr_board, west_cmd, shape, build_config
pytest.param((16 * 1024,), id="(16*1024)"),
],
)
@tvm.testing.requires_micro
def test_rpc_large_array(platform, west_cmd, skip_build, tvm_debug, shape):
"""Test large RPC array transfer."""
model, zephyr_board = PLATFORMS[platform]
Expand Down
6 changes: 6 additions & 0 deletions tests/micro/zephyr/test_zephyr_aot.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import tvm
import tvm.rpc
import tvm.micro
import tvm.testing
import tvm.relay as relay

from tvm.micro.contrib import zephyr
Expand Down Expand Up @@ -152,6 +153,7 @@ def _get_message(fd, expr: str):
return data


@tvm.testing.requires_micro
def test_tflite(platform, west_cmd, skip_build, tvm_debug):
"""Testing a TFLite model."""
model, zephyr_board = PLATFORMS[platform]
Expand Down Expand Up @@ -213,7 +215,11 @@ def test_tflite(platform, west_cmd, skip_build, tvm_debug):
assert result == 8


@tvm.testing.requires_micro
def test_qemu_make_fail(platform, west_cmd, skip_build, tvm_debug):
if platform not in ["host", "mps2_an521"]:
pytest.skip(msg="Only for QEMU targets.")

"""Testing QEMU make fail."""
model, zephyr_board = PLATFORMS[platform]
build_config = {"skip_build": skip_build, "debug": tvm_debug}
Expand Down