[flang-commits] [flang] [llvm] [mlir] [mlir][OpenMP] - MLIR to LLVMIR translation support for delayed privatization of allocatables in `omp.target` ops (PR #116576)

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Fri Dec 6 05:52:36 PST 2024


================
@@ -3824,6 +3857,19 @@ convertOmpTarget(Operation &opInst, llvm::IRBuilderBase &builder,
   bool isTargetDevice = ompBuilder->Config.isTargetDevice();
   auto parentFn = opInst.getParentOfType<LLVM::LLVMFuncOp>();
   auto &targetRegion = targetOp.getRegion();
+  // Holds the private vars that have been mapped along with
+  // the block argument that corresponds to the MapInfoOp
+  // corresponding to the private var in question.
+  // So, for instance
+  //
+  // %10 = omp.map.info var_ptr(%6#0 : !fir.ref<!fir.box<!fir.heap<i32>>>, ..)
+  // omp.target map_entries(%10 -> %arg0) private(@box.privatizer %6#0-> %arg1)
+  //
+  // Then, %10 has been created so that the descriptor can be used by the
+  // privatizer
+  // @box.privatizer on the device side. Here we'd record {%6#0, 0} in the
+  // mappedPrivateVars map.
+  llvm::DenseMap<Value, int> mappedPrivateVars;
----------------
skatrak wrote:

Is it possible to make the mapping between values rather than index? According to the example above: `{%6#0, %arg0}`, `{%6#0, %10}` or `{%6#0, (%10, %arg0)}` depending on what's needed. I'm suggesting this because it would be very easy for this to break as soon as some new entry block argument is added between the time this map is created and used.

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


More information about the flang-commits mailing list