[TIR] Vectorized buffer elements and indices #12
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I put this together following TVM PR#8528, which resolved an issue with array access in the Vulkan runtime, but led to/exposed some inconsistencies in the TIR semantics for buffer indices. Vulkan/SPIR-V require all arrays to be typed, and doesn't allow type casts that would be permissible in C code, such as casting between
float32*andfloat32x2*. As a result, any vectorized load/store operations must act on an array whose elements are vectorized types.Currently, many places in IR (e.g.
Load::Loadchecking the number of output lanes) and codegen (e.g.CodeGenC'sLoadNodeloop over output lanes rather than element/index lanes) implicitly assume that all array elements havelanes == 1.I couldn't find any documentation on intended semantics for these multi-lane array indices, and so I wanted to propose, discuss, and document the intended semantics.