-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[TIR][Primitive] Support rolling_buffer schedule primitive in TensorIR #13033
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][Primitive] Support rolling_buffer schedule primitive in TensorIR #13033
Conversation
e0c68de to
1568fbf
Compare
|
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 |
a76af4e to
8f60dae
Compare
8f60dae to
b51b704
Compare
|
cc @mbaret |
0667a5d to
46fbf36
Compare
wrongtest-intellif
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for your efforts!
apache#13033) * [TIR][Primitive] Support rolling_buffer schedule primitive in TensorIR * Address review comments * Add dependency checks
apache#13033) * [TIR][Primitive] Support rolling_buffer schedule primitive in TensorIR * Address review comments * Add dependency checks
apache#13033) * [TIR][Primitive] Support rolling_buffer schedule primitive in TensorIR * Address review comments * Add dependency checks
Hi, this PR ported the rolling_buffer primitive from TE schedule to TensorIR schedule, refer to [RFC] Introducing a ‘rolling_buffer’ scheduling primitive.
The primitive performs the following steps to transform the target buffer into a 'rolling buffer':
Note: The region_cover property of the consumer block of the target buffer will become false.
Example
sch.rolling_buffer(sch.get_block("B"), buffer_index=0)Difference from TE rolling_buffer
TIR rolling_buffer will only select a dimension with a positive bound overlap as rolling dimension, consider the following example, the collected bound overlap for buffer B is [0, 0, 2, 0].
For the logic of TE rolling_buffer, i1_0 will be selected as the rolling axis and its range will be folded to [0, 4] to compact and minimize the buffer size. But for TensorIR, buffer region compaction will be performed by CompactBufferAllocation pass, so the primitive will select i2_0 with a positive bound overlap to be the rolling axis to circularize the buffer.
Note that if the acess region of the target buffer does not have a positive bound overlap in any dimension, the primitive would fail and throw an error, please let me know if this is inappropriate.
cc @wrongtest-intellif