diff --git a/tests/python/contrib/test_hexagon/test_thread_pool.py b/tests/python/contrib/test_hexagon/test_thread_pool.py index d95c4120b775..fa53cdc068c3 100644 --- a/tests/python/contrib/test_hexagon/test_thread_pool.py +++ b/tests/python/contrib/test_hexagon/test_thread_pool.py @@ -16,7 +16,6 @@ # under the License. import numpy as np -import pytest import tvm import tvm.contrib.hexagon @@ -92,3 +91,7 @@ def test_elemwise_sum_parallel(hexagon_session: Session): (a, b, c, n) = generate_add_test_data(hexagon_session) mod["elemwise_sum_parallel"](a, b, c, n) tvm.testing.assert_allclose(c.numpy(), a.numpy() + b.numpy()) + + +if __name__ == "__main__": + tvm.testing.main() diff --git a/tests/python/contrib/test_hexagon/topi/test_add_subtract_multiply.py b/tests/python/contrib/test_hexagon/topi/test_add_subtract_multiply.py index 4d595f7e82e0..0d8126072955 100755 --- a/tests/python/contrib/test_hexagon/topi/test_add_subtract_multiply.py +++ b/tests/python/contrib/test_hexagon/topi/test_add_subtract_multiply.py @@ -19,11 +19,8 @@ import pytest import numpy as np -from tvm import te, topi - -import tvm.testing -from tvm.topi import testing -from tvm.contrib.hexagon.build import HexagonLauncher +import tvm +from tvm import te import tvm.topi.hexagon.slice_ops as sl from ..infrastructure import allocate_hexagon_array, transform_numpy @@ -161,6 +158,9 @@ def test_transform( input_B_layout, op_name, ): + if hexagon_session._launcher._serial_number != "simulator": + pytest.skip(msg="Due to https://github.com/apache/tvm/issues/11957") + target_hexagon = tvm.target.hexagon("v69") A = te.placeholder(input_shape_A, name="A", dtype=dtype) B = te.placeholder(input_shape_B, name="B", dtype=dtype) diff --git a/tests/python/contrib/test_hexagon/topi/test_argmax_slice.py b/tests/python/contrib/test_hexagon/topi/test_argmax_slice.py index 4cbd524f4abf..5431054d2ca2 100644 --- a/tests/python/contrib/test_hexagon/topi/test_argmax_slice.py +++ b/tests/python/contrib/test_hexagon/topi/test_argmax_slice.py @@ -15,6 +15,7 @@ # specific language governing permissions and limitations # under the License. """ Tests for Hexagon slice argmax op """ +import pytest import numpy as np import tvm @@ -76,6 +77,9 @@ def test_argmax_slice( working_scope, ): """Top level testing function for argmax""" + if hexagon_session._launcher._serial_number != "simulator": + pytest.skip(msg="Due to https://github.com/apache/tvm/issues/11957") + target_hexagon = tvm.target.hexagon("v69") target = tvm.target.Target(target_hexagon, host=target_hexagon) argmax_input = te.placeholder(input_shape, name="A", dtype=dtype) diff --git a/tests/python/contrib/test_hexagon/topi/test_avg_pool2d_slice.py b/tests/python/contrib/test_hexagon/topi/test_avg_pool2d_slice.py index 3154f7d7e729..5b1f59c897d3 100644 --- a/tests/python/contrib/test_hexagon/topi/test_avg_pool2d_slice.py +++ b/tests/python/contrib/test_hexagon/topi/test_avg_pool2d_slice.py @@ -18,8 +18,7 @@ import pytest import numpy as np -from tvm import te, topi - +from tvm import te import tvm.testing from tvm.topi import testing from tvm.contrib.hexagon.build import HexagonLauncher @@ -369,4 +368,4 @@ def test_avg_pool2d_slice( if __name__ == "__main__": - sys.exit(pytest.main(sys.argv)) + tvm.testing.main() diff --git a/tests/python/contrib/test_hexagon/topi/test_batch_matmul.py b/tests/python/contrib/test_hexagon/topi/test_batch_matmul.py index 467ebd06b9cb..c64477343943 100644 --- a/tests/python/contrib/test_hexagon/topi/test_batch_matmul.py +++ b/tests/python/contrib/test_hexagon/topi/test_batch_matmul.py @@ -17,7 +17,6 @@ """Test code for matmul""" import numpy as np import pytest -import sys import tvm import tvm.testing diff --git a/tests/python/contrib/test_hexagon/topi/test_clip.py b/tests/python/contrib/test_hexagon/topi/test_clip.py index 37146b55dc1e..ac6890171dba 100755 --- a/tests/python/contrib/test_hexagon/topi/test_clip.py +++ b/tests/python/contrib/test_hexagon/topi/test_clip.py @@ -17,7 +17,6 @@ # pylint: disable=invalid-name -import pytest import numpy as np from tvm import te, topi diff --git a/tests/python/contrib/test_hexagon/topi/test_conv2d_nchw.py b/tests/python/contrib/test_hexagon/topi/test_conv2d_nchw.py index c755a4d018f3..01c20601b685 100644 --- a/tests/python/contrib/test_hexagon/topi/test_conv2d_nchw.py +++ b/tests/python/contrib/test_hexagon/topi/test_conv2d_nchw.py @@ -16,8 +16,6 @@ # under the License. """Test code for convolution.""" import numpy as np -import pytest -import sys import tvm import tvm.testing diff --git a/tests/python/contrib/test_hexagon/topi/test_conv2d_nhwc.py b/tests/python/contrib/test_hexagon/topi/test_conv2d_nhwc.py index 96062aa1b493..9acffff358e8 100644 --- a/tests/python/contrib/test_hexagon/topi/test_conv2d_nhwc.py +++ b/tests/python/contrib/test_hexagon/topi/test_conv2d_nhwc.py @@ -16,8 +16,6 @@ # under the License. """Test code for convolution.""" import numpy as np -import pytest -import sys import tvm import tvm.testing diff --git a/tests/python/contrib/test_hexagon/topi/test_conv2d_transpose.py b/tests/python/contrib/test_hexagon/topi/test_conv2d_transpose.py index 629403965eae..8536603a3c20 100644 --- a/tests/python/contrib/test_hexagon/topi/test_conv2d_transpose.py +++ b/tests/python/contrib/test_hexagon/topi/test_conv2d_transpose.py @@ -154,3 +154,7 @@ class TestConv2DTranspose(BaseConv2DTransposeTests): padding = tvm.testing.parameter((0, 0, 0, 0)) output_padding = tvm.testing.parameter((0, 0)) + + +if __name__ == "__main__": + tvm.testing.main() diff --git a/tests/python/contrib/test_hexagon/topi/test_dense.py b/tests/python/contrib/test_hexagon/topi/test_dense.py index 967278251cfc..929108bb1492 100644 --- a/tests/python/contrib/test_hexagon/topi/test_dense.py +++ b/tests/python/contrib/test_hexagon/topi/test_dense.py @@ -17,7 +17,6 @@ """Test code for dense""" import numpy as np import pytest -import sys import tvm import tvm.testing diff --git a/tests/python/contrib/test_hexagon/topi/test_depthwise_conv2d.py b/tests/python/contrib/test_hexagon/topi/test_depthwise_conv2d.py index 63ae0e7b3253..5e09e691f743 100644 --- a/tests/python/contrib/test_hexagon/topi/test_depthwise_conv2d.py +++ b/tests/python/contrib/test_hexagon/topi/test_depthwise_conv2d.py @@ -18,7 +18,6 @@ import sys import numpy as np -import pytest import tvm from tvm.contrib.hexagon.session import Session @@ -296,3 +295,6 @@ class TestDepthwiseConv2D(BaseDepthwiseConv2D): # TODO(hexagon-team): add TestDepthwiseConv2D_NCHWc test. + +if __name__ == "__main__": + tvm.testing.main() diff --git a/tests/python/contrib/test_hexagon/topi/test_pooling.py b/tests/python/contrib/test_hexagon/topi/test_pooling.py index ededdad2673b..45e558e1b6dd 100644 --- a/tests/python/contrib/test_hexagon/topi/test_pooling.py +++ b/tests/python/contrib/test_hexagon/topi/test_pooling.py @@ -16,8 +16,6 @@ # under the License. """Test code for pooling""" import numpy as np -import pytest -import sys import tvm import tvm.testing diff --git a/tests/python/contrib/test_hexagon/topi/test_reduce.py b/tests/python/contrib/test_hexagon/topi/test_reduce.py index c806964545ca..a844e1d51206 100644 --- a/tests/python/contrib/test_hexagon/topi/test_reduce.py +++ b/tests/python/contrib/test_hexagon/topi/test_reduce.py @@ -16,15 +16,11 @@ # under the License. """Test code for reduce""" import numpy as np -import pytest -import sys import tvm -import tvm.testing from tvm import topi from tvm import te from tvm.contrib.hexagon.session import Session -import tvm.topi.testing in_shape, axis, keepdims, reduce_type, dtype = tvm.testing.parameters( diff --git a/tests/python/contrib/test_hexagon/topi/test_resize2d.py b/tests/python/contrib/test_hexagon/topi/test_resize2d.py index caedc7b7b381..109eb5c4365d 100755 --- a/tests/python/contrib/test_hexagon/topi/test_resize2d.py +++ b/tests/python/contrib/test_hexagon/topi/test_resize2d.py @@ -14,16 +14,12 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. - - import pytest import numpy as np -from tvm import te, topi - -import tvm.testing -from tvm.topi import testing -from tvm.contrib.hexagon.build import HexagonLauncher +import tvm +from tvm import te +from tvm.topi.testing import resize2d_python import tvm.topi.hexagon as s1 from ..infrastructure import allocate_hexagon_array, transform_numpy @@ -34,9 +30,7 @@ def expected_output_np( ): scale_h = out_height / in_height scale_w = out_width / in_width - return tvm.topi.testing.resize2d_python( - input_np, (scale_h, scale_w), layout, method, coord_trans - ) + return resize2d_python(input_np, (scale_h, scale_w), layout, method, coord_trans) @tvm.testing.fixture @@ -108,6 +102,9 @@ def test_resize2d( method, hexagon_session, ): + if hexagon_session._launcher._serial_number != "simulator": + pytest.skip(msg="Due to https://github.com/apache/tvm/issues/11957") + target_hexagon = tvm.target.hexagon("v69") A = te.placeholder(input_shape, name="A", dtype=dtype) diff --git a/tests/python/contrib/test_hexagon/topi/test_softmax.py b/tests/python/contrib/test_hexagon/topi/test_softmax.py index 7a2435e8dcca..d1c78842b5ff 100644 --- a/tests/python/contrib/test_hexagon/topi/test_softmax.py +++ b/tests/python/contrib/test_hexagon/topi/test_softmax.py @@ -17,7 +17,6 @@ """Test code for softmax""" import numpy as np import pytest -import sys import tvm import tvm.testing diff --git a/tests/python/contrib/test_hexagon/test_softmax_slice.py b/tests/python/contrib/test_hexagon/topi/test_softmax_slice.py similarity index 91% rename from tests/python/contrib/test_hexagon/test_softmax_slice.py rename to tests/python/contrib/test_hexagon/topi/test_softmax_slice.py index a4745d62a7ab..a39c6cd5163b 100644 --- a/tests/python/contrib/test_hexagon/test_softmax_slice.py +++ b/tests/python/contrib/test_hexagon/topi/test_softmax_slice.py @@ -14,17 +14,14 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. - import pytest import numpy as np -from tvm import te, topi - -import tvm.testing -from tvm.topi import testing -from tvm.contrib.hexagon.build import HexagonLauncher +import tvm +from tvm import te +from tvm.topi.testing import softmax_python import tvm.topi.hexagon.slice_ops as sl -from .infrastructure import allocate_hexagon_array +from ..infrastructure import allocate_hexagon_array def transform_numpy(arr_np, layout): @@ -63,7 +60,7 @@ class TestSoftmax2d(Basesoftmax2d): @tvm.testing.fixture def expected_output_np(self, input_np): if len(input_np.shape) == 2: - ref_np_2d = tvm.topi.testing.softmax_python(input_np) + ref_np_2d = softmax_python(input_np) return ref_np_2d raise RuntimeError(f"Unexpected input shape '{input_np.shape}'") @@ -82,6 +79,8 @@ def test_softmax_f32( axis_sep, hexagon_session, ): + if hexagon_session._launcher._serial_number != "simulator": + pytest.skip(msg="Due to https://github.com/apache/tvm/issues/11957") target_hexagon = tvm.target.hexagon( "v69", @@ -136,5 +135,4 @@ def test_softmax_f32( if __name__ == "__main__": - - sys.exit(pytest.main(sys.argv)) + tvm.testing.main()