masahi commented on PR #14440:
URL: https://github.com/apache/tvm/pull/14440#issuecomment-1491209909

   Hey I'm happy to report that I have pattern-based rewriter for dataflow 
block working. Compared to the existing call node based matching & rewriting 
that requires a common post-dominator in a pattern, it lets us match a tree 
structure and replace leaf nodes or branches with new expression. 
   
   This can be immediately used for combining *any* number of multiple matmuls 
sharing the same LHS into one matmul. In Relay, we have `CombineParallelDense` 
pass for that purpose, but we can achieve the same thing via graph (tree) 
matching and rewrite.   
   
   For example, in SD UNet we have many three parallel matmul for QKV 
projections. In addition, there are also highly non-obvious parallel matmuls 
consisting of 32 or 22 of them. Those patterns can all be matched and rewritten 
via the following generic pattern and rewriter. I'm very excited about this! 
   https://github.com/masahi/web-stable-diffusion/blob/unet-opt/test.py#L37-L68


-- 
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-unsubscr...@tvm.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to