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

Erick Ochoa Lopez llvmlistbot at llvm.org
Mon Aug 11 06:47:22 PDT 2025


================
@@ -2246,14 +2301,39 @@ def Vector_ExpandLoadOp :
     "type($base) `,` type($mask) `,` type($pass_thru) `into` type($result)";
   let hasCanonicalizer = 1;
   let hasVerifier = 1;
+
+  let builders = [
+    OpBuilder<(ins "VectorType":$resultType,
+                   "Value":$base,
+                   "ValueRange":$indices,
+                   "Value":$mask,
+                   "Value":$passthrough,
+                   CArg<"llvm::MaybeAlign", "llvm::MaybeAlign()">:$alignment), [{
+      return build($_builder, $_state, resultType, base, indices, mask, passthrough,
+                   alignment.has_value() ? $_builder.getI64IntegerAttr(alignment->value()) :
+                                    nullptr);
+    }]>,
+    OpBuilder<(ins "TypeRange":$resultTypes,
+                   "Value":$base,
+                   "ValueRange":$indices,
+                   "Value":$mask,
+                   "Value":$passthrough,
+                   CArg<"llvm::MaybeAlign", "llvm::MaybeAlign()">:$alignment), [{
+      return build($_builder, $_state, resultTypes, base, indices, mask, passthrough,
+                   alignment.has_value() ? $_builder.getI64IntegerAttr(alignment->value()) :
+                                    nullptr);
+    }]>
+  ];
----------------
amd-eochoalo wrote:

Thanks! You are right. I had some issues with a constructor used in the code and found that the second approach solve the issues. I can't replicate the issue now so maybe I left it before making some other changes. Here, I removed the extra constructors for scatter and gather https://github.com/llvm/llvm-project/pull/152507/commits/9b451db43c23ab4a8441790ba05d1dccff0cf84a https://github.com/llvm/llvm-project/pull/152507/commits/a71452152eb9b067d799dfbef9f69d4ac4b0131e

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


More information about the Mlir-commits mailing list