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/11/17 23:46:27 UTC

[GitHub] [tvm] jwfromm commented on a diff in pull request #13423: [TOPI] Add handwritten matvec for dynamic cases

jwfromm commented on code in PR #13423:
URL: https://github.com/apache/tvm/pull/13423#discussion_r1025845938


##########
python/tvm/relay/op/strategy/x86.py:
##########
@@ -507,10 +507,26 @@ def matmul_strategy_cpu(attrs, inputs, out_type, target):
     return strategy
 
 
+def is_any(shape):
+    return any([isinstance(x, tir.Any) or isinstance(x, tir.SizeVar) for x in shape])
+
+
 @dense_strategy.register("cpu")
 def dense_strategy_cpu(attrs, inputs, out_type, target):
     """dense x86 strategy"""
+
     strategy = _op.OpStrategy()
+    # For dynamic shapes we use a hand written kernel. Right now it only
+    # supports matrix-vector multiplication.
+    if is_any(inputs[0].shape) or is_any(inputs[1].shape):

Review Comment:
   should we check the size of `inputs[0]` to make sure its a vector before dispatching?



##########
python/tvm/relay/op/strategy/x86.py:
##########
@@ -507,10 +507,26 @@ def matmul_strategy_cpu(attrs, inputs, out_type, target):
     return strategy
 
 
+def is_any(shape):

Review Comment:
   `is_dynamic` might be a more appropriate name for this function.



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