Skip to content

Commit 8798040

Browse files
committed
Add AlignmentBytes class
1 parent 3b5aff5 commit 8798040

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);
@@ -1847,7 +1847,7 @@ def Vector_StoreOp : Vector_Op<"store", [
18471847
"Value":$base,
18481848
"ValueRange":$indices,
18491849
CArg<"bool", "false">:$nontemporal,
1850-
CArg<"uint64_t", "0">:$alignment), [{
1850+
CArg<"AlignmentBytes", "AlignmentBytes()">:$alignment), [{
18511851
return build($_builder, $_state, valueToStore, base, indices, nontemporal,
18521852
alignment != 0 ? $_builder.getI64IntegerAttr(alignment) :
18531853
nullptr);

0 commit comments

Comments
 (0)