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] Support SizeVar Roundtripping #14227

Merged
merged 1 commit into from
Mar 8, 2023

Conversation

junrushao
Copy link
Member

@junrushao junrushao commented Mar 7, 2023

Previously the printer does not respect the difference between tir.Var and tir.SizeVar, which means SizeVar info will be lost during roundtripping, which is not ideal when dealing with dynamic shape workloads, where SizeVar provides additional bound information to the arithmetic analyzer.

This PR extends Var printing to support SizeVar:

>>> a = tir.SizeVar("a", "int32")
>>> print(a.script(verbose_expr=True))
a = T.int32(is_size_var=True)
a

@tvm-bot
Copy link
Collaborator

tvm-bot commented Mar 7, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

Generated by tvm-bot

@junrushao junrushao force-pushed the feature/2023-03-07/size-var-print branch from 6644d52 to 3c16278 Compare March 7, 2023 22:03
@junrushao junrushao marked this pull request as ready for review March 7, 2023 22:25
@junrushao junrushao force-pushed the feature/2023-03-07/size-var-print branch 2 times, most recently from e75749d to 057ba20 Compare March 8, 2023 02:40
Copy link
Member

@Hzfengsy Hzfengsy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except a naming change

include/tvm/script/ir_builder/tir/ir.h Outdated Show resolved Hide resolved
python/tvm/script/ir_builder/tir/ir.py Outdated Show resolved Hide resolved
Previously the printer does not respect the difference between tir.Var
and tir.SizeVar, which means SizeVar info will be lost during
roundtripping, which is not ideal when dealing with dynamic shape
workloads, where SizeVar provides additional bound information to the
arithmetic analyzer.

This PR extends Var printing to support SizeVar:

```python
>>> a = tir.SizeVar("a", "int32")
>>> print(a.script(verbose_expr=True))
a = T.int32(is_size_var=True)
a
```
@junrushao junrushao force-pushed the feature/2023-03-07/size-var-print branch from 057ba20 to c99a06e Compare March 8, 2023 05:35
@cyx-6 cyx-6 merged commit 902c2e2 into apache:main Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants