You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "PatrikPerssonInceptron (via GitHub)" <gi...@apache.org> on 2025/03/18 10:57:14 UTC

[PR] [FIX][RELAX] fix fusion of transpose + matmul when the weight is a constant [tvm]

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

   Applying the FuseTransposeMatmul pass on a matmul with a constant weight  would fail since the bind_constants defaults to true in the FuseOpsByPattern pass . This would lead the constant to be moved in to the fused function instead of being an input param, however on line 168 in /tvm/relax/transform/fuse_transpose_matmul.py
   
   ```pyhton
   out_dtype = function.ret_struct_info.dtype
                   return self.builder_.call_te(
                       te_transposed_matmul,
                       call.args[1],
                       call.args[0],
                       primfunc_name_hint="NT_matmul",
                   )
   ```
   
   , called later in the FuseTransposeMatmul pass, both input and weight are expected to be inputs to the fused function leading to a crash.
   
   I fixed it by explicitly setting bind_constants to false and I added a unit test to verify correct behavior when the weight is a constant. 


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


Re: [PR] [FIX][RELAX] fix fusion of transpose + matmul when constant weight [tvm]

Posted by "Hzfengsy (via GitHub)" <gi...@apache.org>.
Hzfengsy merged PR #17761:
URL: https://github.com/apache/tvm/pull/17761


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