[llvm] implicit pointer hop for OpenMP runtime memory mapping table proper deletion https://github.com/ROCm/llvm-project/issues/287 (PR #163878)
Aditya Srichandan via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 16 15:53:51 PDT 2025
https://github.com/adityas-amd updated https://github.com/llvm/llvm-project/pull/163878
>From 61f87bb32bcb0633b16ba3b2014e88a7adc69ba9 Mon Sep 17 00:00:00 2001
From: root <aditya at example.com>
Date: Thu, 16 Oct 2025 22:10:15 +0000
Subject: [PATCH] implicit pointer hop for OpenMP runtime memory mapping table
proper deletion
---
offload/libomptarget/omptarget.cpp | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/offload/libomptarget/omptarget.cpp b/offload/libomptarget/omptarget.cpp
index 39286d41ec865..08a83c193b196 100644
--- a/offload/libomptarget/omptarget.cpp
+++ b/offload/libomptarget/omptarget.cpp
@@ -41,6 +41,15 @@ using llvm::SmallVector;
#ifdef OMPT_SUPPORT
using namespace llvm::omp::target::ompt;
#endif
+static inline bool isImplicitPointerHop(int64_t MapType, int64_t Size) {
+ //Pointer hop entries flagged as PTR and MEMBER_OF
+ const bool IsPointer = (MapType & OMP_TGT_MAPTYPE_PTR) != 0;
+ const bool IsMemberOf = (MapType & OMP_TGT_MAPTYPE_MEMBER_OF) != 0;
+ const bool HasExplicit =
+ (MapType & (OMP_TGT_MAPTYPE_TO | OMP_TGT_MAPTYPE_FROM |
+ OMP_TGT_MAPTYPE_ALWAYS | OMP_TGT_MAPTYPE_DELETE)) != 0;
+ return IsPointer && IsMemberOf && !HasExplicit && Size == 0;
+}
int AsyncInfoTy::synchronize() {
int Result = OFFLOAD_SUCCESS;
@@ -567,6 +576,9 @@ int targetDataBegin(ident_t *Loc, DeviceTy &Device, int32_t ArgNum,
// may be considered a hack, we could revise the scheme in the future.
bool UpdateRef =
!(ArgTypes[I] & OMP_TGT_MAPTYPE_MEMBER_OF) && !(FromMapper && I == 0);
+ if (IsImplicit && isImplicitPointerHop(ArgTypes[I], ArgSizes[I])) {
+ UpdateRef = false;
+ }
MappingInfoTy::HDTTMapAccessorTy HDTTMap =
Device.getMappingInfo().HostDataToTargetMap.getExclusiveAccessor();
More information about the llvm-commits
mailing list