[Mlir-commits] [mlir] 2e2bcee - [mlir][openacc] Add attributes to parallel op async, wait and self clauses

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Sep 21 08:25:43 PDT 2020


Author: Valentin Clement
Date: 2020-09-21T11:25:36-04:00
New Revision: 2e2bcee05876305cb9b21b6b5e8e48dc6da58ede

URL: https://github.com/llvm/llvm-project/commit/2e2bcee05876305cb9b21b6b5e8e48dc6da58ede
DIFF: https://github.com/llvm/llvm-project/commit/2e2bcee05876305cb9b21b6b5e8e48dc6da58ede.diff

LOG: [mlir][openacc] Add attributes to parallel op async, wait and self clauses

Add attributes for the async, wait and self clauses. These clauses can be present without
values. When this is the case they are modelled with an attribute instead of operands.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D87991

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
    mlir/test/Dialect/OpenACC/ops.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
index f0bf71ca6102..7f1f5ac715ee 100644
--- a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
+++ b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
@@ -94,12 +94,15 @@ def OpenACC_ParallelOp : OpenACC_Op<"parallel",
   }];
 
   let arguments = (ins Optional<IntOrIndex>:$async,
+                       UnitAttr:$asyncAttr,
                        Variadic<IntOrIndex>:$waitOperands,
+                       UnitAttr:$waitAttr,
                        Optional<IntOrIndex>:$numGangs,
                        Optional<IntOrIndex>:$numWorkers,
                        Optional<IntOrIndex>:$vectorLength,
                        Optional<I1>:$ifCond,
                        Optional<I1>:$selfCond,
+                       UnitAttr:$selfAttr,
                        OptionalAttr<OpenACC_ReductionOpAttr>:$reductionOp,
                        Variadic<AnyType>:$reductionOperands,
                        Variadic<AnyType>:$copyOperands,
@@ -121,12 +124,15 @@ def OpenACC_ParallelOp : OpenACC_Op<"parallel",
 
   let extraClassDeclaration = [{
     static StringRef getAsyncKeyword() { return "async"; }
+    static StringRef getAsyncAttrName() { return "asyncAttr"; }
     static StringRef getWaitKeyword() { return "wait"; }
+    static StringRef getWaitAttrName() { return "waitAttr"; }
     static StringRef getNumGangsKeyword() { return "num_gangs"; }
     static StringRef getNumWorkersKeyword() { return "num_workers"; }
     static StringRef getVectorLengthKeyword() { return "vector_length"; }
     static StringRef getIfKeyword() { return "if"; }
     static StringRef getSelfKeyword() { return "self"; }
+    static StringRef getSelfAttrName() { return "selfAttr"; }
     static StringRef getReductionKeyword() { return "reduction"; }
     static StringRef getCopyKeyword() { return "copy"; }
     static StringRef getCopyinKeyword() { return "copyin"; }
@@ -310,4 +316,3 @@ def OpenACC_YieldOp : OpenACC_Op<"yield", [Terminator,
 }
 
 #endif // OPENACC_OPS
-

diff  --git a/mlir/test/Dialect/OpenACC/ops.mlir b/mlir/test/Dialect/OpenACC/ops.mlir
index 48ca1a6d2af4..337160974daf 100644
--- a/mlir/test/Dialect/OpenACC/ops.mlir
+++ b/mlir/test/Dialect/OpenACC/ops.mlir
@@ -379,6 +379,12 @@ func @testparallelop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x10xf3
   } attributes {defaultAttr = "none"}
   acc.parallel {
   } attributes {defaultAttr = "present"}
+  acc.parallel {
+  } attributes {asyncAttr}
+  acc.parallel {
+  } attributes {waitAttr}
+  acc.parallel {
+  } attributes {selfAttr}
   return
 }
 
@@ -438,6 +444,12 @@ func @testparallelop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x10xf3
 // CHECK-NEXT: } attributes {defaultAttr = "none"}
 // CHECK:      acc.parallel {
 // CHECK-NEXT: } attributes {defaultAttr = "present"}
+// CHECK:      acc.parallel {
+// CHECK-NEXT: } attributes {asyncAttr}
+// CHECK:      acc.parallel {
+// CHECK-NEXT: } attributes {waitAttr}
+// CHECK:      acc.parallel {
+// CHECK-NEXT: } attributes {selfAttr}
 
 // -----
 


        


More information about the Mlir-commits mailing list