-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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] Represent ramp as index slice #11308
[TVMScript] Represent ramp as index slice #11308
Conversation
1ceb8b3
to
3cc3dc8
Compare
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.
Overall LGTM
T.evaluate(T.call_extern("strided_compute", dtype="")) | ||
|
||
|
||
def strided_buffer_region(A: T.handle): |
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.
the duplicated test
|
||
|
||
def access_non_const_slice(A: T.handle): | ||
# do not allow reversed slice step |
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.
error comment?
CC @yelite would you mind taking a look as well? |
* support represent ramp as index slice in tvmscript * fix testcase's comment, check slice lanes instead of extent
* support represent ramp as index slice in tvmscript * fix testcase's comment, check slice lanes instead of extent
* support represent ramp as index slice in tvmscript * fix testcase's comment, check slice lanes instead of extent
Hi there, the PR propose to represent
tir.RampNode
in buffer access index just as python slice. I believe this could be a more user friendly way for script users on SIMD-based target, since it just mimic usages in various python numerical libraries like numpy.For example:
A[T.ramp(0, 1, 1024)]
=>A[0:1024]
A[T.ramp(i*32, 1, 32)]
=>A[i*32:i*32+32]
A[T.ramp(i*4, 4, 32)]
=>A[i*4:i*4+128:4]
The syntax sugar is only available for constant stride and lanes. Also please correct me on two points:
Slice
with non-trivial step is only allowed in buffer indices, we may want to ensure all other usages should check step==1.cc @junrushao1994 @Hzfengsy @Lunderberg