diff --git a/openmp/libomptarget/src/device.cpp b/openmp/libomptarget/src/device.cpp --- a/openmp/libomptarget/src/device.cpp +++ b/openmp/libomptarget/src/device.cpp @@ -17,6 +17,7 @@ #include #include +#include #include /// Map between Device ID (i.e. openmp device id) and its DeviceTy. @@ -50,7 +51,19 @@ ShadowPtrMap(), DataMapMtx(), PendingGlobalsMtx(), ShadowMtx(), MemoryManager(nullptr) {} -DeviceTy::~DeviceTy() = default; +DeviceTy::~DeviceTy() { + if (DeviceID != -1 && getInfoLevel() > 1) { + fprintf(stderr, "Device %d Destroyed. Final Host-Device Pointer " + "Mapping [LIBOMPTARGET_INFO>1]\n", DeviceID); + fprintf(stderr, "%-18s %-18s %s\n", "Host Ptr", "Target Ptr", "Size (B)"); + for (const auto &HostTargetMap : HostDataToTargetMap) { + fprintf(stderr, DPxMOD " " DPxMOD " %lu\n", + DPxPTR(HostTargetMap.HstPtrBegin), + DPxPTR(HostTargetMap.TgtPtrBegin), + HostTargetMap.HstPtrEnd - HostTargetMap.HstPtrBegin); + } + } +} int DeviceTy::associatePtr(void *HstPtrBegin, void *TgtPtrBegin, int64_t Size) { DataMapMtx.lock(); @@ -214,7 +227,7 @@ HT.incRefCount(); uintptr_t tp = HT.TgtPtrBegin + ((uintptr_t)HstPtrBegin - HT.HstPtrBegin); - DP("Mapping exists%s with HstPtrBegin=" DPxMOD ", TgtPtrBegin=" DPxMOD ", " + INFO(DeviceID, "Mapping exists%s with HstPtrBegin=" DPxMOD ", TgtPtrBegin=" DPxMOD ", " "Size=%" PRId64 ",%s RefCount=%s\n", (IsImplicit ? " (implicit)" : ""), DPxPTR(HstPtrBegin), DPxPTR(tp), Size, (UpdateRefCount ? " updated" : ""), diff --git a/openmp/libomptarget/src/interface.cpp b/openmp/libomptarget/src/interface.cpp --- a/openmp/libomptarget/src/interface.cpp +++ b/openmp/libomptarget/src/interface.cpp @@ -78,7 +78,8 @@ if (getInfoLevel() > 1) dumpTargetPointerMappings(); else - FAILURE_MESSAGE("run with env LIBOMPTARGET_INFO>1 to dump tables\n"); + FAILURE_MESSAGE("run with env LIBOMPTARGET_INFO>1 to dump host-target" + "pointer maps\n"); FATAL_MESSAGE0(1, "failure of target construct while offloading is mandatory"); }