This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new a2b10a3053 [Tests] Remove test_runtime_ndarray (covered by tvm-ffi)
(#19715)
a2b10a3053 is described below
commit a2b10a305353c19f1ef85b3ef71bafb31995b353
Author: Shushi Hong <[email protected]>
AuthorDate: Thu Jun 11 07:19:33 2026 -0400
[Tests] Remove test_runtime_ndarray (covered by tvm-ffi) (#19715)
The all-platform-minimal NDArray runtime test is now superseded by
tvm-ffi's own NDArray coverage. This removes the now-redundant
`test_runtime_ndarray.py` test file.
---
.../test_runtime_ndarray.py | 77 ----------------------
1 file changed, 77 deletions(-)
diff --git a/tests/python/all-platform-minimal-test/test_runtime_ndarray.py
b/tests/python/all-platform-minimal-test/test_runtime_ndarray.py
deleted file mode 100644
index 6b25e8059e..0000000000
--- a/tests/python/all-platform-minimal-test/test_runtime_ndarray.py
+++ /dev/null
@@ -1,77 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-"""Basic runtime enablement test."""
-
-import math
-
-import numpy as np
-import pytest
-
-import tvm
-import tvm.testing
-
-dtype = tvm.testing.parameter("uint8", "int8", "uint16", "int16", "uint32",
"int32", "float32")
-
-
-def test_nd_create(target, dev, dtype):
- x = np.random.randint(0, 10, size=(3, 4))
- x = np.array(x, dtype=dtype)
- y = tvm.runtime.tensor(x, device=dev)
- z = y.copyto(dev)
- assert y.dtype == x.dtype
- assert y.shape == x.shape
- assert isinstance(y, tvm.runtime.Tensor)
- np.testing.assert_equal(x, y.numpy())
- np.testing.assert_equal(x, z.numpy())
-
- # no need here, just to test usablity
- dev.sync()
-
-
-def test_memory_usage(target, dev, dtype):
- available_memory_before = dev.available_global_memory
- if available_memory_before is None:
- pytest.skip(reason=f"Target '{target}' does not support queries of
available memory")
-
- arr = tvm.runtime.empty([1024, 1024], dtype=dtype, device=dev)
- available_memory_after = dev.available_global_memory
-
- num_elements = math.prod(arr.shape)
- element_nbytes = tvm.runtime.DataType(dtype).itemsize
- expected_memory_after = available_memory_before - num_elements *
element_nbytes
-
- # Allocations may be padded out to provide alignment, to match a
- # page boundary, due to additional device-side bookkeeping
- # required by the TVM backend or the driver, etc. Therefore, the
- # available memory may decrease by more than the requested amount.
- assert available_memory_after <= expected_memory_after
-
- # TVM's Tensor type is a reference-counted handle to the
- # underlying reference. After the last reference to an Tensor is
- # cleared, the backing allocation will be freed.
- del arr
-
- assert dev.available_global_memory == available_memory_before
-
-
-def test_dtype():
- dtype = tvm.DataType("handle")
- assert dtype.type_code == tvm.DataTypeCode.HANDLE
-
-
-if __name__ == "__main__":
- tvm.testing.main()