This is an automated email from the ASF dual-hosted git repository.

wuwei 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 4cb4605ba3 [TVMScript][Bug] Add test case for missing symbolic bounds 
(#16877)
4cb4605ba3 is described below

commit 4cb4605ba3cb8e083aa0678515bac76ea66471f9
Author: Eric Lunderberg <lunderb...@users.noreply.github.com>
AuthorDate: Tue Apr 16 16:25:59 2024 -0500

    [TVMScript][Bug] Add test case for missing symbolic bounds (#16877)
    
    Because Relax struct inference is performed while the function is
    being built, all constraints on symbolic variables that are used
    for simplifications must be provided to the analyzer.  This is not
    currently the case, nor is there a clear way to fix this issue.
---
 tests/python/relax/test_tvmscript_parser.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/tests/python/relax/test_tvmscript_parser.py 
b/tests/python/relax/test_tvmscript_parser.py
index e692768a12..64014d1c49 100644
--- a/tests/python/relax/test_tvmscript_parser.py
+++ b/tests/python/relax/test_tvmscript_parser.py
@@ -2293,5 +2293,29 @@ def test_function_attributes_are_defined():
         assert func.attrs is not None
 
 
+@pytest.mark.xfail(reason="Bug: Implicit bounds not provided when parsing")
+def test_function_symbolic_variables_are_annotated():
+    """Symbolic variables must be exposed for struct inference
+
+    Because Relax struct inference is performed while the function is
+    being built, all constraints on symbolic variables that are used
+    for simplifications must be provided to the analyzer.
+    """
+
+    @R.function(private=True)
+    def inferred_sinfo(A: R.Tensor(["extent"])):
+        extent = T.int64()
+        output = R.strided_slice(A, [0], [0], [extent - 1])
+        return output
+
+    @R.function(private=True)
+    def expected(A: R.Tensor(["extent"])) -> R.Tensor(["extent-1"]):
+        extent = T.int64()
+        output: R.Tensor([extent - 1]) = R.strided_slice(A, [0], [0], [extent 
- 1])
+        return output
+
+    tvm.ir.assert_structural_equal(inferred_sinfo, expected)
+
+
 if __name__ == "__main__":
     tvm.testing.main()

Reply via email to