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 5cef18b93d [TEST][Sym] Cover large masks in modular-set analysis 
(#20458)
5cef18b93d is described below

commit 5cef18b93dff81e9b6269f285df0d0b49152187a
Author: Ruihang Lai <[email protected]>
AuthorDate: Fri Sep 25 20:28:33 2026 -0400

    [TEST][Sym] Cover large masks in modular-set analysis (#20458)
    
    Port the regression test from #20434 to main, where the analyzer fix
    already landed in #20423. Cover the reported uint32 mask, large
    power-of-two-minus-one masks, and signed boundary cases.
    
    Check both the modular coefficient and base to catch literal-range
    errors and incorrect handling of mask-plus-one overflow.
---
 tests/python/sym/test_sym_modular_set.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/tests/python/sym/test_sym_modular_set.py 
b/tests/python/sym/test_sym_modular_set.py
index a8b52512ce..997c4ada17 100644
--- a/tests/python/sym/test_sym_modular_set.py
+++ b/tests/python/sym/test_sym_modular_set.py
@@ -15,6 +15,8 @@
 # specific language governing permissions and limitations
 # under the License.
 # ruff: noqa: F841
+import pytest
+
 import tvm
 import tvm.testing
 from tvm import te
@@ -230,5 +232,24 @@ def test_bitwise_and():
     assert m.base == 0
 
 
[email protected](
+    "dtype, mask, expected_coeff, expected_base",
+    [
+        ("uint32", 2684354511, 1, 0),
+        ("int32", (1 << 31) - 1, 4, 2),
+        ("uint32", (1 << 32) - 1, 4, 2),
+        ("int64", (1 << 62) - 1, 4, 2),
+        ("int64", (1 << 63) - 1, 1, 0),
+        ("int64", -1, 1, 0),
+    ],
+)
+def test_bitwise_and_large_mask(dtype, mask, expected_coeff, expected_base):
+    analyzer = tvm.sym.Analyzer()
+    x = tvm.tirx.Var("x", dtype)
+    m = analyzer.modular_set((x * 4 + 2) & tvm.tirx.const(mask, dtype))
+    assert m.coeff == expected_coeff
+    assert m.base == expected_base
+
+
 if __name__ == "__main__":
     tvm.testing.main()

Reply via email to