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/12/14 21:05:30 UTC

[GitHub] [tvm] jwfromm opened a new pull request, #13615: [Relay] Remove overwriting of matmul shapes when they are static

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

   In the Relay Matmul shape relation, we are a little over enthusiastic about unifying dynamic shapes. If one of the shapes is static, it does not need to be unified. This change only rewrites dynamic shapes to required static constraints.


-- 
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] AndrewZhaoLuo commented on a diff in pull request #13615: [Relay] Remove overwriting of matmul shapes when they are static

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


##########
src/relay/op/nn/nn.h:
##########
@@ -115,20 +115,36 @@ bool MatmulRel(const Array<Type>& types, int num_inputs, const Attrs& attrs,
         auto sb = B_shape.size();
         if (transpose_a && transpose_b) {
           auto tmp = A_shape[sa - 2];
-          A_shape[sa - 2] = B_shape[sb - 1];
-          B_shape[sb - 1] = tmp;
+          if (A_shape[sa - 2].as<tir::AnyNode>()) {

Review Comment:
   There is now a ton of nesting. To make it readable I suggest a structure like 
   ```
   A_shape_new = ...
   B_shape_new = ...
   index_swap_a, index_swap_b;
   
   if (transpose_a && transpose_b) {
      // calculate index_swap_a and index_swap_b
   } ... 
   
   if (A_shape[index_swap_a].as<Any>...) {
       // do swap
   }
   
   if (B_shape[index_swap_b].as<Any>...
   ```
   
   
   
   



-- 
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] tvm-bot commented on pull request #13615: [Relay] Remove overwriting of matmul shapes when they are static

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

   <!---bot-comment-->
   
   Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
   
   <!--bot-comment-ccs-start-->
    * No users to tag found in teams: `relay` <sub>See [#10317](https://github.com/apache/tvm/issues/10317) for details</sub><!--bot-comment-ccs-end-->
   
   <sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>


-- 
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] jwfromm commented on pull request #13615: [Relay] Remove overwriting of matmul shapes when they are static

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

   I've added a check to `test_dense` to confirm that the input shapes aren't unnecessary made dynamic that fails without this change.


-- 
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] jwfromm commented on a diff in pull request #13615: [Relay] Remove overwriting of matmul shapes when they are static

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


##########
src/relay/op/nn/nn.h:
##########
@@ -115,20 +115,36 @@ bool MatmulRel(const Array<Type>& types, int num_inputs, const Attrs& attrs,
         auto sb = B_shape.size();
         if (transpose_a && transpose_b) {
           auto tmp = A_shape[sa - 2];
-          A_shape[sa - 2] = B_shape[sb - 1];
-          B_shape[sb - 1] = tmp;
+          if (A_shape[sa - 2].as<tir::AnyNode>()) {

Review Comment:
   Yeah good call, updated in latest push.



-- 
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] slyubomirsky merged pull request #13615: [Relay] Remove overwriting of matmul shapes when they are static

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


-- 
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] tvm-bot commented on pull request #13615: [Relay] Remove overwriting of matmul shapes when they are static

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

   <!---bot-comment-->
   
   Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
   
   <!--bot-comment-ccs-start-->
    * No users to tag found in teams: `relay` <sub>See [#10317](https://github.com/apache/tvm/issues/10317) for details</sub><!--bot-comment-ccs-end-->
   
   <sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>


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