[all-commits] [llvm/llvm-project] 6fd3c2: [MLIR] Add a utility pass to linearize `memref` (#...

Alan Li via All-commits all-commits at lists.llvm.org
Thu May 22 10:06:00 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6fd3c20d25a88ccc3f2b5275e67de8b88ad5f873
      https://github.com/llvm/llvm-project/commit/6fd3c20d25a88ccc3f2b5275e67de8b88ad5f873
  Author: Alan Li <me at alanli.org>
  Date:   2025-05-22 (Thu, 22 May 2025)

  Changed paths:
    M mlir/include/mlir/Dialect/MemRef/Transforms/Passes.td
    M mlir/include/mlir/Dialect/MemRef/Transforms/Transforms.h
    M mlir/lib/Dialect/MemRef/Transforms/CMakeLists.txt
    A mlir/lib/Dialect/MemRef/Transforms/FlattenMemRefs.cpp
    A mlir/test/Dialect/MemRef/flatten_memref.mlir

  Log Message:
  -----------
  [MLIR] Add a utility pass to linearize `memref` (#136797)

To add a transformation that simplifies memory access patterns, this PR
adds a memref linearizer which is based on the GPU/DecomposeMemRefs
pass, with the following changes:
* support vector dialect ops
* instead of decompose memrefs to rank-0 memrefs, flatten higher-ranked
memrefs to rank-1.

Notes:
* After the linearization, a MemRef's offset is kept, so a
`memref<4x8xf32, strided<[8, 1], offset: 100>>` becomes `memref<32xf32,
strided<[1], offset: 100>>`.
* It also works with dynamic shapes and strides and offsets (see test
cases for details).
* The shape of the casted memref is computed as 1d, flattened.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list