Skip to content

Commit 52c04c7

Browse files
committed
R2: Making Atomic control non-optional
1 parent c9b6508 commit 52c04c7

File tree

9 files changed

+148
-149
lines changed

9 files changed

+148
-149
lines changed

mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1546,7 +1546,7 @@ def AtomicUpdateOp : OpenMP_Op<"atomic.update", traits = [
15461546
let arguments = !con(
15471547
(ins Arg<OpenMP_PointerLikeType,
15481548
"Address of variable to be updated", [MemRead, MemWrite]>:$x,
1549-
OptionalAttr<AtomicControlAttr>:$atomic_control),
1549+
AtomicControlAttr:$atomic_control),
15501550
clausesArgs);
15511551

15521552
// Override region definition.

mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func.func @atomic_update() {
133133
%1 = arith.constant 1 : i32
134134
%2 = arith.addi %arg0, %1 : i32
135135
omp.yield(%2 : i32)
136-
}
136+
} {atomic_control = #omp.atomic_control<>}
137137
return
138138
}
139139
llvm.mlir.global internal @_QFsEc() : i32 {

mlir/test/Dialect/OpenMP/canonicalize.mlir

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ func.func @update_no_op(%x : memref<i32>) {
44
omp.atomic.update %x : memref<i32> {
55
^bb0(%xval : i32):
66
omp.yield(%xval : i32)
7-
}
7+
} {atomic_control = #omp.atomic_control<>}
88
return
99
}
1010

@@ -17,7 +17,7 @@ func.func @update_write_op(%x : memref<i32>, %value: i32) {
1717
omp.atomic.update %x : memref<i32> {
1818
^bb0(%xval : i32):
1919
omp.yield(%value : i32)
20-
}
20+
} {atomic_control = #omp.atomic_control<>}
2121
return
2222
}
2323

@@ -33,7 +33,7 @@ func.func @update_normal(%x : memref<i32>, %value: i32) {
3333
^bb0(%xval : i32):
3434
%newval = arith.addi %xval, %value : i32
3535
omp.yield(%newval : i32)
36-
}
36+
} {atomic_control = #omp.atomic_control<>}
3737
return
3838
}
3939

@@ -50,7 +50,7 @@ func.func @update_unnecessary_computations(%x: memref<i32>) {
5050
^bb0(%xval: i32):
5151
%newval = arith.addi %xval, %c0 : i32
5252
omp.yield(%newval: i32)
53-
}
53+
} {atomic_control = #omp.atomic_control<>}
5454
return
5555
}
5656

@@ -65,7 +65,7 @@ func.func @update_unnecessary_computations(%x: memref<i32>) {
6565
^bb0(%xval: i32):
6666
%newval = arith.muli %xval, %c0 : i32
6767
omp.yield(%newval: i32)
68-
}
68+
} {atomic_control = #omp.atomic_control<>}
6969
return
7070
}
7171

mlir/test/Dialect/OpenMP/invalid.mlir

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ func.func @omp_atomic_update1(%x: memref<i32>, %expr: f32) {
10071007
^bb0(%xval: f32):
10081008
%newval = llvm.fadd %xval, %expr : f32
10091009
omp.yield (%newval : f32)
1010-
}
1010+
} {atomic_control = #omp.atomic_control<>}
10111011
return
10121012
}
10131013

@@ -1020,7 +1020,7 @@ func.func @omp_atomic_update2(%x: memref<i32>, %expr: i32) {
10201020
^bb0(%xval: i32):
10211021
%newval = llvm.add %xval, %expr : i32
10221022
omp.terminator
1023-
}
1023+
} {atomic_control = #omp.atomic_control<>}
10241024
return
10251025
}
10261026

@@ -1032,7 +1032,7 @@ func.func @omp_atomic_update3(%x: memref<i32>, %expr: i32) {
10321032
^bb0(%xval: i32):
10331033
%newval = llvm.add %xval, %expr : i32
10341034
omp.yield (%newval : i32)
1035-
}
1035+
} {atomic_control = #omp.atomic_control<>}
10361036
return
10371037
}
10381038

@@ -1044,7 +1044,7 @@ func.func @omp_atomic_update4(%x: memref<i32>, %expr: i32) {
10441044
^bb0(%xval: i32):
10451045
%newval = llvm.add %xval, %expr : i32
10461046
omp.yield (%newval : i32)
1047-
}
1047+
} {atomic_control = #omp.atomic_control<>}
10481048
return
10491049
}
10501050

@@ -1056,7 +1056,7 @@ func.func @omp_atomic_update5(%x: memref<i32>, %expr: i32) {
10561056
^bb0(%xval: i32):
10571057
%newval = llvm.add %xval, %expr : i32
10581058
omp.yield (%newval : i32)
1059-
}
1059+
} {atomic_control = #omp.atomic_control<>}
10601060
return
10611061
}
10621062

@@ -1068,7 +1068,7 @@ func.func @omp_atomic_update6(%x: memref<i32>, %expr: i32) {
10681068
^bb0(%xval: i32):
10691069
%newval = llvm.add %xval, %expr : i32
10701070
omp.yield (%newval, %expr : i32, i32)
1071-
}
1071+
} {atomic_control = #omp.atomic_control<>}
10721072
return
10731073
}
10741074

@@ -1080,7 +1080,7 @@ func.func @omp_atomic_update7(%x: memref<i32>, %expr: i32, %y: f32) {
10801080
^bb0(%xval: i32):
10811081
%newval = llvm.add %xval, %expr : i32
10821082
omp.yield (%y: f32)
1083-
}
1083+
} {atomic_control = #omp.atomic_control<>}
10841084
return
10851085
}
10861086

@@ -1092,7 +1092,7 @@ func.func @omp_atomic_update8(%x: memref<i32>, %expr: i32) {
10921092
^bb0(%xval: i32, %tmp: i32):
10931093
%newval = llvm.add %xval, %expr : i32
10941094
omp.yield (%newval : i32)
1095-
}
1095+
} {atomic_control = #omp.atomic_control<>}
10961096
return
10971097
}
10981098

@@ -1104,7 +1104,7 @@ func.func @omp_atomic_update(%x: memref<i32>, %expr: i32) {
11041104
^bb0(%xval: i32):
11051105
%newval = llvm.add %xval, %expr : i32
11061106
omp.yield (%newval : i32)
1107-
}
1107+
} {atomic_control = #omp.atomic_control<>}
11081108
return
11091109
}
11101110

@@ -1116,7 +1116,7 @@ func.func @omp_atomic_update(%x: memref<i32>, %expr: i32) {
11161116
^bb0(%xval: i32):
11171117
%newval = llvm.add %xval, %expr : i32
11181118
omp.yield (%newval : i32)
1119-
}
1119+
} {atomic_control = #omp.atomic_control<>}
11201120
return
11211121
}
11221122

@@ -1128,7 +1128,7 @@ func.func @omp_atomic_update(%x: memref<i32>, %expr: i32) {
11281128
^bb0(%xval: i32):
11291129
%newval = llvm.add %xval, %expr : i32
11301130
omp.yield (%newval : i32)
1131-
}
1131+
} {atomic_control = #omp.atomic_control<>}
11321132
return
11331133
}
11341134

@@ -1164,12 +1164,12 @@ func.func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) {
11641164
^bb0(%xval: i32):
11651165
%newval = llvm.add %xval, %expr : i32
11661166
omp.yield (%newval : i32)
1167-
}
1167+
} {atomic_control = #omp.atomic_control<>}
11681168
omp.atomic.update %x : memref<i32> {
11691169
^bb0(%xval: i32):
11701170
%newval = llvm.add %xval, %expr : i32
11711171
omp.yield (%newval : i32)
1172-
}
1172+
} {atomic_control = #omp.atomic_control<>}
11731173
omp.terminator
11741174
}
11751175
return
@@ -1197,7 +1197,7 @@ func.func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) {
11971197
^bb0(%xval: i32):
11981198
%newval = llvm.add %xval, %expr : i32
11991199
omp.yield (%newval : i32)
1200-
}
1200+
} {atomic_control = #omp.atomic_control<>}
12011201
omp.terminator
12021202
}
12031203
return
@@ -1212,7 +1212,7 @@ func.func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) {
12121212
^bb0(%xval: i32):
12131213
%newval = llvm.add %xval, %expr : i32
12141214
omp.yield (%newval : i32)
1215-
}
1215+
} {atomic_control = #omp.atomic_control<>}
12161216
omp.atomic.write %x = %expr : memref<i32>, i32
12171217
omp.terminator
12181218
}
@@ -1240,7 +1240,7 @@ func.func @omp_atomic_capture(%x: memref<i32>, %y: memref<i32>, %v: memref<i32>,
12401240
^bb0(%xval: i32):
12411241
%newval = llvm.add %xval, %expr : i32
12421242
omp.yield (%newval : i32)
1243-
}
1243+
} {atomic_control = #omp.atomic_control<>}
12441244
omp.atomic.read %v = %y : memref<i32>, memref<i32>, i32
12451245
omp.terminator
12461246
}
@@ -1256,7 +1256,7 @@ func.func @omp_atomic_capture(%x: memref<i32>, %y: memref<i32>, %v: memref<i32>,
12561256
^bb0(%xval: i32):
12571257
%newval = llvm.add %xval, %expr : i32
12581258
omp.yield (%newval : i32)
1259-
}
1259+
} {atomic_control = #omp.atomic_control<>}
12601260
omp.terminator
12611261
}
12621262
}
@@ -1281,7 +1281,7 @@ func.func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) {
12811281
^bb0(%xval: i32):
12821282
%newval = llvm.add %xval, %expr : i32
12831283
omp.yield(%newval : i32)
1284-
}
1284+
} {atomic_control = #omp.atomic_control<>}
12851285
omp.atomic.read %v = %x : memref<i32>, memref<i32>, i32
12861286
}
12871287
return
@@ -1296,7 +1296,7 @@ func.func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) {
12961296
^bb0(%xval: i32):
12971297
%newval = llvm.add %xval, %expr : i32
12981298
omp.yield(%newval : i32)
1299-
}
1299+
} {atomic_control = #omp.atomic_control<>}
13001300
omp.atomic.read %v = %x : memref<i32>, memref<i32>, i32
13011301
}
13021302
return
@@ -1311,7 +1311,7 @@ func.func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) {
13111311
^bb0(%xval: i32):
13121312
%newval = llvm.add %xval, %expr : i32
13131313
omp.yield(%newval : i32)
1314-
}
1314+
} {atomic_control = #omp.atomic_control<>}
13151315
omp.atomic.read %v = %x : memref<i32>, memref<i32>, i32
13161316
}
13171317
return
@@ -1326,7 +1326,7 @@ func.func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) {
13261326
^bb0(%xval: i32):
13271327
%newval = llvm.add %xval, %expr : i32
13281328
omp.yield(%newval : i32)
1329-
}
1329+
} {atomic_control = #omp.atomic_control<>}
13301330
omp.atomic.read %v = %x : memref<i32>, memref<i32>, i32
13311331
}
13321332
return
@@ -1341,7 +1341,7 @@ func.func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) {
13411341
^bb0(%xval: i32):
13421342
%newval = llvm.add %xval, %expr : i32
13431343
omp.yield(%newval : i32)
1344-
}
1344+
} {atomic_control = #omp.atomic_control<>}
13451345
omp.atomic.read %v = %x : memref<i32>, memref<i32>, i32
13461346
}
13471347
return
@@ -1356,7 +1356,7 @@ func.func @omp_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) {
13561356
^bb0(%xval: i32):
13571357
%newval = llvm.add %xval, %expr : i32
13581358
omp.yield(%newval : i32)
1359-
}
1359+
} {atomic_control = #omp.atomic_control<>}
13601360
omp.atomic.read %v = %x memory_order(seq_cst) : memref<i32>, memref<i32>, i32
13611361
}
13621362
return

0 commit comments

Comments
 (0)