[llvm] [OpenMP][Offload] Revert format of changed messages (PR #171995)
Alex Duran via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 12 03:40:59 PST 2025
https://github.com/adurang created https://github.com/llvm/llvm-project/pull/171995
Adjust format of some of the updated debug output to match the old format as there are a number of tests that rely on it.
>From 8bbf1688900d2f29774ebf8d3acec7155c48c108 Mon Sep 17 00:00:00 2001
From: Alex Duran <alejandro.duran at intel.com>
Date: Fri, 12 Dec 2025 12:39:14 +0100
Subject: [PATCH] [OpenMP][Offload] Adjust format of changed messages
---
offload/include/Shared/Debug.h | 7 +++++++
offload/libomptarget/interface.cpp | 14 +++++++-------
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/offload/include/Shared/Debug.h b/offload/include/Shared/Debug.h
index d5cf719f1ebf3..585cf82995fa6 100644
--- a/offload/include/Shared/Debug.h
+++ b/offload/include/Shared/Debug.h
@@ -45,6 +45,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/circular_raw_ostream.h"
+#include "llvm/Support/Format.h"
/// 32-Bit field data attributes controlling information presented to the user.
enum OpenMPInfoType : uint32_t {
@@ -578,6 +579,12 @@ static inline odbg_ostream reportErrorStream() {
} \
} while (false)
+// Define default format for pointers
+static inline raw_ostream &operator<<(raw_ostream &Os, void *Ptr) {
+ Os << ::llvm::format(DPxMOD, DPxPTR(Ptr));
+ return Os;
+}
+
#else
#define DP(...) \
{ \
diff --git a/offload/libomptarget/interface.cpp b/offload/libomptarget/interface.cpp
index c17e3e39b04b9..9b64e60fb8072 100644
--- a/offload/libomptarget/interface.cpp
+++ b/offload/libomptarget/interface.cpp
@@ -25,7 +25,6 @@
#include "Utils/ExponentialBackoff.h"
#include "llvm/Frontend/OpenMP/OMPConstants.h"
-#include "llvm/Support/Format.h"
#include <cassert>
#include <cstdint>
@@ -138,9 +137,9 @@ targetData(ident_t *Loc, int64_t DeviceId, int32_t ArgNum, void **ArgsBase,
RegionTypeMsg);
ODBG_OS(ODT_Kernel, [&](llvm::raw_ostream &Os) {
for (int I = 0; I < ArgNum; ++I) {
- Os << "Entry " << llvm::format_decimal(I, 2) << ": Base=" << ArgsBase[I]
+ Os << "Entry " << llvm::format("%2d", I) << ": Base=" << ArgsBase[I]
<< ", Begin=" << Args[I] << ", Size=" << ArgSizes[I]
- << ", Type=" << llvm::format_hex(ArgTypes[I], 8) << ", Name="
+ << ", Type=" << llvm::format("0x%" PRIx64, ArgTypes[I]) << ", Name="
<< ((ArgNames) ? getNameFromMapping(ArgNames[I]) : "unknown") << "\n";
}
});
@@ -358,11 +357,11 @@ static inline int targetKernel(ident_t *Loc, int64_t DeviceId, int32_t NumTeams,
ODBG_OS(ODT_Kernel, [&](llvm::raw_ostream &Os) {
for (uint32_t I = 0; I < KernelArgs->NumArgs; ++I) {
- Os << "Entry " << llvm::format_decimal(I, 2)
- << " Base=" << KernelArgs->ArgBasePtrs[I]
+ Os << "Entry" << llvm::format("%2d", I)
+ << ": Base=" << KernelArgs->ArgBasePtrs[I]
<< ", Begin=" << KernelArgs->ArgPtrs[I]
<< ", Size=" << KernelArgs->ArgSizes[I]
- << ", Type=" << llvm::format_hex(KernelArgs->ArgTypes[I], 8)
+ << ", Type=" << llvm::format("0x%" PRIx64, KernelArgs->ArgTypes[I])
<< ", Name="
<< (KernelArgs->ArgNames
? getNameFromMapping(KernelArgs->ArgNames[I]).c_str()
@@ -508,7 +507,8 @@ EXTERN void __tgt_push_mapper_component(void *RtMapperHandle, void *Base,
ODBG(ODT_Interface) << "__tgt_push_mapper_component(Handle=" << RtMapperHandle
<< ") adds an entry (Base=" << Base << ", Begin=" << Begin
<< ", Size=" << Size
- << ", Type=" << llvm::format_hex(Type, 8) << ", Name="
+ << ", Type=" << llvm::format("0x%" PRIx64, Type)
+ << ", Name="
<< ((Name) ? getNameFromMapping(Name) : "unknown") << ")";
auto *MapperComponentsPtr = (struct MapperComponentsTy *)RtMapperHandle;
MapperComponentsPtr->Components.push_back(
More information about the llvm-commits
mailing list