[flang-commits] [mlir] [flang] [acc] Initial implementation of MemoryEffects on `acc` operations (PR #75970)
Razvan Lupusoru via flang-commits
flang-commits at lists.llvm.org
Tue Dec 19 14:06:55 PST 2023
================
@@ -299,50 +308,73 @@ class OpenACC_DataEntryOp<string mnemonic, string clause, string extraDescriptio
// 2.5.13 private clause
//===----------------------------------------------------------------------===//
def OpenACC_PrivateOp : OpenACC_DataEntryOp<"private",
- "mlir::acc::DataClause::acc_private", ""> {
+ "mlir::acc::DataClause::acc_private", "", [],
+ (ins OpenACC_PointerLikeTypeInterface:$varPtr)> {
let summary = "Represents private semantics for acc private clause.";
+ let results = (outs Arg<OpenACC_PointerLikeTypeInterface,
+ "Address of device variable",[MemWrite]>:$accPtr);
}
//===----------------------------------------------------------------------===//
// 2.5.14 firstprivate clause
//===----------------------------------------------------------------------===//
def OpenACC_FirstprivateOp : OpenACC_DataEntryOp<"firstprivate",
- "mlir::acc::DataClause::acc_firstprivate", ""> {
+ "mlir::acc::DataClause::acc_firstprivate", "", [],
+ (ins Arg<OpenACC_PointerLikeTypeInterface,"Address of variable",[MemRead]>:$varPtr)> {
let summary = "Represents firstprivate semantic for the acc firstprivate "
"clause.";
+ let results = (outs Arg<OpenACC_PointerLikeTypeInterface,
+ "Address of device variable",[MemWrite]>:$accPtr);
}
//===----------------------------------------------------------------------===//
// 2.5.15 reduction clause
//===----------------------------------------------------------------------===//
def OpenACC_ReductionOp : OpenACC_DataEntryOp<"reduction",
- "mlir::acc::DataClause::acc_reduction", ""> {
+ "mlir::acc::DataClause::acc_reduction", "",
+ [MemoryEffects<[MemRead<OpenACC_RuntimeCounters>,
----------------
razvanlupusoru wrote:
> Is this really required? I thought the data action is decomposed from the reduction clause as explicit copyin/copyout.
Nice catch - I forgot that this is what was done. I currently modeled it as a `copyin` but instead should be modeled like `firstprivate` instead remembering this.
https://github.com/llvm/llvm-project/pull/75970
More information about the flang-commits
mailing list