[PATCH] D102733: [Matrix] Factor and distribute transposes across multiplies

Adam Nemet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 18 16:22:17 PDT 2021


anemet created this revision.
anemet added a reviewer: fhahn.
Herald added subscribers: tschuett, hiraditya.
anemet requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Now that we can fold some transposes into multiplies (CM: A * B^t and RM:                                                    
A^t * B), we want to move them around to create the optimal expressions:

                                               

- fold away double transposes while still using them to assert the shape
- sink transposes hoping they cancel out
- lift transposes when both operands are transposed

This also modifies the matrix remarks to include the number of exposed                                                       
transposes (i.e. transposes that we couldn't fold into a multiply).

                                               

The adjustment to the test remarks-inlining is a bit subtle: I am changing the                                               
double transpose to a single transpose so that we don't remove it completely.                                                
More importantly this changes some of the total instruction count, most                                                      
notable stores because we can no longer use a vector store.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102733

Files:
  llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
  llvm/test/Transforms/LowerMatrixIntrinsics/remarks-inlining.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/remarks-shared-subtrees.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/transpose-and-multiply-fold.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102733.346295.patch
Type: text/x-patch
Size: 22129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210518/e60af56d/attachment.bin>


More information about the llvm-commits mailing list