[OpenMP] Fix failing test due to change in offloading flags

Summary:
Prior to D91261 the information checked the OMP_MAP_TARGET_PARAM flag, change this as it has been removed. The INFO macro was changed to accept a flag as input to make conditionally printing information easier.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D95133

GitOrigin-RevId: 119a9ea13f9f2e5fe78125bc3f9a76ebf85d3270
diff --git a/libomptarget/include/Debug.h b/libomptarget/include/Debug.h
index de593ec..a2bb419 100644
--- a/libomptarget/include/Debug.h
+++ b/libomptarget/include/Debug.h
@@ -47,8 +47,10 @@
   OMP_INFOTYPE_MAPPING_EXISTS = 0x0002,
   // Dump the contents of the device pointer map at kernel exit or failure.
   OMP_INFOTYPE_DUMP_TABLE = 0x0004,
-  // Print kernel information from target device plugins
+  // Print kernel information from target device plugins.
   OMP_INFOTYPE_PLUGIN_KERNEL = 0x0010,
+  // Enable every flag.
+  OMP_INFOTYPE_ALL = 0xffffffff,
 };
 
 static inline uint32_t getInfoLevel() {
@@ -161,11 +163,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/libomptarget/plugins/cuda/src/rtl.cpp b/libomptarget/plugins/cuda/src/rtl.cpp
index 92bbf43..e4ac1e0 100644
--- a/libomptarget/plugins/cuda/src/rtl.cpp
+++ b/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/libomptarget/src/device.cpp b/libomptarget/src/device.cpp
index 93c82e3..ee90bc6 100644
--- a/libomptarget/src/device.cpp
+++ b/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/libomptarget/src/private.h b/libomptarget/src/private.h
index 2267298..6a44dd9 100644
--- a/libomptarget/src/private.h
+++ b/libomptarget/src/private.h
@@ -101,14 +101,15 @@
     return;
 
   SourceInfo Kernel(Loc);
-  INFO(Device.DeviceID,
+  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(Device.DeviceID, "%-18s %-18s %s %s %s\n", "Host Ptr", "Target Ptr",
-       "Size (B)", "RefCount", "Declaration");
+  INFO(OMP_INFOTYPE_ALL, 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(OMP_INFOTYPE_ALL, 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,8 +125,9 @@
                      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.getFilename(), info.getLine(), info.getColumn(), ArgNum);
+  INFO(OMP_INFOTYPE_ALL, 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) {
     const map_var_info_t varName = (ArgNames) ? ArgNames[i] : nullptr;
@@ -142,12 +144,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(OMP_INFOTYPE_ALL, DeviceId, "%s(%s)[%ld] %s\n", type,
          getNameFromMapping(varName).c_str(), ArgSizes[i], implicit);
   }
 }