Skip to content

Commit

Permalink
address
Browse files Browse the repository at this point in the history
  • Loading branch information
Hzfengsy committed Aug 27, 2021
1 parent 64f225c commit 2c8ae04
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/tir/transforms/plan_update_buffer_allocation_location.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ class BufferAllocationLocator : public StmtExprMutator {
op = stmt.as<BlockNode>();
ICHECK(op != nullptr);

// No longer consider buffers created by match_buffer inside the block when updating access region.
// No longer consider buffers created by match_buffer inside the block when updating access
// region.
for (const MatchBufferRegion match_buffer : op->match_buffers) {
const Var& target_var = match_buffer->buffer->data;
buffer_data_to_buffer_.erase(target_var);
Expand All @@ -108,8 +109,8 @@ class BufferAllocationLocator : public StmtExprMutator {
ObjectPtr<BlockNode> n = CopyOnWrite(op);
n->alloc_buffers = std::move(alloc_buffers);
// Erase buffer allocated inside the block from access region.
n->reads = UpdateRegion(n->reads);
n->writes = UpdateRegion(n->writes);
n->reads = RemoveRedundantBufferRegion(n->reads);
n->writes = RemoveRedundantBufferRegion(n->writes);
return Stmt(n);
}

Expand All @@ -133,7 +134,7 @@ class BufferAllocationLocator : public StmtExprMutator {
return std::move(realize);
}

Array<BufferRegion> UpdateRegion(const Array<BufferRegion>& region) const {
Array<BufferRegion> RemoveRedundantBufferRegion(const Array<BufferRegion>& region) const {
Array<BufferRegion> result;
for (const BufferRegion& buffer_region : region) {
if (buffer_data_to_buffer_.count(buffer_region->buffer->data)) {
Expand Down

0 comments on commit 2c8ae04

Please sign in to comment.