Skip to content

Commit 61f87bb

Browse files
author
root
committed
implicit pointer hop for OpenMP runtime memory mapping table proper deletion
1 parent 098767c commit 61f87bb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

offload/libomptarget/omptarget.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ using llvm::SmallVector;
4141
#ifdef OMPT_SUPPORT
4242
using namespace llvm::omp::target::ompt;
4343
#endif
44+
static inline bool isImplicitPointerHop(int64_t MapType, int64_t Size) {
45+
//Pointer hop entries flagged as PTR and MEMBER_OF
46+
const bool IsPointer = (MapType & OMP_TGT_MAPTYPE_PTR) != 0;
47+
const bool IsMemberOf = (MapType & OMP_TGT_MAPTYPE_MEMBER_OF) != 0;
48+
const bool HasExplicit =
49+
(MapType & (OMP_TGT_MAPTYPE_TO | OMP_TGT_MAPTYPE_FROM |
50+
OMP_TGT_MAPTYPE_ALWAYS | OMP_TGT_MAPTYPE_DELETE)) != 0;
51+
return IsPointer && IsMemberOf && !HasExplicit && Size == 0;
52+
}
4453

4554
int AsyncInfoTy::synchronize() {
4655
int Result = OFFLOAD_SUCCESS;
@@ -567,6 +576,9 @@ int targetDataBegin(ident_t *Loc, DeviceTy &Device, int32_t ArgNum,
567576
// may be considered a hack, we could revise the scheme in the future.
568577
bool UpdateRef =
569578
!(ArgTypes[I] & OMP_TGT_MAPTYPE_MEMBER_OF) && !(FromMapper && I == 0);
579+
if (IsImplicit && isImplicitPointerHop(ArgTypes[I], ArgSizes[I])) {
580+
UpdateRef = false;
581+
}
570582

571583
MappingInfoTy::HDTTMapAccessorTy HDTTMap =
572584
Device.getMappingInfo().HostDataToTargetMap.getExclusiveAccessor();

0 commit comments

Comments
 (0)