Skip to content

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