[all-commits] [llvm/llvm-project] d83156: [mlir][MemRef] Simplify extract_strided_metadata(c...

qcolombet via All-commits all-commits at lists.llvm.org
Fri Sep 30 10:08:49 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d8315681714222e83e32beba374a5ff976d90059
      https://github.com/llvm/llvm-project/commit/d8315681714222e83e32beba374a5ff976d90059
  Author: Quentin Colombet <quentin.colombet at gmail.com>
  Date:   2022-09-30 (Fri, 30 Sep 2022)

  Changed paths:
    M mlir/lib/Dialect/MemRef/Transforms/SimplifyExtractStridedMetadata.cpp
    M mlir/test/Dialect/MemRef/simplify-extract-strided-metadata.mlir

  Log Message:
  -----------
  [mlir][MemRef] Simplify extract_strided_metadata(collapse_shape)

The new pattern gets rid of the collapse_shape operation while
materializing its effects on the sizes, and the strides of the base
object.

In other words, this simplification replaces:

```
baseBuffer, offset, sizes, strides =
    extract_strided_metadata(collapse_shape(memref))
```

With

```
baseBuffer, offset, baseSizes, baseStrides =
    extract_strided_metadata(memref)
for reassDim in {0 .. collapseRank - 1}
  sizes#reassDim = product(baseSizes#i for i in group[reassDim])
  strides#reassDim = baseStrides[group[reassDim].back()]
```

Note: baseBuffer and offset are unaffected by the collapse_shape
operation.

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




More information about the All-commits mailing list