[all-commits] [llvm/llvm-project] bf7eb4: [Matrix] RAUW should only replace an instruction i...

anemet via All-commits all-commits at lists.llvm.org
Tue Jul 27 11:36:57 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bf7eb48454872cce85da42e0c006fa214e38fc0a
      https://github.com/llvm/llvm-project/commit/bf7eb48454872cce85da42e0c006fa214e38fc0a
  Author: Adam Nemet <anemet at apple.com>
  Date:   2021-07-27 (Tue, 27 Jul 2021)

  Changed paths:
    M llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
    M llvm/test/Transforms/LowerMatrixIntrinsics/transpose-opts.ll

  Log Message:
  -----------
  [Matrix] RAUW should only replace an instruction in ShapeMap if supportsShapeInfo

As an instruction is replaced in optimizeTransposes RAUW will replace it in
the ShapeMap (ShapeMap is ValueMap so that uses are updated).  In
finalizeLowering however we skip updating uses if they are in the ShapeMap
since they will be lowered separately at which point we pick up the lowered
operands.

In the testcase what happened was that since we replaced the doubled-transpose
with the shuffle, it ended up in the ShapeMap.  As we lowered the
columnwise-load the use in the shuffle was not updated.  Then as we removed
the original columnwise-load we changed that to an undef.  I.e. we ended up
with:

```
%shuf = shufflevector <8 x double> undef, <8 x double> poison, <6 x i32>
                                   ^^^^^
                                  <i32 0, i32 1, i32 2, i32 4, i32 5, i32 6>
```

Besides the fix itself, I have fortified this last bit.  As we change uses to
undef when removing instruction we track the undefed instruction to make sure
we eventually remove those too.  This would have caught the issue at compile
time.

Differential Revision: https://reviews.llvm.org/D106714


  Commit: d87d3615f75502b3adf93d05d4a217f6ab947fdd
      https://github.com/llvm/llvm-project/commit/d87d3615f75502b3adf93d05d4a217f6ab947fdd
  Author: Adam Nemet <anemet at apple.com>
  Date:   2021-07-27 (Tue, 27 Jul 2021)

  Changed paths:
    M llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
    M llvm/test/Transforms/LowerMatrixIntrinsics/transpose-opts.ll

  Log Message:
  -----------
  [Matrix] Fix shape for factored transpose

The shape of the input is C x R.

Differential Revision: https://reviews.llvm.org/D106722


Compare: https://github.com/llvm/llvm-project/compare/02077da7e7a8...d87d3615f755


More information about the All-commits mailing list