[PATCH] D133625: [mlir][MemRef] Simplify extract_strided_metadata(expand_shape)
Quentin Colombet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 9 17:43:42 PDT 2022
qcolombet created this revision.
qcolombet added reviewers: chelini, nicolasvasilache, aartbik, rriddle.
qcolombet added a project: MLIR.
Herald added subscribers: bzcheeseman, sdasgup3, Groverkss, wenzhicui, wrengr, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, mgester, arpith-jacob, antiagainst, shauheen, mehdi_amini.
Herald added a project: All.
qcolombet requested review of this revision.
Herald added a subscriber: stephenneuendorffer.
Add a pattern to the pass that simplifies `extract_strided_metadata(other_op(memref))`.
The new pattern gets rid of the expand_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(expand_shape(memref))
With
baseBuffer, baseOffset, baseSizes, baseStrides =
extract_strided_metadata(memref)
sizes#reassIdx =
baseSizes#reassDim / product(expandShapeSizes#j,
for j in group excluding
reassIdx)
strides#reassIdx =
baseStrides#reassDim * product(expandShapeSizes#j,
for j in
reassIdx+1..
reassIdx+group.size-1)
Where `reassIdx` is a reassociation index for the group at `reassDim` and `expandShapeSizes#j` is either:
- The constant size at dimension j, derived directly from the result type of the expand_shape op, or
- An affine expression: baseSizes#reassDim / product of all constant sizes in expandShapeSizes.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D133625
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: D133625.459237.patch
Type: text/x-patch
Size: 18356 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220910/d758d0c1/attachment-0001.bin>
More information about the llvm-commits
mailing list