[flang-commits] [flang] [mlir] [Flang][OpenMP] Privatize descriptors for assumed shape array maps for performance increase (PR #212336)

via flang-commits flang-commits at lists.llvm.org
Thu Aug 6 08:42:17 PDT 2026


================
@@ -7424,16 +7437,26 @@ static void processMapWithMembersOf(LLVM::ModuleTranslation &moduleTranslation,
 
   llvm::omp::OpenMPOffloadMappingFlags memberOfFlag =
       ompBuilder.getMemberOfFlag(combinedInfo.Types.size());
-  for (size_t i = 0; i < mapInfoIdx.size(); i++) {
-    // Index == 0 is the parent map and if it gets here it's an unattachable
-    // type and should have OMP_MAP_TARGET_PARAM applied and no MEMBER_OF flag.
-    if (i == 0) {
+
+  // The first index is the parent map, the rest are its members. The parent
+  // normally undergoes the standard parent-with-members mapping, contributing
+  // the MEMBER_OF flag that binds each member to it. The one exception is a
----------------
agozillon wrote:

Not quite, we still emit the child map for the data or it won't end up on device, it's just not set up as bound to the parent, which realistically it never was for pointers as the data isn't a member of the thing they're attached to (I believe this and case and attach maps are caveated from the MEMBER_OF flag in processIndividualMaps)! It's predominantly a way to avoid the extra parent mapping boiler plate of adding an initial all encompassing allocation map followed by a map of the parents actual contents. 

It's something I will need to do a follow up on when looking at the record type case for pointer privatization, verify it's all working sanely. And hopefully then do a subsequent PR for a more general refactoring of this for the third or so time, I don't know if it will ever be simple as there's a lot of edge-cases, but it would be nice to make it as simple and sane as possible at least.

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


More information about the flang-commits mailing list