[Mlir-commits] [mlir] [OpenMP][Flang] Add "IsolatedFromAbove" trait to omp.target (PR #67164)

Akash Banerjee llvmlistbot at llvm.org
Tue Oct 10 05:17:27 PDT 2023


================
@@ -2433,10 +2502,44 @@ genTargetOp(Fortran::lower::AbstractConverter &converter,
                  Fortran::parser::OmpClause::Defaultmap>(
       currentLocation, llvm::omp::Directive::OMPD_target);
 
-  return genOpWithBody<mlir::omp::TargetOp>(
-      converter, eval, currentLocation, outerCombined, &clauseList,
-      ifClauseOperand, deviceOperand, threadLimitOperand, nowaitAttr,
-      mapOperands);
+  auto captureImplicitMap = [&](const Fortran::semantics::Symbol &sym) {
+    if (llvm::find(mapSymbols, &sym) == mapSymbols.end()) {
+      mlir::Value baseOp = converter.getSymbolAddress(sym);
+      if (!baseOp)
+        if (const auto *details = sym.template detailsIf<
+                                  Fortran::semantics::HostAssocDetails>()) {
+          baseOp = converter.getSymbolAddress(details->symbol());
+          converter.copySymbolBinding(details->symbol(), sym);
+        }
+
----------------
TIFitis wrote:

@kiranchandramohan I am refraining from approach 3 as that puts us back in a messy situation that we were trying to avoid with this patch.

Currently I'm trying to implement approach 1. I was able to extract all the bounds/extents information and add them as block arguments which seems to be working fine for lowering to FIR/HLFIR.

But, we also need to add them as `map_operands` for lowering from MLIR to LLVM later on. The `mapInfoOp` uses a `Pointer_Like_Type` for it's result type and the bounds/extents are `index` type, this is causing incompatibility. I might change the type to AnyType for the mapInfo related ops for now, and later use the verifier to check type compatibility with OpenMP.

Does this approach seem sound to you and others?

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


More information about the Mlir-commits mailing list