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/09/22 18:10:15 UTC

[GitHub] [tvm] vinx13 opened a new pull request, #12875: [TIR] Allow missing TensorIntrin in registry lookup

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

   Added an option to allow missing tensor intrin.
   
   cc @junrushao @spectrometerHBH 


-- 
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] junrushao commented on pull request #12875: [TIR] Allow missing TensorIntrin in registry lookup

Posted by GitBox <gi...@apache.org>.
junrushao commented on PR #12875:
URL: https://github.com/apache/tvm/pull/12875#issuecomment-1255408219

   Would you like to provide some context BTW? like, in which cases do we allow it missing?


-- 
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] junrushao commented on pull request #12875: [TIR] Allow missing TensorIntrin in registry lookup

Posted by GitBox <gi...@apache.org>.
junrushao commented on PR #12875:
URL: https://github.com/apache/tvm/pull/12875#issuecomment-1255419263

   Got it! Can we add a simple test where the intrin name is missing?


-- 
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] junrushao commented on a diff in pull request #12875: [TIR] Allow missing TensorIntrin in registry lookup

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


##########
include/tvm/tir/function.h:
##########
@@ -233,10 +233,13 @@ class TensorIntrin : public ObjectRef {
   /*!
    * \brief Look up TensorIntrin by name. Raises an exception if not found.
    * \param name The name of the TensorIntrin.
+   * \param allow_missing Whether to allow missing tensor intrin. If false, an exception is raised
+   *    if the tensor intrin is not found.
    * \return The TensorIntrin with the specified name.
-   * \throws This method throws an exception if the TensorIntrin does not exist.
+   * \throws This method throws an exception if the TensorIntrin does not exist and allow_missing is
+   * false.
    */
-  TVM_DLL static TensorIntrin Get(String name);
+  TVM_DLL static TensorIntrin Get(String name, bool allow_missing = false);

Review Comment:
   ```suggestion
     TVM_DLL static Optional<TensorIntrin> Get(String name, bool allow_missing = false);
   ```



-- 
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] junrushao commented on a diff in pull request #12875: [TIR] Allow missing TensorIntrin in registry lookup

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


##########
python/tvm/tir/function.py:
##########
@@ -228,20 +228,24 @@ def register(name: str, desc: PrimFunc, impl: PrimFunc):
         return _ffi_api.TensorIntrinRegister(name, TensorIntrin(desc, impl))  # type: ignore
 
     @staticmethod
-    def get(name: str):
+    def get(name: str, allow_missing: bool = False):
         """Look up a tensor intrinsic by its name.
 
         Parameters
         ----------
         name : str
             The name of the TensorIntrin to look up.
 
+        allow_missing : bool
+            Whether to allow missing tensor intrin. If False, raise an error if the tensor intrin
+        doesn't exist.
+
         Returns
         -------
         result : TensorIntrin

Review Comment:
   use Optional



-- 
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] junrushao merged pull request #12875: [TIR] Allow missing TensorIntrin in registry lookup

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


-- 
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] vinx13 commented on pull request #12875: [TIR] Allow missing TensorIntrin in registry lookup

Posted by GitBox <gi...@apache.org>.
vinx13 commented on PR #12875:
URL: https://github.com/apache/tvm/pull/12875#issuecomment-1255417572

   One use case is check if tensor interns exists, it will allow further automation like generate tensor intrins if missing


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