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

[TIR] Enhance TVMScript Buffer Slice Access #14693

Merged
merged 13 commits into from Jun 4, 2023

Conversation

lightzhan-intellif
Copy link
Contributor

This PR tries to fix a bug, which will case the error:

error: unsupported operand type(s) for +: 'BufferRegion' and 'BufferRegion'
 --> /workspace/code_newest/tvm/private_test/test_meta_programming.py:40:12
    |  
 40 |    B[0:5] = A[0:5] + B[0:5]
    |             ^^^^^^^^^^^^^^^

The problem will occur when it is a binary operation between two BufferSlice accesses, because the parser do not know how to deal with it.

This PR solves this by adding corresponding ops to BufferRegion. Any further suggestion is welcomed!

@junrushao @Hzfengsy @wrongtest-intellif

@tvm-bot
Copy link
Collaborator

tvm-bot commented Apr 21, 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

@Hzfengsy Hzfengsy changed the title fix buffer slice access bug. [TIR] Enhance TVMScript Buffer Slice Access Apr 21, 2023
@Hzfengsy
Copy link
Member

cc @cyx-6

python/tvm/tir/stmt.py Outdated Show resolved Hide resolved
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.

I don't have problem with the fix per se, but was thinking if this ad-hoc fix is sufficient. To be more precise, vectorized buffer access being recognized as PrimExpr instead of BufferRegion.

@ekalda
Copy link
Contributor

ekalda commented Apr 24, 2023

Thanks @lightzhan-intellif for the fix! I think it would be good to also test that the scripted output of VectorizeLoop can be parsed as this is something that is currently broken and that this change should fix as well.

@lightzhan-intellif
Copy link
Contributor Author

Thanks @lightzhan-intellif for the fix! I think it would be good to also test that the scripted output of VectorizeLoop can be parsed as this is something that is currently broken and that this change should fix as well.

Thanks for your suggestion, I will have a look.

@Hzfengsy Hzfengsy merged commit 429f601 into apache:main Jun 4, 2023
17 checks passed
junrushao pushed a commit to junrushao/tvm that referenced this pull request Jun 22, 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.

None yet

5 participants