junrushao commented on code in PR #13384:
URL: https://github.com/apache/tvm/pull/13384#discussion_r1023226878
##########
src/te/operation/create_primfunc.cc:
##########
@@ -110,13 +110,20 @@ class LayoutFreePlaceholdersNormalizer : public
StmtMutator {
Block block = Downcast<Block>(StmtMutator::VisitStmt_(_block));
BlockNode* n = block.CopyOnWrite();
if (Optional<ObjectRef> ann = n->annotations.Get(topi_attr)) {
+ Array<Buffer> new_buffers;
for (Buffer buffer : Downcast<Array<Buffer>>(ann)) {
auto it = buffer2index_.find(buffer);
if (it != buffer2index_.end()) {
layout_free_buffer_indices_.insert(it->second);
+ } else {
+ new_buffers.push_back(buffer);
}
}
- n->annotations.erase(topi_attr);
+ if (new_buffers.empty()) {
+ n->annotations.erase(topi_attr);
+ } else {
+ n->annotations.Set(topi_attr, new_buffers);
+ }
Review Comment:
I see. That makes perfect sense to me :-) As long as it's not affecting
normal lowering flow, it looks like a 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]