[all-commits] [llvm/llvm-project] ba916c: [mlir][MemRef] Canonicalize reinterpret_cast(extra...

qcolombet via All-commits all-commits at lists.llvm.org
Mon Aug 29 10:01:47 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ba916c0cf6d0149f81bf1137e88f7d6fd3b0cc76
      https://github.com/llvm/llvm-project/commit/ba916c0cf6d0149f81bf1137e88f7d6fd3b0cc76
  Author: Quentin Colombet <quentin.colombet at gmail.com>
  Date:   2022-08-29 (Mon, 29 Aug 2022)

  Changed paths:
    M mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
    M mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
    M mlir/test/Dialect/MemRef/canonicalize.mlir

  Log Message:
  -----------
  [mlir][MemRef] Canonicalize reinterpret_cast(extract_strided_metadata)

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 iss 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!

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




More information about the All-commits mailing list