Skip to content
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
42 changes: 23 additions & 19 deletions tests/python/relay/aot/test_c_device_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,42 +143,46 @@ def test_device_api_hooks_unpacked_api(device_api_main_func):

# Activate Device
assert (
str(main_func.body[0])
== "tir.tvm_check_return(0, -1, tir.call_extern("
+ '"TVMDeviceEthosUActivate",'
+ " device_context_ethos_u))\n"
str(main_func.body[0].value)
== "T.tvm_check_return(0, -1, T.call_extern("
+ '"int32",'
+ ' "TVMDeviceEthosUActivate",'
+ " device_context_ethos_u))"
)
# Open Device
print("main func", repr(main_func.body))
assert (
str(main_func.body[1][0][0][0])
== "tir.tvm_check_return(0, -1, tir.call_extern("
+ '"TVMDeviceEthosUOpen",'
+ " device_context_ethos_u))\n"
str(main_func.body[1].value)
== "T.tvm_check_return(0, -1, T.call_extern("
+ '"int32",'
+ ' "TVMDeviceEthosUOpen",'
+ " device_context_ethos_u))"
)
# Device Call
# We dont need to check exact input and output var names in this test.
# Hence, using a regex to cover any legal I/O name.
regex = re.compile(
r"tir\.tvm_check_return\("
r"T\.tvm_check_return\("
r"0, -1, "
r'tir\.call_extern\("tvmgen_default_ethos_u_main_0", '
r'T\.call_extern\("int32", "tvmgen_default_ethos_u_main_0", '
r"\w+, \w+, device_context_ethos_u\)\)"
)
assert regex.match(str(main_func.body[1][0][0][1]))
assert regex.match(str(main_func.body[2].value))
# Close Device
assert (
str(main_func.body[1][0][0][2])
== "tir.tvm_check_return(0, -1, tir.call_extern("
+ '"TVMDeviceEthosUClose",'
+ " device_context_ethos_u))\n"
str(main_func.body[3].value)
== "T.tvm_check_return(0, -1, T.call_extern("
+ '"int32",'
+ ' "TVMDeviceEthosUClose",'
+ " device_context_ethos_u))"
)
# Deactivate Device
assert (
str(str(main_func.body[2]))
== "tir.tvm_check_return(0, -1, tir.call_extern("
+ '"TVMDeviceEthosUDeactivate",'
+ " device_context_ethos_u))\n"
str(str(main_func.body[4].value))
== "T.tvm_check_return(0, -1, T.call_extern("
+ '"int32",'
+ ' "TVMDeviceEthosUDeactivate",'
+ " device_context_ethos_u))"
)


Expand Down
6 changes: 3 additions & 3 deletions tests/python/relay/aot/test_crt_forward_declarations.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_external_calls(test_runner):
main_source.count("TVMBackendAllocWorkspace") == 3
or main_source.count("TVMBackendAllocWorkspace") == 0
)
assert main_source.count("tvmgen_default_fused_reshape") == 2
assert main_source.count("tvmgen_default_fused_reshape") == 3
assert main_source.count("tvmgen_default_cmsis_nn_main") == 12
cmsisnn_source = lib_mod.imported_modules[0].get_source()
assert cmsisnn_source.count("arm_convolve_wrapper") == 1
Expand Down Expand Up @@ -243,8 +243,8 @@ def test_tensorized_calls():

lib_mod = compiled_models[0].executor_factory.lib.imported_modules[0]
main_source = lib_mod.get_source()
assert main_source.count("tvmgen_default_fused_nn_conv2d") == 2
assert main_source.count("gemm_") == 13
assert main_source.count("tvmgen_default_fused_nn_conv2d") == 3
assert main_source.count("gemm_") == 15


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion tests/scripts/task_python_integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-integration tests/python/int
run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-contrib tests/python/contrib --ignore=tests/python/contrib/test_ethosu --ignore=tests/python/contrib/test_cmsisnn
# forked is needed because the global registry gets contaminated
TVM_TEST_TARGETS="${TVM_RELAY_TEST_TARGETS:-llvm;cuda}" \
run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-relay tests/python/relay
run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-relay tests/python/relay --ignore=tests/python/relay/aot

# OpenCL texture test. Deselected specific tests that fails in CI
TVM_TEST_TARGETS="${TVM_RELAY_OPENCL_TEXTURE_TARGETS:-opencl}" \
Expand Down
1 change: 1 addition & 0 deletions tests/scripts/task_python_microtvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ python3 gallery/how_to/work_with_microtvm/micro_autotune.py
python3 gallery/how_to/work_with_microtvm/micro_aot.py

run_pytest ctypes python-relay-strategy-arm_cpu tests/python/relay/strategy/arm_cpu --enable-corstone300-tests
run_pytest ctypes python-relay-aot tests/python/relay/aot --enable-corstone300-tests
run_pytest ctypes python-integration-m7-simd tests/python/integration/test_arm_mprofile_dsp.py --enable-corstone300-tests
run_pytest ctypes python-integration-contrib-test_cmsisnn tests/python/contrib/test_cmsisnn -n auto
run_pytest ctypes python-integration-contrib-test_ethosu tests/python/contrib/test_ethosu -n auto