[llvm-branch-commits] [mlir] [flang][OpenMP] Translate OpenMP scopes when compiling for target device (PR #130078)

Sergio Afonso via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Mar 12 07:24:09 PDT 2025


================
@@ -5315,6 +5320,46 @@ convertTargetOpsInNest(Operation *op, llvm::IRBuilderBase &builder,
               return WalkResult::interrupt();
             return WalkResult::skip();
           }
+
+          // Non-target ops might nest target-related ops, therefore, we
+          // translate them as non-OpenMP scopes. Translating them is needed by
+          // nested target-related ops since they might need LLVM values defined
+          // in their parent non-target ops.
+          if (isa<omp::OpenMPDialect>(oper->getDialect()) &&
+              oper->getParentOfType<LLVM::LLVMFuncOp>() &&
+              !oper->getRegions().empty()) {
----------------
skatrak wrote:

I'm wondering what should happen to OpenMP ops that don't have regions. If they return a value, it seems like that value could end up impacting what's passed into an `omp.map.info` as an argument. Maybe we should map their results to something as well.

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


More information about the llvm-branch-commits mailing list