junrushao commented on code in PR #13195:
URL: https://github.com/apache/tvm/pull/13195#discussion_r1022254178
##########
src/te/operation/create_primfunc.cc:
##########
@@ -107,24 +108,30 @@ class LayoutFreePlaceholdersNormalizer : public
StmtMutator {
Stmt VisitStmt_(const BlockNode* _block) final {
Block block = Downcast<Block>(StmtMutator::VisitStmt_(_block));
- if (Optional<ObjectRef> ann = block->annotations.Get(topi_attr)) {
- Array<Buffer> new_buffers;
+ BlockNode* n = block.CopyOnWrite();
+ if (Optional<ObjectRef> ann = n->annotations.Get(topi_attr)) {
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);
}
}
- block.CopyOnWrite()->annotations.Set(topi_attr, new_buffers);
Review Comment:
The problem is that the Buffer objects in the annotation will not be updated
when doing transformation, and that’s why I removed this line. I was not aware
this is useful for link-param-specific hack.
Feel free to add it back if it’s needed. Shall we add a flag in pass config
which defaults to off, and hexagon-specific users could turn it on when needed?
--
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]