summaryrefslogtreecommitdiff
path: root/mlir/include
diff options
context:
space:
mode:
authorValentin Clement <clementval@gmail.com>2023-05-11 14:53:19 -0700
committerValentin Clement <clementval@gmail.com>2023-05-11 14:55:25 -0700
commit5cbe3381a65c14793f660f456f6daff674ac23bd (patch)
tree5e90283e0e1ca5ffe90ea3b17d46e8cd9b7b7e5b /mlir/include
parent036549fc6c7cb9ecddd82c1401a2b50882a219f7 (diff)
downloadllvm-5cbe3381a65c14793f660f456f6daff674ac23bd.tar.gz
[mlir][openacc] Add host_data operation
The acc.host_data operation models the OpenACC host_data construct (2.8). The host_data construct defines a region where the address of data in device memory available on the host. The operation is modeled in a similar way than acc.data operation. Reviewed By: razvanlupusoru, jeanPerier Differential Revision: https://reviews.llvm.org/D150289
Diffstat (limited to 'mlir/include')
-rw-r--r--mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td48
1 files changed, 47 insertions, 1 deletions
diff --git a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
index 1479ff10356c..5370c8fa8feb 100644
--- a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
+++ b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
@@ -87,6 +87,7 @@ def OpenACC_GetDevicePtrClause : I64EnumAttrCase<"acc_getdeviceptr", 16>;
def OpenACC_UpdateHost : I64EnumAttrCase<"acc_update_host", 17>;
def OpenACC_UpdateSelf : I64EnumAttrCase<"acc_update_self", 18>;
def OpenACC_UpdateDevice : I64EnumAttrCase<"acc_update_device", 19>;
+def OpenACC_UseDevice : I64EnumAttrCase<"acc_use_device", 20>;
def OpenACC_DataClauseEnum : I64EnumAttr<"DataClause",
"data clauses supported by OpenACC",
@@ -96,7 +97,7 @@ def OpenACC_DataClauseEnum : I64EnumAttr<"DataClause",
OpenACC_AttachClause, OpenACC_DetachClause, OpenACC_NoCreateClause,
OpenACC_PrivateClause, OpenACC_FirstPrivateClause,
OpenACC_IsDevicePtrClause, OpenACC_GetDevicePtrClause, OpenACC_UpdateHost,
- OpenACC_UpdateSelf, OpenACC_UpdateDevice,
+ OpenACC_UpdateSelf, OpenACC_UpdateDevice, OpenACC_UseDevice,
]> {
let cppNamespace = "::mlir::acc";
}
@@ -298,6 +299,14 @@ def OpenACC_UpdateDeviceOp : OpenACC_DataEntryOp<"update_device",
let summary = "Represents acc update device semantics.";
}
+//===----------------------------------------------------------------------===//
+// 2.8 use_device clause
+//===----------------------------------------------------------------------===//
+def OpenACC_UseDeviceOp : OpenACC_DataEntryOp<"use_device",
+ "mlir::acc::DataClause::acc_use_device"> {
+ let summary = "Represents acc use_device semantics.";
+}
+
// Data exit operation does not refer to OpenACC spec terminology, but to
// terminology used in this dialect. It refers to data operations that will appear
// after data or compute region. It will be used as the base of acc dialect
@@ -741,6 +750,43 @@ def OpenACC_ExitDataOp : OpenACC_Op<"exit_data", [AttrSizedOperandSegments]> {
}
//===----------------------------------------------------------------------===//
+// 2.8 Host_Data Construct
+//===----------------------------------------------------------------------===//
+
+def OpenACC_HostDataOp : OpenACC_Op<"host_data", [AttrSizedOperandSegments]> {
+ let summary = "host_data construct";
+
+ let description = [{
+ The "acc.host_data" operation represents the OpenACC host_data construct.
+
+ Example:
+
+ ```mlir
+ %0 = acc.use_device varPtr(%a : !llvm.ptr<f32>) -> !llvm.ptr<f32>
+ acc.host_data dataOperands(%0 : !llvm.ptr<f32>) {
+
+ }
+ ```
+ }];
+
+ let arguments = (ins Optional<I1>:$ifCond,
+ Variadic<OpenACC_PointerLikeTypeInterface>:$dataOperands,
+ UnitAttr:$ifPresent);
+
+ let regions = (region AnyRegion:$region);
+
+ let assemblyFormat = [{
+ oilist(
+ `if` `(` $ifCond `)`
+ | `dataOperands` `(` $dataOperands `:` type($dataOperands) `)`
+ )
+ $region attr-dict-with-keyword
+ }];
+
+ let hasVerifier = 1;
+}
+
+//===----------------------------------------------------------------------===//
// 2.9 loop Construct
//===----------------------------------------------------------------------===//