Skip to content

Commit 624f8a7

Browse files
authored
[TEST] Run tests/python/relay/aot tests in ci-cortexm (#15519)
[TEST] Run tests in tests/python/relay/aot in `ci-cortexm` The tests in `tests/python/relay/aot` were run as part of task_python_integration.sh which is run for `ci-cpu` and `ci-arm`, but some of tests in that folder require CMSIS-NN or FVP, so in practice they were not running anywhere in the upstream CI. Since all the tests in that folder could run on `ci-cortexm`, change the scripts run them there. Also fix some tests that started failing as a result of #15103 (but didn't manifest in upstream CI) and `test_device_api_hooks_unpacked_api` that clearly hasn't been running in any CI for a while.
1 parent ed8b82c commit 624f8a7

File tree

4 files changed

+28
-23
lines changed

4 files changed

+28
-23
lines changed

tests/python/relay/aot/test_c_device_api.py

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -143,42 +143,46 @@ def test_device_api_hooks_unpacked_api(device_api_main_func):
143143

144144
# Activate Device
145145
assert (
146-
str(main_func.body[0])
147-
== "tir.tvm_check_return(0, -1, tir.call_extern("
148-
+ '"TVMDeviceEthosUActivate",'
149-
+ " device_context_ethos_u))\n"
146+
str(main_func.body[0].value)
147+
== "T.tvm_check_return(0, -1, T.call_extern("
148+
+ '"int32",'
149+
+ ' "TVMDeviceEthosUActivate",'
150+
+ " device_context_ethos_u))"
150151
)
151152
# Open Device
152153
print("main func", repr(main_func.body))
153154
assert (
154-
str(main_func.body[1][0][0][0])
155-
== "tir.tvm_check_return(0, -1, tir.call_extern("
156-
+ '"TVMDeviceEthosUOpen",'
157-
+ " device_context_ethos_u))\n"
155+
str(main_func.body[1].value)
156+
== "T.tvm_check_return(0, -1, T.call_extern("
157+
+ '"int32",'
158+
+ ' "TVMDeviceEthosUOpen",'
159+
+ " device_context_ethos_u))"
158160
)
159161
# Device Call
160162
# We dont need to check exact input and output var names in this test.
161163
# Hence, using a regex to cover any legal I/O name.
162164
regex = re.compile(
163-
r"tir\.tvm_check_return\("
165+
r"T\.tvm_check_return\("
164166
r"0, -1, "
165-
r'tir\.call_extern\("tvmgen_default_ethos_u_main_0", '
167+
r'T\.call_extern\("int32", "tvmgen_default_ethos_u_main_0", '
166168
r"\w+, \w+, device_context_ethos_u\)\)"
167169
)
168-
assert regex.match(str(main_func.body[1][0][0][1]))
170+
assert regex.match(str(main_func.body[2].value))
169171
# Close Device
170172
assert (
171-
str(main_func.body[1][0][0][2])
172-
== "tir.tvm_check_return(0, -1, tir.call_extern("
173-
+ '"TVMDeviceEthosUClose",'
174-
+ " device_context_ethos_u))\n"
173+
str(main_func.body[3].value)
174+
== "T.tvm_check_return(0, -1, T.call_extern("
175+
+ '"int32",'
176+
+ ' "TVMDeviceEthosUClose",'
177+
+ " device_context_ethos_u))"
175178
)
176179
# Deactivate Device
177180
assert (
178-
str(str(main_func.body[2]))
179-
== "tir.tvm_check_return(0, -1, tir.call_extern("
180-
+ '"TVMDeviceEthosUDeactivate",'
181-
+ " device_context_ethos_u))\n"
181+
str(str(main_func.body[4].value))
182+
== "T.tvm_check_return(0, -1, T.call_extern("
183+
+ '"int32",'
184+
+ ' "TVMDeviceEthosUDeactivate",'
185+
+ " device_context_ethos_u))"
182186
)
183187

184188

tests/python/relay/aot/test_crt_forward_declarations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_external_calls(test_runner):
111111
main_source.count("TVMBackendAllocWorkspace") == 3
112112
or main_source.count("TVMBackendAllocWorkspace") == 0
113113
)
114-
assert main_source.count("tvmgen_default_fused_reshape") == 2
114+
assert main_source.count("tvmgen_default_fused_reshape") == 3
115115
assert main_source.count("tvmgen_default_cmsis_nn_main") == 12
116116
cmsisnn_source = lib_mod.imported_modules[0].get_source()
117117
assert cmsisnn_source.count("arm_convolve_wrapper") == 1
@@ -243,8 +243,8 @@ def test_tensorized_calls():
243243

244244
lib_mod = compiled_models[0].executor_factory.lib.imported_modules[0]
245245
main_source = lib_mod.get_source()
246-
assert main_source.count("tvmgen_default_fused_nn_conv2d") == 2
247-
assert main_source.count("gemm_") == 13
246+
assert main_source.count("tvmgen_default_fused_nn_conv2d") == 3
247+
assert main_source.count("gemm_") == 15
248248

249249

250250
if __name__ == "__main__":

tests/scripts/task_python_integration.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-integration tests/python/int
6464
run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-contrib tests/python/contrib --ignore=tests/python/contrib/test_ethosu --ignore=tests/python/contrib/test_cmsisnn
6565
# forked is needed because the global registry gets contaminated
6666
TVM_TEST_TARGETS="${TVM_RELAY_TEST_TARGETS:-llvm;cuda}" \
67-
run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-relay tests/python/relay
67+
run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-relay tests/python/relay --ignore=tests/python/relay/aot
6868

6969
# OpenCL texture test. Deselected specific tests that fails in CI
7070
TVM_TEST_TARGETS="${TVM_RELAY_OPENCL_TEXTURE_TARGETS:-opencl}" \

tests/scripts/task_python_microtvm.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ python3 gallery/how_to/work_with_microtvm/micro_autotune.py
6666
python3 gallery/how_to/work_with_microtvm/micro_aot.py
6767

6868
run_pytest ctypes python-relay-strategy-arm_cpu tests/python/relay/strategy/arm_cpu --enable-corstone300-tests
69+
run_pytest ctypes python-relay-aot tests/python/relay/aot --enable-corstone300-tests
6970
run_pytest ctypes python-integration-m7-simd tests/python/integration/test_arm_mprofile_dsp.py --enable-corstone300-tests
7071
run_pytest ctypes python-integration-contrib-test_cmsisnn tests/python/contrib/test_cmsisnn -n auto
7172
run_pytest ctypes python-integration-contrib-test_ethosu tests/python/contrib/test_ethosu -n auto

0 commit comments

Comments
 (0)