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 2023/01/18 05:52:02 UTC

[GitHub] [tvm] junrushao commented on a diff in pull request #13801: [TVMScript] `T.match_buffer` syntax sugar in arguments for TVMScript printer

junrushao commented on code in PR #13801:
URL: https://github.com/apache/tvm/pull/13801#discussion_r1073119894


##########
src/script/printer/tir/buffer.cc:
##########
@@ -126,6 +126,18 @@ ExprDoc BufferDecl(const tir::Buffer& buffer, const String& method, const Array<
                     /*args=*/args);
 }
 
+ExprDoc BufferAttn(const tir::Buffer& buffer, const ObjectPath& p, const Frame& frame,
+                   const IRDocsifier& d) {
+  Map<String, ExprDoc> attrs = BufferAttrs(buffer, p, frame, d);
+  Array<Doc> indices_doc;
+  for (String s : {"shape", "dtype"}) {
+    if (Optional<ExprDoc> doc = attrs.Get(s)) {
+      indices_doc.push_back(doc.value());
+    }
+  }
+  return TIR("Buffer")[indices_doc];

Review Comment:
   Let's modernize it by using `->Call` instead!



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