multiverstack-intellif commented on code in PR #12939:
URL: https://github.com/apache/tvm/pull/12939#discussion_r985033912
##########
src/tir/schedule/primitive/cache_read_write.cc:
##########
@@ -563,8 +649,17 @@ class CacheReadRewriter : public StmtExprMutator {
if (block == scope_sref_->stmt) {
// If so, put buffer allocation on the parent scope
ObjectPtr<BlockNode> n = make_object<BlockNode>(*stmt.as<BlockNode>());
- n->alloc_buffers.push_back(info_->alloc);
- stmt = Block(n);
+ bool alloc_buffer_exists = false;
+ for (const Buffer& it : n->alloc_buffers) {
+ if (it.same_as(info_->alloc)) {
+ alloc_buffer_exists = true;
+ }
+ }
+ // In cache_buffer case, alloc_buffer may be already exits.
Review Comment:
good idea!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]