| //===-- OpenMP/Mapping.cpp - OpenMP/OpenACC pointer mapping impl. ---------===// |
| // |
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| // See https://llvm.org/LICENSE.txt for license information. |
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| // |
| //===----------------------------------------------------------------------===// |
| // |
| //===----------------------------------------------------------------------===// |
| |
| #include "OpenMP/Mapping.h" |
| |
| #include "Shared/Debug.h" |
| #include "device.h" |
| |
| /// Dump a table of all the host-target pointer pairs on failure |
| void dumpTargetPointerMappings(const ident_t *Loc, DeviceTy &Device) { |
| DeviceTy::HDTTMapAccessorTy HDTTMap = |
| Device.HostDataToTargetMap.getExclusiveAccessor(); |
| if (HDTTMap->empty()) |
| return; |
| |
| SourceInfo Kernel(Loc); |
| INFO(OMP_INFOTYPE_ALL, Device.DeviceID, |
| "OpenMP Host-Device pointer mappings after block at %s:%d:%d:\n", |
| Kernel.getFilename(), Kernel.getLine(), Kernel.getColumn()); |
| INFO(OMP_INFOTYPE_ALL, Device.DeviceID, "%-18s %-18s %s %s %s %s\n", |
| "Host Ptr", "Target Ptr", "Size (B)", "DynRefCount", "HoldRefCount", |
| "Declaration"); |
| for (const auto &It : *HDTTMap) { |
| HostDataToTargetTy &HDTT = *It.HDTT; |
| SourceInfo Info(HDTT.HstPtrName); |
| INFO(OMP_INFOTYPE_ALL, Device.DeviceID, |
| DPxMOD " " DPxMOD " %-8" PRIuPTR " %-11s %-12s %s at %s:%d:%d\n", |
| DPxPTR(HDTT.HstPtrBegin), DPxPTR(HDTT.TgtPtrBegin), |
| HDTT.HstPtrEnd - HDTT.HstPtrBegin, HDTT.dynRefCountToStr().c_str(), |
| HDTT.holdRefCountToStr().c_str(), Info.getName(), Info.getFilename(), |
| Info.getLine(), Info.getColumn()); |
| } |
| } |