[Mlir-commits] [mlir] ae5a70f - [MLIR][OpenMP] Mark openmp.parallel and omp.wsloop as having recursive side effects

William S. Moses llvmlistbot at llvm.org
Thu Mar 3 19:37:29 PST 2022


Author: William S. Moses
Date: 2022-03-03T22:37:24-05:00
New Revision: ae5a70f2c21b96077f3e7f720621bd2eab3d15d5

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

LOG: [MLIR][OpenMP] Mark openmp.parallel and omp.wsloop as having recursive side effects

An OpenMP wsloop is simply a regular for loop with the bounds determined by the thread number, and the same justification to allow this for scf.for works for omp.wsloop.

An OpenMP parallel is a parallel for, per thread. Similarly the same justification for scf.parallel having recursive side effects applies here.

In both cases the general justification is that the ops themselves don't have side effects (besides inaccessible runtime-specific memory) and thus the side effects are simply that of the contained ops.

Reviewed By: bondhugula

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
index 471dcf24667ba..2ab5a3b0e7847 100644
--- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
+++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
@@ -65,7 +65,8 @@ def OpenMP_PointerLikeType : Type<
 
 def ParallelOp : OpenMP_Op<"parallel", [
                  AutomaticAllocationScope, AttrSizedOperandSegments,
-                 DeclareOpInterfaceMethods<OutlineableOpenMPOpInterface>]> {
+                 DeclareOpInterfaceMethods<OutlineableOpenMPOpInterface>,
+                 RecursiveSideEffects]> {
   let summary = "parallel construct";
   let description = [{
     The parallel construct includes a region of code which is to be executed
@@ -210,7 +211,8 @@ def SectionsOp : OpenMP_Op<"sections", [AttrSizedOperandSegments]> {
 //===----------------------------------------------------------------------===//
 
 def WsLoopOp : OpenMP_Op<"wsloop", [AttrSizedOperandSegments,
-                         AllTypesMatch<["lowerBound", "upperBound", "step"]>]> {
+                         AllTypesMatch<["lowerBound", "upperBound", "step"]>,
+                         RecursiveSideEffects]> {
   let summary = "workshare loop construct";
   let description = [{
     The workshare loop construct specifies that the iterations of the loop(s)


        


More information about the Mlir-commits mailing list