-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[TIR] Allow multiple element offsets in Buffer #10816
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
Conversation
Follow-up from apache#9727. When using `Stage.tensorize`, the element offset of the array view has one offset for each physical dimension of the buffer. This change replaces `BufferNode::elem_offset` and `BufferNode::offset_factor` with arrays.
56b8862 to
08a65dc
Compare
- Includes size checks to ensure that each parameter that depends on the number of physical dimensions (`elem_offsets`, `offset_factors`, and `axis_separators`) are consistent. - Support previous Buffer constructor with a single `elem_offset` and `offset_factor`, delegating to the array-based constructor.
- `Buffer.elem_offset` and `Buffer.offset_factor` are implemented as properties, to avoid breakage of calling code. - `decl_buffer` handles single or multiple `elem_offset` and `offset_factor` parameters. The parameter name is unchanged, to avoid breaking call sites that use named arguments.
- Several other locations that referenced either `elem_offsets` or `offset_factors`, which required only minor updates to maintain existing behavior.
08a65dc to
71d10fe
Compare
When constructing a buffer, if `elem_offsets` is either `{}` or
`{0}` (the default values for the two constructors), treat as the
start of the array with correct dimensionality.
|
Thanks @Lunderberg. The multiple Moving from a single It would also be good to think about alternatives. In TensorIR there is a |
|
Thank you, and I agree that this type of change requires a larger discussion. My intent was for this draft PR to be an option in that discussion, not a ready-to-merge change on its own, and I should have edited the commit messages to make that intention clearer. @vinx13 and I also had a brief chat on alternatives, and |
|
Thank you @Lunderberg ! yes love all the discussions so far |
|
Closing this PR, unlikely to take this development path. Current behavior in which |
Follow-up from #9727. When using
Stage.tensorize, the element offset of the array view has one offset for each physical dimension of the buffer. This change replacesBufferNode::elem_offsetandBufferNode::offset_factorwith arrays. The commits in this PR are separated by category, to help in review.Updates to Buffer class, to handle multiple elem_offsets
Includes size checks to ensure that each parameter that depends on the number of physical dimensions (
elem_offsets,offset_factors, andaxis_separators) are consistent.Support previous Buffer constructor with a single
elem_offsetandoffset_factor, delegating to the array-based constructor.Update python calls, with backwards compatibility
Buffer.elem_offsetandBuffer.offset_factorare implemented as properties, to avoid breakage of calling code.decl_bufferhandles single or multipleelem_offsetandoffset_factorparameters. The parameter name is unchanged, to avoid breaking call sites that use named arguments.Updated TVMScript parser and printer
Other C++ changes
elem_offsetsoroffset_factors, which required only minor updates to maintain existing behavior.