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 2021/11/26 10:22:21 UTC

[GitHub] [tvm] wrongtest opened a new pull request #9594: support kTarget func attr in tir script

wrongtest opened a new pull request #9594:
URL: https://github.com/apache/tvm/pull/9594


   Hi, this PR propose to support `kTarget` func attr in script. Since relay backend and SplitHostDevice will append the target information to PrimFunc, it is really helpful for us (de)serializing these backend PrimFuncs.
   
   Also glad to know whether it is the proper way to extend the grammar with `Target` object, many thanks.
   


-- 
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 #9594: [TVMScript] support kTarget func attr in tir script

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


   


-- 
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 change in pull request #9594: [TVMScript] support kTarget func attr in tir script

Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on a change in pull request #9594:
URL: https://github.com/apache/tvm/pull/9594#discussion_r758068380



##########
File path: python/tvm/script/tir/special_stmt.py
##########
@@ -17,6 +17,7 @@
 """TVM Script Parser Special Stmt Classes"""
 # pylint: disable=unused-argument, no-self-argument, inconsistent-return-statements
 # pylint: disable=relative-beyond-top-level
+from ctypes import ArgumentError

Review comment:
       Probably we don't need this particular kind of error from ctypes. What about we just raise ValueError?




-- 
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 pull request #9594: [TVMScript] support kTarget func attr in tir script

Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on pull request #9594:
URL: https://github.com/apache/tvm/pull/9594#issuecomment-980218025


   Thanks for the contribution! Given that target string is simply a syntactic sugar to target’s JSON-like configuration, I would suggest that we print Target to json rather than string with TargetNode::Export


-- 
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 change in pull request #9594: [TVMScript] support kTarget func attr in tir script

Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on a change in pull request #9594:
URL: https://github.com/apache/tvm/pull/9594#discussion_r758060560



##########
File path: python/tvm/script/tir/__init__.pyi
##########
@@ -371,3 +372,5 @@ class handle:
     def data(self: handle) -> Ptr: ...
 
 class Ptr: ...
+
+def target(target_str: str) -> Target: ...

Review comment:
       the input type is not limited to `str`, right?

##########
File path: tests/python/unittest/test_tvmscript_roundtrip.py
##########
@@ -3205,5 +3205,30 @@ def test_nontrivial_range_axis():
     tvm.ir.assert_structural_equal(func, rt_func, True)
 
 
+@T.prim_func
+def func_with_target_spec() -> None:
+    T.func_attr(

Review comment:
       Shall we add a unittest for target tag? For example:
   
   ```
   T.target("nvidia/nvidia-a100")
   ```




-- 
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 pull request #9594: [TVMScript] support kTarget func attr in tir script

Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on pull request #9594:
URL: https://github.com/apache/tvm/pull/9594#issuecomment-981328647


   CC: @Hzfengsy 


-- 
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] wrongtest commented on pull request #9594: [TVMScript] support kTarget func attr in tir script

Posted by GitBox <gi...@apache.org>.
wrongtest commented on pull request #9594:
URL: https://github.com/apache/tvm/pull/9594#issuecomment-981270210


   @junrushao1994 Thanks for advice! Update the printer to use TargetNode::Export(). Also is the `T.target()` acceptable? Or else maybe we could just parse the dict value to Target only if key == kTarget in func attrs parsing. 


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