Skip to content

Commit 8c65e3d

Browse files
committed
Add AlignmentBytes class
1 parent 3e79681 commit 8c65e3d

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

mlir/include/mlir/Dialect/Vector/IR/VectorOps.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ struct VectorDim {
7777
int64_t dim;
7878
bool isScalable;
7979
};
80+
81+
struct AlignmentBytes {
82+
uint64_t alignment = 0;
83+
AlignmentBytes() = default;
84+
explicit AlignmentBytes(uint64_t alignment_) : alignment(alignment_){};
85+
operator bool() const { return 0 != alignment; }
86+
};
87+
8088
BroadcastableToResult
8189
isBroadcastableTo(Type srcType, VectorType dstVectorType,
8290
std::pair<VectorDim, VectorDim> *mismatchingDims = nullptr);

mlir/include/mlir/Dialect/Vector/IR/VectorOps.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1729,7 +1729,7 @@ def Vector_LoadOp : Vector_Op<"load", [
17291729
"Value":$base,
17301730
"ValueRange":$indices,
17311731
CArg<"bool", "false">:$nontemporal,
1732-
CArg<"uint64_t", "0">:$alignment), [{
1732+
CArg<"AlignmentBytes", "AlignmentBytes()">: $alignment), [{
17331733
return build($_builder, $_state, resultType, base, indices, nontemporal,
17341734
alignment != 0 ? $_builder.getI64IntegerAttr(alignment) :
17351735
nullptr);
@@ -1738,7 +1738,7 @@ def Vector_LoadOp : Vector_Op<"load", [
17381738
"Value":$base,
17391739
"ValueRange":$indices,
17401740
CArg<"bool", "false">:$nontemporal,
1741-
CArg<"uint64_t", "0">:$alignment), [{
1741+
CArg<"AlignmentBytes", "AlignmentBytes()">: $alignment), [{
17421742
return build($_builder, $_state, resultTypes, base, indices, nontemporal,
17431743
alignment != 0 ? $_builder.getI64IntegerAttr(alignment) :
17441744
nullptr);
@@ -2037,7 +2037,7 @@ def Vector_MaskedStoreOp :
20372037
"ValueRange":$indices,
20382038
"Value":$mask,
20392039
"Value":$valueToStore,
2040-
CArg<"uint64_t", "0">:$alignment), [{
2040+
CArg<"AlignmentBytes", "AlignmentBytes()">: $alignment), [{
20412041
return build($_builder, $_state, base, indices, mask, valueToStore,
20422042
alignment != 0 ? $_builder.getI64IntegerAttr(alignment) :
20432043
nullptr);

0 commit comments

Comments
 (0)