Skip to content

Conversation

@hansangbae
Copy link
Contributor

Update debug messages based on the new method from #170425. Added a new debug type Tool and updated the following files.

  • include/OffloadPolicy.h
  • include/OpenMP/OMPT/Connector.h
  • include/Shared/Debug.h
  • include/Shared/EnvironmentVar.h
  • libomptarget/OpenMP/Mapping.cpp
  • libomptarget/OpenMP/OMPT/Callback.cpp
  • libomptarget/PluginManager.cpp

Update debug messages based on the new method from #170425.
Added a new debug type `Tool` and updated the following files.
- include/OffloadPolicy.h
- include/OpenMP/OMPT/Connector.h
- include/Shared/Debug.h
- include/Shared/EnvironmentVar.h
- libomptarget/OpenMP/Mapping.cpp
- libomptarget/OpenMP/OMPT/Callback.cpp
- libomptarget/PluginManager.cpp
@hansangbae hansangbae marked this pull request as ready for review December 10, 2025 21:03
@llvmbot
Copy link
Member

llvmbot commented Dec 10, 2025

@llvm/pr-subscribers-offload

Author: Hansang Bae (hansangbae)

Changes

Update debug messages based on the new method from #170425. Added a new debug type Tool and updated the following files.

  • include/OffloadPolicy.h
  • include/OpenMP/OMPT/Connector.h
  • include/Shared/Debug.h
  • include/Shared/EnvironmentVar.h
  • libomptarget/OpenMP/Mapping.cpp
  • libomptarget/OpenMP/OMPT/Callback.cpp
  • libomptarget/PluginManager.cpp

Patch is 28.91 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/171683.diff

7 Files Affected:

  • (modified) offload/include/OffloadPolicy.h (+6-4)
  • (modified) offload/include/OpenMP/OMPT/Connector.h (+7-4)
  • (modified) offload/include/Shared/Debug.h (+1)
  • (modified) offload/include/Shared/EnvironmentVar.h (+8-4)
  • (modified) offload/libomptarget/OpenMP/Mapping.cpp (+44-43)
  • (modified) offload/libomptarget/OpenMP/OMPT/Callback.cpp (+11-8)
  • (modified) offload/libomptarget/PluginManager.cpp (+51-46)
diff --git a/offload/include/OffloadPolicy.h b/offload/include/OffloadPolicy.h
index 9bbd1fffb3798..9354e45b61af7 100644
--- a/offload/include/OffloadPolicy.h
+++ b/offload/include/OffloadPolicy.h
@@ -16,6 +16,8 @@
 
 #include "PluginManager.h"
 
+using namespace llvm::omp::target::debug;
+
 enum kmp_target_offload_kind_t {
   tgt_disabled = 0,
   tgt_default = 1,
@@ -35,12 +37,12 @@ class OffloadPolicy {
       return;
     default:
       if (PM.getNumDevices()) {
-        DP("Default TARGET OFFLOAD policy is now mandatory "
-           "(devices were found)\n");
+        ODBG(ODT_Init) << "Default TARGET OFFLOAD policy is now mandatory "
+                       << "(devices were found)";
         Kind = MANDATORY;
       } else {
-        DP("Default TARGET OFFLOAD policy is now disabled "
-           "(no devices were found)\n");
+        ODBG(ODT_Init) << "Default TARGET OFFLOAD policy is now disabled "
+                       << "(no devices were found)";
         Kind = DISABLED;
       }
       return;
diff --git a/offload/include/OpenMP/OMPT/Connector.h b/offload/include/OpenMP/OMPT/Connector.h
index c7b37740d5642..add8941cc4905 100644
--- a/offload/include/OpenMP/OMPT/Connector.h
+++ b/offload/include/OpenMP/OMPT/Connector.h
@@ -27,6 +27,8 @@
 
 #include "Shared/Debug.h"
 
+using namespace llvm::omp::target::debug;
+
 #pragma push_macro("DEBUG_PREFIX")
 #undef DEBUG_PREFIX
 #define DEBUG_PREFIX "OMPT"
@@ -76,7 +78,7 @@ class OmptLibraryConnectorTy {
     std::string LibName = LibIdent;
     LibName += ".so";
 
-    DP("OMPT: Trying to load library %s\n", LibName.c_str());
+    ODBG(ODT_Tool) << "OMPT: Trying to load library " << LibName;
     auto DynLibHandle = std::make_unique<llvm::sys::DynamicLibrary>(
         llvm::sys::DynamicLibrary::getPermanentLibrary(LibName.c_str(),
                                                        &ErrMsg));
@@ -85,12 +87,13 @@ class OmptLibraryConnectorTy {
       LibConnHandle = nullptr;
     } else {
       auto LibConnRtn = "ompt_" + LibIdent + "_connect";
-      DP("OMPT: Trying to get address of connection routine %s\n",
-         LibConnRtn.c_str());
+      ODBG(ODT_Tool) << "OMPT: Trying to get address of connection routine "
+                     << LibConnRtn;
       LibConnHandle = reinterpret_cast<OmptConnectRtnTy>(
           DynLibHandle->getAddressOfSymbol(LibConnRtn.c_str()));
     }
-    DP("OMPT: Library connection handle = %p\n", LibConnHandle);
+    ODBG(ODT_Tool) << "OMPT: Library connection handle = "
+                   << reinterpret_cast<void *>(LibConnHandle);
     IsInitialized = true;
   }
 
diff --git a/offload/include/Shared/Debug.h b/offload/include/Shared/Debug.h
index d5cf719f1ebf3..3a1a00e83a654 100644
--- a/offload/include/Shared/Debug.h
+++ b/offload/include/Shared/Debug.h
@@ -529,6 +529,7 @@ constexpr const char *ODT_EmptyMapping = "EmptyMapping";
 constexpr const char *ODT_Device = "Device";
 constexpr const char *ODT_Interface = "Interface";
 constexpr const char *ODT_Alloc = "Alloc";
+constexpr const char *ODT_Tool = "Tool";
 
 static inline odbg_ostream reportErrorStream() {
 #ifdef OMPTARGET_DEBUG
diff --git a/offload/include/Shared/EnvironmentVar.h b/offload/include/Shared/EnvironmentVar.h
index 82f434e91a85b..5acafa3b175bb 100644
--- a/offload/include/Shared/EnvironmentVar.h
+++ b/offload/include/Shared/EnvironmentVar.h
@@ -19,6 +19,8 @@
 #include <sstream>
 #include <string>
 
+using namespace llvm::omp::target::debug;
+
 /// Utility class for parsing strings to other types.
 struct StringParser {
   /// Parse a string to another type.
@@ -61,7 +63,8 @@ template <typename Ty> class Envar {
       IsPresent = StringParser::parse<Ty>(EnvStr, Data);
 
       if (!IsPresent) {
-        DP("Ignoring invalid value %s for envar %s\n", EnvStr, Name.data());
+        ODBG(ODT_Init) << "Ignoring invalid value " << EnvStr << " for envar "
+                       << Name;
         Data = Default;
       }
     }
@@ -180,12 +183,13 @@ inline llvm::Error Envar<Ty>::init(llvm::StringRef Name, GetterFunctor Getter,
         // not present and reset to the getter value (default).
         IsPresent = false;
         Data = Default;
-        DP("Setter of envar %s failed, resetting to %s\n", Name.data(),
-           std::to_string(Data).data());
+        ODBG(ODT_Init) << "Setter of envar " << Name << " failed, resetting to "
+                       << std::to_string(Data);
         consumeError(std::move(Err));
       }
     } else {
-      DP("Ignoring invalid value %s for envar %s\n", EnvStr, Name.data());
+      ODBG(ODT_Init) << "Ignoring invalid value " << EnvStr << " for envar "
+                     << Name;
       Data = Default;
     }
   } else {
diff --git a/offload/libomptarget/OpenMP/Mapping.cpp b/offload/libomptarget/OpenMP/Mapping.cpp
index 9b3533895f2a6..1ded326f2f6fb 100644
--- a/offload/libomptarget/OpenMP/Mapping.cpp
+++ b/offload/libomptarget/OpenMP/Mapping.cpp
@@ -15,6 +15,8 @@
 #include "Shared/Requirements.h"
 #include "device.h"
 
+using namespace llvm::omp::target::debug;
+
 /// Dump a table of all the host-target pointer pairs on failure
 void dumpTargetPointerMappings(const ident_t *Loc, DeviceTy &Device,
                                bool toStdOut) {
@@ -59,12 +61,13 @@ int MappingInfoTy::associatePtr(void *HstPtrBegin, void *TgtPtrBegin,
     bool IsValid = HDTT.HstPtrEnd == (uintptr_t)HstPtrBegin + Size &&
                    HDTT.TgtPtrBegin == (uintptr_t)TgtPtrBegin;
     if (IsValid) {
-      DP("Attempt to re-associate the same device ptr+offset with the same "
-         "host ptr, nothing to do\n");
+      ODBG(ODT_MappingExists) << "Attempt to re-associate the same device "
+                              << "ptr+offset with the same "
+                              << "host ptr, nothing to do";
       return OFFLOAD_SUCCESS;
     }
-    REPORT("Not allowed to re-associate a different device ptr+offset with "
-           "the same host ptr\n");
+    REPORT() << "Not allowed to re-associate a different device ptr+offset "
+             << "with the same host ptr";
     return OFFLOAD_FAIL;
   }
 
@@ -80,12 +83,12 @@ int MappingInfoTy::associatePtr(void *HstPtrBegin, void *TgtPtrBegin,
                /*UseHoldRefCount=*/false, /*Name=*/nullptr,
                /*IsRefCountINF=*/true))
            .first->HDTT;
-  DP("Creating new map entry: HstBase=" DPxMOD ", HstBegin=" DPxMOD
-     ", HstEnd=" DPxMOD ", TgtBegin=" DPxMOD ", DynRefCount=%s, "
-     "HoldRefCount=%s\n",
-     DPxPTR(NewEntry.HstPtrBase), DPxPTR(NewEntry.HstPtrBegin),
-     DPxPTR(NewEntry.HstPtrEnd), DPxPTR(NewEntry.TgtPtrBegin),
-     NewEntry.dynRefCountToStr().c_str(), NewEntry.holdRefCountToStr().c_str());
+  ODBG(ODT_Mapping) << "Creating new map entry: HstBase=" << NewEntry.HstPtrBase
+                    << ", HstBegin=" << NewEntry.HstPtrBegin
+                    << ", HstEnd=" << NewEntry.HstPtrEnd
+                    << ", TgtBegin=" << NewEntry.TgtPtrBegin
+                    << ", DynRefCount=" << NewEntry.dynRefCountToStr()
+                    << ", HoldRefCount=" << NewEntry.holdRefCountToStr();
   (void)NewEntry;
 
   // Notify the plugin about the new mapping.
@@ -97,7 +100,7 @@ int MappingInfoTy::disassociatePtr(void *HstPtrBegin) {
 
   auto It = HDTTMap->find(HstPtrBegin);
   if (It == HDTTMap->end()) {
-    REPORT("Association not found\n");
+    REPORT() << "Association not found";
     return OFFLOAD_FAIL;
   }
   // Mapping exists
@@ -108,13 +111,13 @@ int MappingInfoTy::disassociatePtr(void *HstPtrBegin) {
     // This is based on OpenACC 3.1, sec 3.2.33 "acc_unmap_data", L3656-3657:
     // "It is an error to call acc_unmap_data if the structured reference
     // count for the pointer is not zero."
-    REPORT("Trying to disassociate a pointer with a non-zero hold reference "
-           "count\n");
+    REPORT() << "Trying to disassociate a pointer with a non-zero "
+             << "hold reference count";
     return OFFLOAD_FAIL;
   }
 
   if (HDTT.isDynRefCountInf()) {
-    DP("Association found, removing it\n");
+    ODBG(ODT_Mapping) << "Association found, removing it";
     void *Event = HDTT.getEvent();
     delete &HDTT;
     if (Event)
@@ -123,8 +126,8 @@ int MappingInfoTy::disassociatePtr(void *HstPtrBegin) {
     return Device.notifyDataUnmapped(HstPtrBegin);
   }
 
-  REPORT("Trying to disassociate a pointer which was not mapped via "
-         "omp_target_associate_ptr\n");
+  REPORT() << "Trying to disassociate a pointer which was not mapped via "
+           << "omp_target_associate_ptr";
   return OFFLOAD_FAIL;
 }
 
@@ -135,8 +138,8 @@ LookupResult MappingInfoTy::lookupMapping(HDTTMapAccessorTy &HDTTMap,
   uintptr_t HP = (uintptr_t)HstPtrBegin;
   LookupResult LR;
 
-  DP("Looking up mapping(HstPtrBegin=" DPxMOD ", Size=%" PRId64 ")...\n",
-     DPxPTR(HP), Size);
+  ODBG(ODT_Mapping) << "Looking up mapping(HstPtrBegin=" << HP
+                    << ", Size=" << Size << ")...";
 
   if (HDTTMap->empty())
     return LR;
@@ -185,12 +188,12 @@ LookupResult MappingInfoTy::lookupMapping(HDTTMapAccessorTy &HDTTMap,
     }
 
     if (LR.Flags.ExtendsBefore) {
-      DP("WARNING: Pointer is not mapped but section extends into already "
-         "mapped data\n");
+      ODBG(ODT_Mapping) << "WARNING: Pointer is not mapped but section extends "
+                        << "into already mapped data";
     }
     if (LR.Flags.ExtendsAfter) {
-      DP("WARNING: Pointer is already mapped but section extends beyond mapped "
-         "region\n");
+      ODBG(ODT_Mapping) << "WARNING: Pointer is already mapped but section "
+                        << "extends beyond mapped region";
     }
   }
 
@@ -269,17 +272,16 @@ TargetPointerResultTy MappingInfoTy::getTargetPointer(
            "Return HstPtrBegin " DPxMOD " Size=%" PRId64 " for unified shared "
            "memory\n",
            DPxPTR((uintptr_t)HstPtrBegin), Size);
-      DP("Return HstPtrBegin " DPxMOD " Size=%" PRId64 " for unified shared "
-         "memory\n",
-         DPxPTR((uintptr_t)HstPtrBegin), Size);
+      ODBG(ODT_Mapping) << "Return HstPtrBegin " << HstPtrBegin
+                        << " Size=" << Size << " for unified shared memory";
       LR.TPR.Flags.IsPresent = false;
       LR.TPR.Flags.IsHostPointer = true;
       LR.TPR.TargetPointer = HstPtrBegin;
     }
   } else if (HasPresentModifier) {
-    DP("Mapping required by 'present' map type modifier does not exist for "
-       "HstPtrBegin=" DPxMOD ", Size=%" PRId64 "\n",
-       DPxPTR(HstPtrBegin), Size);
+    ODBG(ODT_Mapping) << "Mapping required by 'present' map type modifier does "
+                      << "not exist for HstPtrBegin=" << HstPtrBegin
+                      << ", Size=" << Size;
     MESSAGE("device mapping required by 'present' map type modifier does not "
             "exist for host address " DPxMOD " (%" PRId64 " bytes)",
             DPxPTR(HstPtrBegin), Size);
@@ -342,19 +344,19 @@ TargetPointerResultTy MappingInfoTy::getTargetPointer(
     };
     if (LR.TPR.getEntry()->foreachShadowPointerInfo(FailOnPtrFound) ==
         OFFLOAD_FAIL) {
-      DP("Multiple new mappings of %" PRId64 " bytes detected (hst:" DPxMOD
-         ") -> (tgt:" DPxMOD ")\n",
-         Size, DPxPTR(HstPtrBegin), DPxPTR(LR.TPR.TargetPointer));
+      ODBG(ODT_Mapping) << "Multiple new mappings of " << Size
+                        << " bytes detected (hst:" << HstPtrBegin
+                        << ") -> (tgt:" << LR.TPR.TargetPointer;
       return std::move(LR.TPR);
     }
 
-    DP("Moving %" PRId64 " bytes (hst:" DPxMOD ") -> (tgt:" DPxMOD ")\n", Size,
-       DPxPTR(HstPtrBegin), DPxPTR(LR.TPR.TargetPointer));
+    ODBG(ODT_Mapping) << "Moving " << Size << " bytes (hst:" << HstPtrBegin
+                      << ") -> (tgt:" << LR.TPR.TargetPointer;
 
     int Ret = Device.submitData(LR.TPR.TargetPointer, HstPtrBegin, Size,
                                 AsyncInfo, LR.TPR.getEntry());
     if (Ret != OFFLOAD_SUCCESS) {
-      REPORT("Copying data to device failed.\n");
+      REPORT() << "Copying data to device failed.";
       // We will also return nullptr if the data movement fails because that
       // pointer points to a corrupted memory region so it doesn't make any
       // sense to continue to use it.
@@ -374,7 +376,7 @@ TargetPointerResultTy MappingInfoTy::getTargetPointer(
         if (Ret != OFFLOAD_SUCCESS) {
           // If it fails to wait for the event, we need to return nullptr in
           // case of any data race.
-          REPORT("Failed to wait for event " DPxMOD ".\n", DPxPTR(Event));
+          REPORT() << "Failed to wait for event " << Event;
           return TargetPointerResultTy{};
         }
       }
@@ -444,9 +446,8 @@ TargetPointerResultTy MappingInfoTy::getTgtPtrBegin(
     // If the value isn't found in the mapping and unified shared memory
     // is on then it means we have stumbled upon a value which we need to
     // use directly from the host.
-    DP("Get HstPtrBegin " DPxMOD " Size=%" PRId64 " for unified shared "
-       "memory\n",
-       DPxPTR((uintptr_t)HstPtrBegin), Size);
+    ODBG(ODT_Mapping) << "Get HstPtrBegin " << HstPtrBegin << " Size=" << Size
+                      << " for unified shared memory";
     LR.TPR.Flags.IsPresent = false;
     LR.TPR.Flags.IsHostPointer = true;
     LR.TPR.TargetPointer = HstPtrBegin;
@@ -490,7 +491,7 @@ int MappingInfoTy::eraseMapEntry(HDTTMapAccessorTy &HDTTMap,
                            : "unknown");
 
   if (HDTTMap->erase(Entry) == 0) {
-    REPORT("Trying to remove a non-existent map entry\n");
+    REPORT() << "Trying to remove a non-existent map entry";
     return OFFLOAD_FAIL;
   }
 
@@ -501,13 +502,13 @@ int MappingInfoTy::deallocTgtPtrAndEntry(HostDataToTargetTy *Entry,
                                          int64_t Size) {
   assert(Entry && "Trying to deallocate a null entry.");
 
-  DP("Deleting tgt data " DPxMOD " of size %" PRId64 " by freeing allocation "
-     "starting at " DPxMOD "\n",
-     DPxPTR(Entry->TgtPtrBegin), Size, DPxPTR(Entry->TgtAllocBegin));
+  ODBG(ODT_Mapping) << "Deleting tgt data " << Entry->TgtPtrBegin << " of size "
+                    << Size << " by freeing allocation "
+                    << "starting at " << Entry->TgtAllocBegin;
 
   void *Event = Entry->getEvent();
   if (Event && Device.destroyEvent(Event) != OFFLOAD_SUCCESS) {
-    REPORT("Failed to destroy event " DPxMOD "\n", DPxPTR(Event));
+    REPORT() << "Failed to destroy event " << Event;
     return OFFLOAD_FAIL;
   }
 
diff --git a/offload/libomptarget/OpenMP/OMPT/Callback.cpp b/offload/libomptarget/OpenMP/OMPT/Callback.cpp
index ab0942ed4fd3f..99c8a122c81f4 100644
--- a/offload/libomptarget/OpenMP/OMPT/Callback.cpp
+++ b/offload/libomptarget/OpenMP/OMPT/Callback.cpp
@@ -35,6 +35,7 @@ FOREACH_OMPT_EMI_EVENT(defineOmptCallback)
 #undef defineOmptCallback
 
 using namespace llvm::omp::target::ompt;
+using namespace llvm::omp::target::debug;
 
 /// Forward declaration
 class LibomptargetRtlFinalizer;
@@ -410,11 +411,13 @@ void Interface::endTarget(int64_t DeviceId, void *Code) {
 }
 
 void Interface::beginTargetDataOperation() {
-  DP("in ompt_target_region_begin (TargetRegionId = %lu)\n", TargetData.value);
+  ODBG(ODT_Tool) << "in ompt_target_region_begin (TargetRegionId = "
+                 << TargetData.value << ")";
 }
 
 void Interface::endTargetDataOperation() {
-  DP("in ompt_target_region_end (TargetRegionId = %lu)\n", TargetData.value);
+  ODBG(ODT_Tool) << "in ompt_target_region_end (TargetRegionId = "
+                 << TargetData.value << ")";
 }
 
 void Interface::beginTargetRegion() {
@@ -462,12 +465,12 @@ class LibomptargetRtlFinalizer {
 int llvm::omp::target::ompt::initializeLibrary(ompt_function_lookup_t lookup,
                                                int initial_device_num,
                                                ompt_data_t *tool_data) {
-  DP("Executing initializeLibrary\n");
+  ODBG(ODT_Tool) << "Executing initializeLibrary";
 #define bindOmptFunctionName(OmptFunction, DestinationFunction)                \
   if (lookup)                                                                  \
     DestinationFunction = (OmptFunction##_t)lookup(#OmptFunction);             \
-  DP("initializeLibrary bound %s=%p\n", #DestinationFunction,                  \
-     ((void *)(uint64_t)DestinationFunction));
+  ODBG(ODT_Tool) << "initializeLibrary bound " << #DestinationFunction << "="  \
+                 << ((void *)(uint64_t)DestinationFunction);
 
   bindOmptFunctionName(ompt_get_callback, lookupCallbackByCode);
   bindOmptFunctionName(ompt_get_task_data, ompt_get_task_data_fn);
@@ -493,7 +496,7 @@ int llvm::omp::target::ompt::initializeLibrary(ompt_function_lookup_t lookup,
 }
 
 void llvm::omp::target::ompt::finalizeLibrary(ompt_data_t *data) {
-  DP("Executing finalizeLibrary\n");
+  ODBG(ODT_Tool) << "Executing finalizeLibrary";
   // Before disabling OMPT, call the (plugin) finalizations that were registered
   // with this library
   LibraryFinalizer->finalize();
@@ -502,7 +505,7 @@ void llvm::omp::target::ompt::finalizeLibrary(ompt_data_t *data) {
 }
 
 void llvm::omp::target::ompt::connectLibrary() {
-  DP("Entering connectLibrary\n");
+  ODBG(ODT_Tool) << "Entering connectLibrary";
   // Connect with libomp
   static OmptLibraryConnectorTy LibompConnector("libomp");
   static ompt_start_tool_result_t OmptResult;
@@ -525,7 +528,7 @@ void llvm::omp::target::ompt::connectLibrary() {
   FOREACH_OMPT_EMI_EVENT(bindOmptCallback)
 #undef bindOmptCallback
 
-  DP("Exiting connectLibrary\n");
+  ODBG(ODT_Tool) << "Exiting connectLibrary";
 }
 
 #endif // OMPT_SUPPORT
diff --git a/offload/libomptarget/PluginManager.cpp b/offload/libomptarget/PluginManager.cpp
index cd6d0371e8b50..4152b4087d91f 100644
--- a/offload/libomptarget/PluginManager.cpp
+++ b/offload/libomptarget/PluginManager.cpp
@@ -22,6 +22,7 @@
 
 using namespace llvm;
 using namespace llvm::sys;
+using namespace llvm::omp::target::debug;
 
 PluginManager *PM = nullptr;
 
@@ -32,11 +33,11 @@ PluginManager *PM = nullptr;
 void PluginManager::init() {
   TIMESCOPE();
   if (OffloadPolicy::isOffloadDisabled()) {
-    DP("Offload is disabled. Skipping plugin initialization\n");
+    ODBG(ODT_Init) << "Offload is disabled. Skipping plugin initialization";
     return;
   }
 
-  ODBG("Init") << "Loading RTLs";
+  ODBG(ODT_Init) << "Loading RTLs";
 
   // Attempt to create an instance of each supported plugin.
 #define PLUGIN_TARGET(Name)                                                    \
@@ -46,12 +47,12 @@ void PluginManager::init() {
   } while (false);
 #include "Shared/Targets.def"
 
-  DP("RTLs loaded!\n");
+  ODBG(ODT_Init) << "RTLs loaded!";
 }
 
 void PluginManager::deinit() {
   TIMESCOPE();
-  DP("Unloading RTLs...\n");
+  ODBG(ODT_Deinit) << "Unloading RTLs...";
 
   for (auto &Plugin : Plugins) {
     if (!Plugin->is_initialized())
@@ -59,12 +60,12 @@ void PluginManager::deinit() {
 
     if (auto Err = Plugin->deinit()) {
       [[maybe_unused]] std::string InfoMsg = toString(std::move(Err));
-      DP("Failed to deinit plugin: %s\n", InfoMsg.c_str());
+      ODBG(ODT_Deinit) << "Failed to deinit plugin: " << InfoMsg;
     }
     Plugin.release();
   }
 
-  DP("RTLs unloaded!\n");
+  ODBG(ODT_Deinit) << "RTLs unloaded!";
 }
 
 bool PluginManager::initializePlugin(GenericPluginTy &Plugin) {
@@ -73,12 +74,13 @@ bool PluginManager::initializePlugin(GenericPluginTy &Plugin) {
 
   if (auto Err = Plugin.init()) {
     [[maybe_unused]] std::string InfoMsg = toString(std::move(Err));
-    DP("Failed to init plugin: %s\n", InfoMsg.c_str());
+    ODBG(ODT_Init) << "Failed to init plugin: " << InfoMsg;
     return false;
   }
 
-  DP("Registered plugin %s with %d visible device(s)\n", Plugin.getName(),
-     Plugin.number_of_devices());
+  ODBG(ODT_Init) << "Registered plugin " << Plugin.getName() << " with "
+                 << Plugin.number_of_devices() << " visible device(s)";
+
   return true;
 }
 
@@ -105,7 +107,7 @@ bool PluginManager::initializeDevice(GenericPluginTy &Plugin,
   auto Device = std::make_unique<DeviceTy>(&Plugin, UserId, DeviceId);
   if (auto Err = Device->init()) {
     [[maybe_unused]] std::string InfoMsg = toString(std::move(Err));
-    DP("Failed to init device %d: %s\n", DeviceId, InfoMsg.c_str());
+    ODBG(ODT_Init) << "Failed to init device " << DeviceId << ": " << InfoMsg;
     return false;
   }
 
@@ -229,7 +...
[truncated]

@hansangbae
Copy link
Contributor Author

Committed the suggested changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants