[Mlir-commits] [mlir] [mlir][vector][memref] Add `alignment` attribute to memory access ops (PR #144344)

Andrzej WarzyƄski llvmlistbot at llvm.org
Mon Jul 7 00:59:24 PDT 2025


================
@@ -613,3 +613,15 @@ func.func @memref_transpose_map(%src : memref<?x?xf32>) -> memref<?x?xf32, affin
   %dst = memref.transpose %src (i, j) -> (j, i) : memref<?x?xf32> to memref<?x?xf32, affine_map<(d0, d1)[s0] -> (d1 * s0 + d0)>>
   return %dst : memref<?x?xf32, affine_map<(d0, d1)[s0] -> (d1 * s0 + d0)>>
 }
+
+// -----
+
+// CHECK-LABEL: func @test_load_store_alignment
+// CHECK: memref.load {{.*}} {alignment = 16 : i64}
+// CHECK: memref.store {{.*}} {alignment = 16 : i64}
+func.func @test_load_store_alignment(%memref: memref<4xi32>) {
+  %c0 = arith.constant 0 : index
+  %val = memref.load %memref[%c0] { alignment = 16 } : memref<4xi32>
+  memref.store %val, %memref[%c0] { alignment = 16 } : memref<4xi32>
+  return
+}
----------------
banach-space wrote:

1. Try to move these near other tests for `memref.load`/`memref.store` (sadly, these are not really grouped atm, but no harm in trying to improve that)
2. Remove `test` from _test_ function name - that doesn't add any useful context. More on Test naming: https://mlir.llvm.org/getting_started/TestingGuide/#example-improving-test-readability--naming

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


More information about the Mlir-commits mailing list