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/07/15 19:34:21 UTC

[GitHub] [tvm] yelite opened a new pull request, #12111: [TVMScript] StmtDoc Definitions

yelite opened a new pull request, #12111:
URL: https://github.com/apache/tvm/pull/12111

   This PR addes:
   
   - All StmtDoc subclasses
   - Python bindings for StmtDoc
   
   Tracking issue: https://github.com/apache/tvm/issues/11912
   
   This PR is in draft state because it's branched off an open PR #12048. Please review the change starting from 08d2e97.
   cc @junrushao1994 @gbonik


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


[GitHub] [tvm] junrushao1994 commented on a diff in pull request #12111: [TVMScript] StmtDoc Definitions

Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on code in PR #12111:
URL: https://github.com/apache/tvm/pull/12111#discussion_r931325552


##########
include/tvm/script/printer/doc.h:
##########
@@ -219,6 +292,7 @@ class IdDoc : public ExprDoc {
    * \param name The name of identifier.
    */
   explicit IdDoc(String name);
+  explicit IdDoc(std::nullptr_t) : ExprDoc(nullptr) {}

Review Comment:
   Yeah this is a good idea to explicitly define constructor with `std::nullptr_t` so that the compiler could distinguish between `nullptr -> const char* -> String` and `nullptr -> ObjectPtr`



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


[GitHub] [tvm] junrushao1994 commented on a diff in pull request #12111: [TVMScript] StmtDoc Definitions

Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on code in PR #12111:
URL: https://github.com/apache/tvm/pull/12111#discussion_r931328506


##########
python/tvm/script/printer/doc.py:
##########
@@ -100,6 +100,31 @@ def __iter__(self):
         raise RuntimeError(f"{self.__class__} cannot be used as iterable.")
 
 
+class StmtDoc(Doc):
+    """Base class of statement doc"""
+
+    @property
+    def comment(self) -> Optional[str]:
+        # It has to call the dunder method to avoid infinite recursion
+        # pylint: disable=unnecessary-dunder-call
+        return self.__getattr__("comment")
+        # pylint: enable=unnecessary-dunder-call

Review Comment:
   nit if you only want to disable specific lint on a single line
   
   ```suggestion
           return self.__getattr__("comment")  # pylint: disable=unnecessary-dunder-call
   ```



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


[GitHub] [tvm] junrushao1994 merged pull request #12111: [TVMScript] StmtDoc Definitions

Posted by GitBox <gi...@apache.org>.
junrushao1994 merged PR #12111:
URL: https://github.com/apache/tvm/pull/12111


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