[Mlir-commits] [mlir] [mlir][vector] Add alignment attribute to vector operations. (PR #152507)

Erick Ochoa Lopez llvmlistbot at llvm.org
Fri Aug 15 07:29:59 PDT 2025


================
@@ -1919,7 +1922,6 @@ def Vector_MaskedLoadOp :
     load operation. It must be a positive power of 2. The operation must access
     memory at an address aligned to this boundary. Violations may lead to
     architecture-specific faults or performance penalties.
-    A value of 0 indicates no specific alignment requirement.
----------------
amd-eochoalo wrote:

@banach-space I am not sure about predicates yet. I think as long as alignment is modeled as an integer attribute, `I64Attr` should be written in the tblgen file, and also if it is optional, `OptionalAttr` should also be written in the tblgen file.

If the only requirements are positive and power of two, then they are already self-descriptive. One could also have something like:

```tblgen
       [MemRead]>:$base,
       Variadic<Index>:$indices,
       DefaultValuedOptionalAttr<BoolAttr, "false">:$nontemporal,
       OptionalAttr<IntValidAlignment<I64Attr>>:$alignment);

      // or also OptionalAttr<IntPositivePowerOf2<I64Attr>>:$alignment
```

```cxx
def IntPositivePowerOf2 : AllAttrOf<[IntPositive, IntPowerOf2]>;

class IntValidAlignment<Attr attr>: ConfinedAttr<attr, [IntPositivePowerOf2]>;
```

What exactly do you propose as a predicate here?

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


More information about the Mlir-commits mailing list