tqchen commented on a change in pull request #6147:
URL: https://github.com/apache/incubator-tvm/pull/6147#discussion_r461692946



##########
File path: src/printer/tir_text_printer.cc
##########
@@ -203,8 +185,36 @@ Doc TIRTextPrinter::PrintRange(const RangeNode* op) {
 
 Doc TIRTextPrinter::PrintBuffer(const BufferNode* op) {
   const Buffer& buffer = GetRef<Buffer>(op);
-  CHECK_GT(memo_buf_.count(buffer), 0);
-  return meta_->InMeta(buffer) ? meta_->GetMetaNode(buffer) : 
memo_buf_[buffer];
+
+  if (meta_->InMeta(buffer)) {
+    return meta_->GetMetaNode(buffer);
+  } else if (memo_buf_.count(buffer)) {
+    return memo_buf_[buffer];
+  } else {
+    memo_buf_[buffer] = AllocBuf(buffer);
+    return BufferNode2Doc(op, memo_buf_[buffer]);

Review comment:
       I agree that each buffer only be printed once, at its "declaration 
point" (e.g. BufferBind in the case of bind map), and use the unique id to 
refer to the buffer




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to