Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TVMScript][Bug] Add test case for missing symbolic bounds #16877

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions tests/python/relax/test_tvmscript_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2293,5 +2293,29 @@ def subroutine(x: R.Tensor, _: R.Shape(["m", "n"])) -> R.Tensor(["m", "n"]):
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()
Loading