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] Simplify TIR Var Definition #13970

Merged
merged 2 commits into from
Feb 13, 2023

Conversation

junrushao
Copy link
Member

This PR introduces a small tweak to TVMScript printer that simplifies
variable definition in TIR.

Origionally, defining a TIR var uses T.var(dtype), e.g.

a = T.var("int32")

This PR encourages to shorten the definition to:

a = T.int32()

There is no breaking change in this PR, which means the legacy behavior
still works without any problem.

While both represents a pointer type, `T.handle` was previously used to
refer to tir variables whose `type_annotation` is `PrimType`, while
`T.Ptr` instead specifically refers to `PointerType`. The divide is
unnecessary if we extend `T.handle` slightly.
This PR introduces a small tweak to TVMScript printer that simplifies
variable definition in TIR.

Origionally, defining a TIR var uses `T.var(dtype)`, e.g.

```python
a = T.var("int32")
```

This PR encourages to shorten the definition to:

```python
a = T.int32()
```

There is no breaking change in this PR, which means the legacy behavior
still works without any problem.
@tvm-bot
Copy link
Collaborator

tvm-bot commented Feb 12, 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 marked this pull request as ready for review February 13, 2023 01:18
@junrushao junrushao merged commit 82cf9f7 into apache:main Feb 13, 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.

3 participants