[PATCH] D134826: [mlir][MemRef] Simplify extract_strided_metadata(collapse_shape)

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 12:59:11 PDT 2022


qcolombet created this revision.
qcolombet added reviewers: nicolasvasilache, chelini.
qcolombet added a project: MLIR.
Herald added subscribers: bzcheeseman, sdasgup3, wenzhicui, wrengr, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, antiagainst, shauheen, rriddle, mehdi_amini.
Herald added a project: All.
qcolombet requested review of this revision.
Herald added a subscriber: stephenneuendorffer.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134826

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134826.463655.patch
Type: text/x-patch
Size: 17639 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220928/7d489d2b/attachment.bin>


More information about the llvm-commits mailing list