Files
clang-p2996/mlir/lib/Dialect/MemRef/Transforms/FlattenMemRefs.cpp
Alan Li 6fd3c20d25 [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.
2025-05-22 13:05:37 -04:00

11 KiB