Skip to content

Conversation

@cyx-6
Copy link
Contributor

@cyx-6 cyx-6 commented Jan 24, 2023

This PR is the follow up of #13813. We simplify the printing output of T.allocate with T.decl_buffer. For example, we have a code snippet as

buffer_data = T.allocate(...)
buffer = T.decl_buffer(..., data=buffer_data)
T.evaluate(buffer_data)

Originally, we skip the T.allocate only if the var buffer_data defined by T.allocate is used only once by the following T.decl_buffer. This was due to the limitation of the old printer design.

But in the new printer, we may automatically replace the buffer_data with buffer.data if skipping the definition of buffer_data. We are able to link all buffer_data usages together. So the new output result will be like

buffer = T.decl_buffer(...)
T.evaluate(buffer.data)

@tvm-bot
Copy link
Collaborator

tvm-bot commented Jan 24, 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

Copy link
Member

@junrushao junrushao left a comment

Choose a reason for hiding this comment

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

LGTM!

@junrushao junrushao merged commit 1d89071 into apache:main Jan 24, 2023
fzi-peccia pushed a commit to fzi-peccia/tvm that referenced this pull request Mar 27, 2023
This PR is the follow up of apache#13813. We simplify the printing output of `T.allocate` with `T.decl_buffer`. For example, we have a code snippet as 

```python
buffer_data = T.allocate(...)
buffer = T.decl_buffer(..., data=buffer_data)
T.evaluate(buffer_data)
```

Originally, we skip the `T.allocate` only if the var `buffer_data` defined by `T.allocate` is used only once by the following `T.decl_buffer`. This was due to the limitation of the old printer design. 

But in the new printer, we may automatically replace the `buffer_data` with `buffer.data` if skipping the definition of `buffer_data`. We are able to link all `buffer_data` usages together. So the new output result will be like

```python
buffer = T.decl_buffer(...)
T.evaluate(buffer.data)
```
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