[Mlir-commits] [mlir] [mlir] Add memref normalization support for reinterpret_cast op (PR #133417)

Arnab Dutta llvmlistbot at llvm.org
Mon Apr 28 03:03:00 PDT 2025


================
@@ -3,8 +3,8 @@
 // This file tests whether the memref type having non-trivial map layouts
 // are normalized to trivial (identity) layouts.
 
-// CHECK-DAG: #[[$REDUCE_MAP1:.*]] = affine_map<(d0, d1) -> ((d0 mod 2) * 2 + d1 mod 2 + (d0 floordiv 2) * 4 + (d1 floordiv 2) * 8)>
-// CHECK-DAG: #[[$REDUCE_MAP2:.*]] = affine_map<(d0, d1) -> (d0 mod 2 + (d1 mod 2) * 2 + (d0 floordiv 2) * 8 + (d1 floordiv 2) * 4)>
+// CHECK-DAG: #[[$REDUCE_MAP1:.*]] = affine_map<(d0, d1) -> (d0 * 2 + d1 + (d1 floordiv 2) * 6)>
----------------
arnab-polymage wrote:

This is due to a modification I did in RAMUW. Currently whenever we call RAMUW on  memref.load with reduced_rank -- we take a separate path and call `transformMemRefLoadWithReducedRank` which unnecessary, and there is code duplication. In ``transformMemRefLoadWithReducedRank` the author does not simplify the map or compose map and operands. I've removed that special path and improved the logic in RAMUW so that all kinds of memref load/store(s) are handled. And in RAMUW we call `ullyComposeAffineMapAndOperands` and `canonicalizeMapAndOperands`, and hence we see simplified map now in the output.

https://github.com/llvm/llvm-project/pull/133417


More information about the Mlir-commits mailing list