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] Sugar Var Definition in TIR Buffer #14223

Merged

Conversation

junrushao
Copy link
Member

This PR introduces sugars for TIR buffer declaration.

Sugar 1. Convenient stride definition by string.

// Previous
stride = T.int32()
A = T.match_buffer(..., strides=(stride,))

// This PR
A = T.match_buffer(..., strides=("s0", ))

Sugar 2. Multiple definition of TIR Var from a single buffer are now merged into a single line.

// Previous
m = T.int32()
n = T.int32()
stride = T.int32()
stride_1 = T.int32()
A = T.match_buffer(a, (m, n), strides=(stride, stride_1))

// This PR
m, n = T.int32(), T.int32()
A = T.match_buffer(a, (m, n), strides=("s0", "s1"))

This PR introduces sugars for TIR buffer declaration.

Sugar 1. Convenient stride definition by string.

```python
// Previous
stride = T.int32()
A = T.match_buffer(..., strides=(stride,))

// This PR
A = T.match_buffer(..., strides=("s0", ))
```

Sugar 2. Multiple definition of TIR Var from a single buffer are now
merged into a single line.

```python
// Previous
m = T.int32()
n = T.int32()
stride = T.int32()
stride_1 = T.int32()
A = T.match_buffer(a, (m, n), strides=(stride, stride_1))

// This PR
m, n = T.int32(), T.int32()
A = T.match_buffer(a, (m, n), strides=("s0", "s1"))
```
@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 marked this pull request as ready for review March 7, 2023 09:16
Copy link
Member

@tqchen tqchen left a comment

Choose a reason for hiding this comment

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

LGTM

@tqchen tqchen merged commit 2c4af88 into apache:main Mar 7, 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