[PATCH] D132776: [mlir][MemRef] Canonicalize reinterpret_cast(extract_strided_metadata)

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 18:29:38 PDT 2022


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

Add a canonicalizetion step for
reinterpret_cast(extract_strided_metadata).
This step replaces this sequence of operations by either:

- A noop, i.e., the original memref is directly used, or
- A plain cast of the original memref

The choice is ultimately made based on whether the original memref type
is equal to what the reinterpret_cast is producing. For instance, the
reinterpret_cast could be changing some dimensions from static to
dynamic and in such case, we need to keep a cast.

The transformation is currently only performed when the reinterpret_cast
uses exactly the same arguments as what the extract_strided_metadata
produces. It may be possible to be more aggressive here but I wanted to
start with a relatively simple MLIR patch for my first one!


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132776

Files:
  mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
  mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
  mlir/test/Dialect/MemRef/canonicalize.mlir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132776.456072.patch
Type: text/x-patch
Size: 7897 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220827/f9fe470f/attachment.bin>


More information about the llvm-commits mailing list