Skip to content

Commit ec73999

Browse files
committed
[MLIR] Use IntValidAlignment for alignment attributes
1 parent e1e65a4 commit ec73999

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ def MemRef_GlobalOp : MemRef_Op<"global", [Symbol]> {
11631163
MemRefTypeAttr:$type,
11641164
OptionalAttr<AnyAttr>:$initial_value,
11651165
UnitAttr:$constant,
1166-
OptionalAttr<I64Attr>:$alignment);
1166+
OptionalAttr<IntValidAlignment<I64Attr>>:$alignment);
11671167

11681168
let assemblyFormat = [{
11691169
($sym_visibility^)?
@@ -1231,8 +1231,7 @@ def LoadOp : MemRef_Op<"load",
12311231
[MemRead]>:$memref,
12321232
Variadic<Index>:$indices,
12331233
DefaultValuedOptionalAttr<BoolAttr, "false">:$nontemporal,
1234-
ConfinedAttr<OptionalAttr<I64Attr>,
1235-
[AllAttrOf<[IntPositive, IntPowerOf2]>]>:$alignment);
1234+
OptionalAttr<IntValidAlignment<I64Attr>>:$alignment);
12361235

12371236
let builders = [
12381237
OpBuilder<(ins "Value":$memref,
@@ -1965,8 +1964,7 @@ def MemRef_StoreOp : MemRef_Op<"store",
19651964
[MemWrite]>:$memref,
19661965
Variadic<Index>:$indices,
19671966
DefaultValuedOptionalAttr<BoolAttr, "false">:$nontemporal,
1968-
ConfinedAttr<OptionalAttr<I64Attr>,
1969-
[AllAttrOf<[IntPositive, IntPowerOf2]>]>:$alignment);
1967+
OptionalAttr<IntValidAlignment<I64Attr>>:$alignment);
19701968

19711969
let builders = [
19721970
OpBuilder<(ins "Value":$valueToStore,

mlir/include/mlir/Dialect/SPIRV/IR/SPIRVCooperativeMatrixOps.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def SPIRV_KHRCooperativeMatrixLoadOp : SPIRV_KhrVendorOp<"CooperativeMatrixLoad"
129129
SPIRV_KHR_CooperativeMatrixLayoutAttr:$matrix_layout,
130130
SPIRV_Integer:$stride,
131131
OptionalAttr<SPIRV_MemoryAccessAttr>:$memory_operand,
132-
OptionalAttr<I32Attr>:$alignment
132+
OptionalAttr<IntValidAlignment<I32Attr>>:$alignment
133133
);
134134

135135
let results = (outs
@@ -214,7 +214,7 @@ def SPIRV_KHRCooperativeMatrixStoreOp : SPIRV_KhrVendorOp<"CooperativeMatrixStor
214214
SPIRV_KHR_CooperativeMatrixLayoutAttr:$matrix_layout,
215215
SPIRV_Integer:$stride,
216216
OptionalAttr<SPIRV_MemoryAccessAttr>:$memory_operand,
217-
OptionalAttr<I32Attr>:$alignment
217+
OptionalAttr<IntValidAlignment<I32Attr>>:$alignment
218218
);
219219

220220
let results = (outs);

mlir/include/mlir/Dialect/SPIRV/IR/SPIRVMemoryOps.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ def SPIRV_CopyMemoryOp : SPIRV_Op<"CopyMemory", []> {
121121
SPIRV_AnyPtr:$target,
122122
SPIRV_AnyPtr:$source,
123123
OptionalAttr<SPIRV_MemoryAccessAttr>:$memory_access,
124-
OptionalAttr<I32Attr>:$alignment,
124+
OptionalAttr<IntValidAlignment<I32Attr>>:$alignment,
125125
OptionalAttr<SPIRV_MemoryAccessAttr>:$source_memory_access,
126-
OptionalAttr<I32Attr>:$source_alignment
126+
OptionalAttr<IntValidAlignment<I32Attr>>:$source_alignment
127127
);
128128

129129
let results = (outs);

0 commit comments

Comments
 (0)