[flang-commits] [flang] [flang][OpenMP] Rewrite `omp.loop` to semantically equivalent ops (PR #115443)

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Tue Nov 26 07:48:34 PST 2024


================
@@ -50,9 +50,30 @@ def FunctionFilteringPass : Pass<"omp-function-filtering"> {
   ];
 }
 
+
 // Needs to be scheduled on Module as we create functions in it
 def LowerWorkshare : Pass<"lower-workshare", "::mlir::ModuleOp"> {
   let summary = "Lower workshare construct";
 }
 
+def GenericLoopConversionPass
+    : Pass<"omp-generic-loop-conversion", "mlir::func::FuncOp"> {
+  let summary = "Converts OpenMP generic `loop` directive to semantically "
+                "equivalent OpenMP ops";
+  let description = [{
+     Rewrites `loop` ops to their semantically equivalent nest of ops. The
+     rewrite depends on the nesting/combination structure of the `loop` op
+     within its surrounding context as well as its `bind` clause value.
+
+     We assume for now that all `omp.loop` ops will occur inside `FuncOp`'s. This
+     will most likely remain the case in the future; even if, for example, we 
+     need a loop in copying data for a `firstprivate` variable, this loop will
+     be nested in a constructor, an overloaded operator, or a runtime function.
+  }];
+  let dependentDialects = [
+    "mlir::func::FuncDialect",
----------------
skatrak wrote:

It was my understanding that dependent dialects for a pass are only those containing operations that will be created by the pass (https://mlir.llvm.org/docs/PassManagement/#dependent-dialects). In this pass only 'omp' operations are created, so I'd expect this to not be actually necessary. Or did I get that wrong?

https://github.com/llvm/llvm-project/pull/115443


More information about the flang-commits mailing list