diff --git a/openmp/libomptarget/include/Debug.h b/openmp/libomptarget/include/Debug.h --- a/openmp/libomptarget/include/Debug.h +++ b/openmp/libomptarget/include/Debug.h @@ -161,11 +161,11 @@ #endif // OMPTARGET_DEBUG /// Emit a message giving the user extra information about the runtime if -#define INFO(_id, ...) \ +#define INFO(_flags, _id, ...) \ do { \ if (getDebugLevel() > 0) { \ DEBUGP(DEBUG_PREFIX, __VA_ARGS__); \ - } else if (getInfoLevel() > 0) { \ + } else if (getInfoLevel() & _flags) { \ INFO_MESSAGE(_id, __VA_ARGS__); \ } \ } while (false) diff --git a/openmp/libomptarget/plugins/cuda/src/rtl.cpp b/openmp/libomptarget/plugins/cuda/src/rtl.cpp --- a/openmp/libomptarget/plugins/cuda/src/rtl.cpp +++ b/openmp/libomptarget/plugins/cuda/src/rtl.cpp @@ -580,7 +580,7 @@ DeviceData[DeviceId].BlocksPerGrid = EnvTeamLimit; } - INFO(DeviceId, + INFO(OMP_INFOTYPE_PLUGIN_KERNEL, DeviceId, "Device supports up to %d CUDA blocks and %d threads with a " "warp size of %d\n", DeviceData[DeviceId].BlocksPerGrid, @@ -1004,7 +1004,7 @@ CudaBlocksPerGrid = TeamNum; } - INFO(DeviceId, + INFO(OMP_INFOTYPE_PLUGIN_KERNEL, DeviceId, "Launching kernel %s with %d blocks and %d threads in %s " "mode\n", (getOffloadEntry(DeviceId, TgtEntryPtr)) 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 @@ -216,16 +216,14 @@ HT.incRefCount(); uintptr_t tp = HT.TgtPtrBegin + ((uintptr_t)HstPtrBegin - HT.HstPtrBegin); - if (getDebugLevel() || getInfoLevel() & OMP_INFOTYPE_MAPPING_EXISTS) - INFO(DeviceID, - "Mapping exists%s with HstPtrBegin=" DPxMOD ", TgtPtrBegin=" DPxMOD - ", " - "Size=%" PRId64 ",%s RefCount=%s, Name=%s\n", - (IsImplicit ? " (implicit)" : ""), DPxPTR(HstPtrBegin), DPxPTR(tp), - Size, (UpdateRefCount ? " updated" : ""), - HT.isRefCountInf() ? "INF" - : std::to_string(HT.getRefCount()).c_str(), - (HstPtrName) ? getNameFromMapping(HstPtrName).c_str() : "unknown"); + INFO(OMP_INFOTYPE_MAPPING_EXISTS, DeviceID, + "Mapping exists%s with HstPtrBegin=" DPxMOD ", TgtPtrBegin=" DPxMOD + ", " + "Size=%" PRId64 ",%s RefCount=%s, Name=%s\n", + (IsImplicit ? " (implicit)" : ""), DPxPTR(HstPtrBegin), DPxPTR(tp), + Size, (UpdateRefCount ? " updated" : ""), + HT.isRefCountInf() ? "INF" : std::to_string(HT.getRefCount()).c_str(), + (HstPtrName) ? getNameFromMapping(HstPtrName).c_str() : "unknown"); rc = (void *)tp; } else if ((lr.Flags.ExtendsBefore || lr.Flags.ExtendsAfter) && !IsImplicit) { // Explicit extension of mapped data - not allowed. diff --git a/openmp/libomptarget/src/private.h b/openmp/libomptarget/src/private.h --- a/openmp/libomptarget/src/private.h +++ b/openmp/libomptarget/src/private.h @@ -101,14 +101,14 @@ return; SourceInfo Kernel(Loc); - INFO(Device.DeviceID, + INFO(-1, Device.DeviceID, "OpenMP Host-Device pointer mappings after block at %s:%d:%d:\n", Kernel.getFilename(), Kernel.getLine(), Kernel.getColumn()); - INFO(Device.DeviceID, "%-18s %-18s %s %s %s\n", "Host Ptr", "Target Ptr", + INFO(-1, Device.DeviceID, "%-18s %-18s %s %s %s\n", "Host Ptr", "Target Ptr", "Size (B)", "RefCount", "Declaration"); for (const auto &HostTargetMap : Device.HostDataToTargetMap) { SourceInfo Info(HostTargetMap.HstPtrName); - INFO(Device.DeviceID, DPxMOD " " DPxMOD " %-8lu %-8ld %s at %s:%d:%d\n", + INFO(-1, Device.DeviceID, DPxMOD " " DPxMOD " %-8lu %-8ld %s at %s:%d:%d\n", DPxPTR(HostTargetMap.HstPtrBegin), DPxPTR(HostTargetMap.TgtPtrBegin), (long unsigned)(HostTargetMap.HstPtrEnd - HostTargetMap.HstPtrBegin), HostTargetMap.getRefCount(), Info.getName(), Info.getFilename(), @@ -124,7 +124,7 @@ const int64_t *ArgTypes, const map_var_info_t *ArgNames, const char *RegionType) { SourceInfo info(Loc); - INFO(DeviceId, "%s at %s:%d:%d with %d arguments:\n", RegionType, + INFO(-1, DeviceId, "%s at %s:%d:%d with %d arguments:\n", RegionType, info.getFilename(), info.getLine(), info.getColumn(), ArgNum); for (int32_t i = 0; i < ArgNum; ++i) { @@ -142,12 +142,12 @@ type = "private"; else if (ArgTypes[i] & OMP_TGT_MAPTYPE_LITERAL) type = "firstprivate"; - else if (ArgTypes[i] & OMP_TGT_MAPTYPE_TARGET_PARAM && ArgSizes[i] != 0) + else if (ArgSizes[i] != 0) type = "alloc"; else type = "use_address"; - INFO(DeviceId, "%s(%s)[%ld] %s\n", type, + INFO(-1, DeviceId, "%s(%s)[%ld] %s\n", type, getNameFromMapping(varName).c_str(), ArgSizes[i], implicit); } }