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-tirx.git


The following commit(s) were added to refs/heads/main by this push:
     new 93e16e774 [FIX] Avoid collection and invalid-reference warnings in 
tests (#71)
93e16e774 is described below

commit 93e16e774e939a1b9f89032800caa068f1558ec2
Author: Tianqi Chen <[email protected]>
AuthorDate: Sun Oct 25 14:48:23 2026 -0400

    [FIX] Avoid collection and invalid-reference warnings in tests (#71)
    
    Mark fixture data helpers as non-tests without changing their parameter
    IDs. Construct min/max references without comparing NaN operands,
    preserving NaN and signed-zero semantics. Exercise acosh on valid
    inputs, including its boundary, and check invalid-domain NaN results
    explicitly.
---
 tests/python/codegen/llvm/test_basic.py   |  4 +++-
 tests/python/sym/test_const_int_bound.py  |  2 ++
 tests/python/sym/test_rewrite_simplify.py |  2 ++
 tests/python/tirx/base/test_intrin.py     | 16 ++++++++++++++--
 4 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/tests/python/codegen/llvm/test_basic.py 
b/tests/python/codegen/llvm/test_basic.py
index 967362f7f..ad8d37a2f 100644
--- a/tests/python/codegen/llvm/test_basic.py
+++ b/tests/python/codegen/llvm/test_basic.py
@@ -1387,7 +1387,9 @@ def test_llvm_min_max_nan_preserving(dtype, lanes):
     for name, compare in (("min", np.less), ("max", np.greater)):
         values = []
         for lhs, rhs in operand_pairs:
-            take_lhs = compare(lhs, rhs) | np.isnan(lhs)
+            # BF16 comparisons signal invalid on NaNs; select those without 
comparing.
+            take_lhs = np.isnan(lhs)
+            compare(lhs, rhs, out=take_lhs, where=~(take_lhs | np.isnan(rhs)))
             # IEEE minimum selects -0 and maximum selects +0 on a zero tie.
             both_zero = (lhs == 0) & (rhs == 0)
             preferred_zero = np.signbit(lhs) if name == "min" else 
~np.signbit(lhs)
diff --git a/tests/python/sym/test_const_int_bound.py 
b/tests/python/sym/test_const_int_bound.py
index ae3fcf924..8e7729f29 100644
--- a/tests/python/sym/test_const_int_bound.py
+++ b/tests/python/sym/test_const_int_bound.py
@@ -29,6 +29,8 @@ POS_INF = ConstIntBound.POS_INF
 
 
 class TestCase:
+    __test__ = False
+
     def __init__(self, expr, expected_bounds, known_bounds=None, 
constraint=None):
         self.expr = expr
         self.expected_bounds = expected_bounds
diff --git a/tests/python/sym/test_rewrite_simplify.py 
b/tests/python/sym/test_rewrite_simplify.py
index de79b4b1a..f22409963 100644
--- a/tests/python/sym/test_rewrite_simplify.py
+++ b/tests/python/sym/test_rewrite_simplify.py
@@ -33,6 +33,8 @@ from tvm_tirx.tirx import truncmod as tmod
 
 
 class TestCase:
+    __test__ = False
+
     def __init__(self, before, expected, preconditions=None):
         if isinstance(before, tirx.expr.EqualOp):
             before = before.__tvm_ffi_object__()
diff --git a/tests/python/tirx/base/test_intrin.py 
b/tests/python/tirx/base/test_intrin.py
index e9a4811f5..49bac80ba 100644
--- a/tests/python/tirx/base/test_intrin.py
+++ b/tests/python/tirx/base/test_intrin.py
@@ -137,13 +137,25 @@ def test_unary_intrin():
 
         dev = tvm_tirx.cpu(0)
         n = 10
-        a = tvm_tirx.runtime.tensor(np.random.uniform(0.1, 0.5, 
size=n).astype("float32"), dev)
+        name = tvm_intrin.__name__
+        if name == "acosh":
+            inputs = np.linspace(1.0, 2.0, num=n, dtype="float32")
+        else:
+            inputs = np.random.uniform(0.1, 0.5, size=n).astype("float32")
+        a = tvm_tirx.runtime.tensor(inputs, dev)
         b = 
tvm_tirx.runtime.tensor(np.random.uniform(size=n).astype("float32"), dev)
         func(a, b)
         tvm_tirx.testing.assert_allclose(b.numpy(), np_func(a.numpy()), 
atol=atol, rtol=rtol)
 
+        if name == "acosh":
+            # Inputs below 1 are outside the real domain; do not evaluate 
NumPy there.
+            invalid_inputs = np.array([-2.0, -1.0, 0.0, 0.1, 0.5], 
dtype="float32")
+            invalid_a = tvm_tirx.runtime.tensor(invalid_inputs, dev)
+            invalid_b = tvm_tirx.runtime.tensor(np.empty_like(invalid_inputs), 
dev)
+            func(invalid_a, invalid_b)
+            assert np.all(np.isnan(invalid_b.numpy()))
+
         # Out-of-bounds test for asin/acos
-        name = tvm_intrin.__name__
         if name in ("asin", "acos"):
             # generate some values outside [-1, 1]
             n = 8

Reply via email to