[Mlir-commits] [mlir] [mlir][vector][memref] Add `alignment` attribute to memory access ops (PR #144344)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Thu Jul 17 01:46:10 PDT 2025
================
@@ -1995,6 +1995,15 @@ func.func @vector_load(%src : memref<?xi8>) {
// -----
+func.func @negative_load_alignment(%memref: memref<4xi32>) {
+ %c0 = arith.constant 0 : index
+ // expected-error @below {{'vector.load' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}
+ %val = vector.load %memref[%c0] { alignment = -1 } : memref<4xi32>, vector<4xi32>
+ return
+}
+
+// -----
+
----------------
banach-space wrote:
[nit] Please use consistent naming across the file and within a single PR. You can drop "negative" in this case as all cases in invalid.mlir are "negative" (i.e. they are meant to fail verification).
```suggestion
func.func @non_power_of_2_load_alignmen(%memref: memref<4xi32>) {
%c0 = arith.constant 0 : index
// expected-error @below {{'vector.load' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}
%val = vector.load %memref[%c0] { alignment = -1 } : memref<4xi32>, vector<4xi32>
return
}
// -----
```
https://github.com/llvm/llvm-project/pull/144344
More information about the Mlir-commits
mailing list