You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/11/15 02:09:37 UTC

[GitHub] [tvm] masahi commented on a diff in pull request #13384: [MetaSchedule] Support schedules with cache read in RewriteLayout

masahi commented on code in PR #13384:
URL: https://github.com/apache/tvm/pull/13384#discussion_r1022244412


##########
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:
   This is a fix for `RewriteLayout` to work when `link-params = True`, the breakage discussed in https://github.com/apache/tvm/pull/13195. With this, I confirmed that the new `RewriteLayout` implementation works when there is `CacheRead` acting on `AllocateConst`. I'm not adding a test since TVMScript parsing is broken when there is `AllocateConst` with a large constant (can't print the whole array).



-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org