[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
Wed Nov 27 03:01:36 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:
Yes, what you say in that comment is consistent with the fact that the `dependentDialects` property gets translated into an implementation for `getDependentDialects()`. What I'm saying is that, per the docs, this must return those dialects holding operations that can be created by the pass.
My understanding of this is that, if you're reading some other dialect's operation in a pass, it must have been created by something else before, so that dialect is already loaded. If you're creating an operation, its dialect might not have been loaded, so you need to make sure of it.
https://github.com/llvm/llvm-project/pull/115443
More information about the flang-commits
mailing list