@@ -98,6 +98,8 @@ def OpenACC_UseDevice : I64EnumAttrCase<"acc_use_device", 20>;
98
98
def OpenACC_Reduction : I64EnumAttrCase<"acc_reduction", 21>;
99
99
def OpenACC_DeclareDeviceResident : I64EnumAttrCase<"acc_declare_device_resident", 22>;
100
100
def OpenACC_DeclareLink : I64EnumAttrCase<"acc_declare_link", 23>;
101
+ def OpenACC_Cache : I64EnumAttrCase<"acc_cache", 24>;
102
+ def OpenACC_CacheReadonly : I64EnumAttrCase<"acc_cache_readonly", 25>;
101
103
102
104
def OpenACC_DataClauseEnum : I64EnumAttr<"DataClause",
103
105
"data clauses supported by OpenACC",
@@ -109,6 +111,7 @@ def OpenACC_DataClauseEnum : I64EnumAttr<"DataClause",
109
111
OpenACC_IsDevicePtrClause, OpenACC_GetDevicePtrClause, OpenACC_UpdateHost,
110
112
OpenACC_UpdateSelf, OpenACC_UpdateDevice, OpenACC_UseDevice,
111
113
OpenACC_Reduction, OpenACC_DeclareDeviceResident, OpenACC_DeclareLink,
114
+ OpenACC_Cache, OpenACC_CacheReadonly,
112
115
]> {
113
116
let cppNamespace = "::mlir::acc";
114
117
let genSpecializedAttr = 0;
@@ -406,6 +409,22 @@ def OpenACC_DeclareLinkOp : OpenACC_DataEntryOp<"declare_link",
406
409
let summary = "Represents acc declare link semantics.";
407
410
}
408
411
412
+ //===----------------------------------------------------------------------===//
413
+ // 2.10 cache directive
414
+ //===----------------------------------------------------------------------===//
415
+ def OpenACC_CacheOp : OpenACC_DataEntryOp<"cache",
416
+ "mlir::acc::DataClause::acc_cache", ""> {
417
+ let summary = "Represents the cache directive that is associated with a "
418
+ "loop.";
419
+
420
+ let extraClassDeclaration = [{
421
+ /// Check if this is a cache with readonly modifier.
422
+ bool isCacheReadonly() {
423
+ return getDataClause() == acc::DataClause::acc_cache_readonly;
424
+ }
425
+ }];
426
+ }
427
+
409
428
// Data exit operation does not refer to OpenACC spec terminology, but to
410
429
// terminology used in this dialect. It refers to data operations that will appear
411
430
// after data or compute region. It will be used as the base of acc dialect
@@ -1140,22 +1159,23 @@ def OpenACC_LoopOp : OpenACC_Op<"loop",
1140
1159
}];
1141
1160
1142
1161
let arguments = (ins OptionalAttr<I64Attr>:$collapse,
1143
- Optional<IntOrIndex>:$gangNum,
1144
- Optional<IntOrIndex>:$gangDim,
1145
- Optional<IntOrIndex>:$gangStatic,
1146
- Optional<IntOrIndex>:$workerNum,
1147
- Optional<IntOrIndex>:$vectorLength,
1148
- UnitAttr:$seq,
1149
- UnitAttr:$independent,
1150
- UnitAttr:$auto_,
1151
- UnitAttr:$hasGang,
1152
- UnitAttr:$hasWorker,
1153
- UnitAttr:$hasVector,
1154
- Variadic<IntOrIndex>:$tileOperands,
1155
- Variadic<OpenACC_PointerLikeTypeInterface>:$privateOperands,
1156
- OptionalAttr<SymbolRefArrayAttr>:$privatizations,
1157
- Variadic<AnyType>:$reductionOperands,
1158
- OptionalAttr<SymbolRefArrayAttr>:$reductionRecipes);
1162
+ Optional<IntOrIndex>:$gangNum,
1163
+ Optional<IntOrIndex>:$gangDim,
1164
+ Optional<IntOrIndex>:$gangStatic,
1165
+ Optional<IntOrIndex>:$workerNum,
1166
+ Optional<IntOrIndex>:$vectorLength,
1167
+ UnitAttr:$seq,
1168
+ UnitAttr:$independent,
1169
+ UnitAttr:$auto_,
1170
+ UnitAttr:$hasGang,
1171
+ UnitAttr:$hasWorker,
1172
+ UnitAttr:$hasVector,
1173
+ Variadic<IntOrIndex>:$tileOperands,
1174
+ Variadic<OpenACC_PointerLikeTypeInterface>:$privateOperands,
1175
+ OptionalAttr<SymbolRefArrayAttr>:$privatizations,
1176
+ Variadic<AnyType>:$reductionOperands,
1177
+ OptionalAttr<SymbolRefArrayAttr>:$reductionRecipes,
1178
+ Variadic<OpenACC_PointerLikeTypeInterface>:$cacheOperands);
1159
1179
1160
1180
let results = (outs Variadic<AnyType>:$results);
1161
1181
@@ -1181,6 +1201,7 @@ def OpenACC_LoopOp : OpenACC_Op<"loop",
1181
1201
| `reduction` `(` custom<SymOperandList>(
1182
1202
$reductionOperands, type($reductionOperands), $reductionRecipes)
1183
1203
`)`
1204
+ | `cache` `(` $cacheOperands `:` type($cacheOperands) `)`
1184
1205
)
1185
1206
$region
1186
1207
( `(` type($results)^ `)` )?
0 commit comments