[TIR] Handle implicit buffers in PrimFunc specialization#14565
[TIR] Handle implicit buffers in PrimFunc specialization#14565Lunderberg wants to merge 1 commit intoapache:mainfrom
Conversation
Prior to this commit, the `tvm::tir::Specialize` function would replace the specialized parameter when it occurs in the shape, strides, or element offset of a buffer, but only when the buffer occurs in specific locations. As a result, a `tir::Buffer` in the `PrimFuncNode::buffer_map` and `BlockNode` would be updated, but `tir::Buffer` objects in a `BufferLoad` or `BufferStore` node could be left unmodified and therefore contain undefined variables. This commit updates `PrimFunc::Specialize` to update buffer objects in `BufferLoad` and `BufferStore`.
|
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 |
|
Shall we have wellform check to ensure all buffer are being declared somewhere? |
|
Since we don't currently have a requirement for a |
|
I think it is a good idea to require |
|
I think we should start to enforce DeclBuffer to reduce the need to be compact to more complicated form in the passes |
|
Sounds good, and closing this PR. |
|
Cleaned up a dev branch into draft PR #14778, which would enforce DeclBuffer usage. |
Prior to this commit, the
tvm::tir::Specializefunction would replace the specialized parameter when it occurs in the shape, strides, or element offset of a buffer, but only when the buffer occurs in specific locations. As a result, atir::Bufferin thePrimFuncNode::buffer_mapandBlockNodewould be updated, buttir::Bufferobjects in aBufferLoadorBufferStorenode could be left unmodified and therefore contain undefined variables.This commit updates
PrimFunc::Specializeto update buffer objects inBufferLoadandBufferStore.