Skip to content

Commit 147bd89

Browse files
refactor: use PRINT_STRING macro for most diagnostics
Related-To: NEO-14742 Signed-off-by: Maciej Bielski <maciej.bielski@intel.com>
1 parent 68d01f3 commit 147bd89

File tree

160 files changed

+1468
-1466
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+1468
-1466
lines changed

level_zero/api/driver_experimental/public/zex_graph.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,13 @@ ze_result_t ZE_APICALL zeGraphDumpContentsExp(ze_graph_handle_t hGraph, const ch
222222
} else if (dumpDesc->mode == ZE_RECORD_REPLAY_GRAPH_EXP_DUMP_MODE_DETAILED) {
223223
exportStyle = L0::GraphExportStyle::detailed;
224224
} else {
225-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Could not recognize provided graph dump mode, mode: 0x%x.\n",
226-
dumpDesc->mode);
225+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Could not recognize provided graph dump mode, mode: 0x%x.\n",
226+
dumpDesc->mode);
227227
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
228228
}
229229
} else {
230-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Could not recognize provided extension, stype: 0x%x.\n",
231-
desc->stype);
230+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Could not recognize provided extension, stype: 0x%x.\n",
231+
desc->stype);
232232
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
233233
}
234234
}

level_zero/core/source/cmdlist/cmdlist_additional_args.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ ze_result_t CommandList::obtainLaunchParamsFromExtensions(const ze_base_desc_t *
5353
auto cooperativeDesc = reinterpret_cast<const ze_command_list_append_launch_kernel_param_cooperative_desc_t *>(desc);
5454
launchParams.isCooperative = cooperativeDesc->isCooperative;
5555
} else {
56-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Could not recognize provided extension, stype: 0x%x.\n",
57-
desc->stype);
56+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Could not recognize provided extension, stype: 0x%x.\n",
57+
desc->stype);
5858
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
5959
}
6060
desc = reinterpret_cast<const ze_base_desc_t *>(desc->pNext);
@@ -67,8 +67,8 @@ void CommandList::setAdditionalBlitPropertiesFromMemoryCopyParams(NEO::BlitPrope
6767

6868
ze_result_t CommandList::obtainMemoryCopyParamsFromExtensions(const ze_base_desc_t *desc, CmdListMemoryCopyParams &memoryCopyParams, bool writesOnly) const {
6969
if (desc) {
70-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Could not recognize provided extension, stype: 0x%x.\n",
71-
desc->stype);
70+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Could not recognize provided extension, stype: 0x%x.\n",
71+
desc->stype);
7272
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
7373
}
7474

level_zero/core/source/cmdlist/cmdlist_hw.inl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -944,8 +944,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemoryExt(z
944944
if (pDstRegion->width % groupSizeX || pDstRegion->height % groupSizeY || pDstRegion->depth % groupSizeZ) {
945945
CREATE_DEBUG_STRING(str, "Invalid group size {%d, %d, %d} specified\n", groupSizeX, groupSizeY, groupSizeZ);
946946
driverHandle->setErrorDescription(std::string(str.get()));
947-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n",
948-
groupSizeX, groupSizeY, groupSizeZ);
947+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n",
948+
groupSizeX, groupSizeY, groupSizeZ);
949949
DEBUG_BREAK_IF(true);
950950
return ZE_RESULT_ERROR_UNKNOWN;
951951
}
@@ -1120,7 +1120,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemoryExt(voi
11201120
default: {
11211121
CREATE_DEBUG_STRING(str, "Invalid bytesPerPixel of size: %u\n", bytesPerPixel);
11221122
driverHandle->setErrorDescription(std::string(str.get()));
1123-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "invalid bytesPerPixel of size: %u\n", bytesPerPixel);
1123+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "invalid bytesPerPixel of size: %u\n", bytesPerPixel);
11241124
UNRECOVERABLE_IF(true);
11251125
break;
11261126
}
@@ -1166,8 +1166,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemoryExt(voi
11661166
if (pSrcRegion->width % groupSizeX || pSrcRegion->height % groupSizeY || pSrcRegion->depth % groupSizeZ) {
11671167
CREATE_DEBUG_STRING(str, "Invalid group size {%d, %d, %d} specified\n", groupSizeX, groupSizeY, groupSizeZ);
11681168
driverHandle->setErrorDescription(std::string(str.get()));
1169-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n",
1170-
groupSizeX, groupSizeY, groupSizeZ);
1169+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n",
1170+
groupSizeX, groupSizeY, groupSizeZ);
11711171
DEBUG_BREAK_IF(true);
11721172
return ZE_RESULT_ERROR_UNKNOWN;
11731173
}
@@ -1325,8 +1325,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyRegion(ze_image
13251325
if (srcRegion.width % groupSizeX || srcRegion.height % groupSizeY || srcRegion.depth % groupSizeZ) {
13261326
CREATE_DEBUG_STRING(str, "Invalid group size {%d, %d, %d} specified\n", groupSizeX, groupSizeY, groupSizeZ);
13271327
driverHandle->setErrorDescription(std::string(str.get()));
1328-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n",
1329-
groupSizeX, groupSizeY, groupSizeZ);
1328+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n",
1329+
groupSizeX, groupSizeY, groupSizeZ);
13301330
DEBUG_BREAK_IF(true);
13311331
return ZE_RESULT_ERROR_UNKNOWN;
13321332
}
@@ -2307,8 +2307,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernel3d(Align
23072307
if (srcRegion->width % groupSizeX || srcRegion->height % groupSizeY || srcRegion->depth % groupSizeZ) {
23082308
CREATE_DEBUG_STRING(str, "Invalid group size {%d, %d, %d} specified\n", groupSizeX, groupSizeY, groupSizeZ);
23092309
driverHandle->setErrorDescription(std::string(str.get()));
2310-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n",
2311-
groupSizeX, groupSizeY, groupSizeZ);
2310+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n",
2311+
groupSizeX, groupSizeY, groupSizeZ);
23122312
DEBUG_BREAK_IF(true);
23132313
return ZE_RESULT_ERROR_UNKNOWN;
23142314
}
@@ -2401,8 +2401,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernel2d(Align
24012401
if (srcRegion->width % groupSizeX || srcRegion->height % groupSizeY) {
24022402
CREATE_DEBUG_STRING(str, "Invalid group size {%d, %d} specified\n", groupSizeX, groupSizeY);
24032403
driverHandle->setErrorDescription(std::string(str.get()));
2404-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d}\n",
2405-
groupSizeX, groupSizeY);
2404+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d}\n",
2405+
groupSizeX, groupSizeY);
24062406
DEBUG_BREAK_IF(true);
24072407
return ZE_RESULT_ERROR_UNKNOWN;
24082408
}
@@ -2956,7 +2956,7 @@ inline uint64_t CommandListCoreFamily<gfxCoreFamily>::getInputBufferSize(NEO::Im
29562956
default: {
29572957
CREATE_DEBUG_STRING(str, "invalid imageType: %d\n", static_cast<int>(imageType));
29582958
driverHandle->setErrorDescription(std::string(str.get()));
2959-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "invalid imageType: %d\n", imageType);
2959+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "invalid imageType: %d\n", imageType);
29602960
UNRECOVERABLE_IF(true);
29612961
return 0;
29622962
}

level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
289289
if (slmTotalSize > 0 && localMemSize < slmTotalSize) {
290290
CREATE_DEBUG_STRING(str, "Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize);
291291
deviceHandle->setErrorDescription(std::string(str.get()));
292-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize);
292+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize);
293293
return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY;
294294
}
295295

level_zero/core/source/context/context_imp_drm/context_imp_drm.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ bool ContextImp::isOpaqueHandleSupported(IpcHandleType *handleType) {
3030
*handleType = IpcHandleType::fdHandle;
3131
if (useOpaqueHandle) {
3232
if (NEO::SysCalls::prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY) == -1) {
33-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "prctl Syscall for PR_SET_PTRACER, PR_SET_PTRACER_ANY failed, using fallback mechanism for IPC handle exchange\n");
33+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "prctl Syscall for PR_SET_PTRACER, PR_SET_PTRACER_ANY failed, using fallback mechanism for IPC handle exchange\n");
3434
return false;
3535
}
3636
}
@@ -56,12 +56,12 @@ void *ContextImp::getMemHandlePtr(ze_device_handle_t hDevice, uint64_t handle, N
5656
unsigned int flags = 0u;
5757
int pidfd = NEO::SysCalls::pidfdopen(exporterPid, flags);
5858
if (pidfd == -1) {
59-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "pidfd_open Syscall failed, using fallback mechanism for IPC handle exchange\n");
59+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "pidfd_open Syscall failed, using fallback mechanism for IPC handle exchange\n");
6060
} else {
6161
unsigned int flags = 0u;
6262
int newfd = NEO::SysCalls::pidfdgetfd(pidfd, static_cast<int>(handle), flags);
6363
if (newfd < 0) {
64-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "pidfd_getfd Syscall failed, using fallback mechanism for IPC handle exchange\n");
64+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "pidfd_getfd Syscall failed, using fallback mechanism for IPC handle exchange\n");
6565
} else {
6666
importHandle = static_cast<uint64_t>(newfd);
6767
}

level_zero/core/source/context/context_imp_drm_or_wddm/context_imp_drm_or_wddm.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ bool ContextImp::isOpaqueHandleSupported(IpcHandleType *handleType) {
4444
*handleType = IpcHandleType::fdHandle;
4545
if (useOpaqueHandle) {
4646
if (NEO::SysCalls::prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY) == -1) {
47-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "prctl Syscall for PR_SET_PTRACER, PR_SET_PTRACER_ANY failed, using fallback mechanism for IPC handle exchange\n");
47+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "prctl Syscall for PR_SET_PTRACER, PR_SET_PTRACER_ANY failed, using fallback mechanism for IPC handle exchange\n");
4848
return false;
4949
}
5050
}
@@ -95,12 +95,12 @@ void *ContextImp::getMemHandlePtr(ze_device_handle_t hDevice,
9595
unsigned int flags = 0u;
9696
int pidfd = NEO::SysCalls::pidfdopen(exporterPid, flags);
9797
if (pidfd == -1) {
98-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "pidfd_open Syscall failed, using fallback mechanism for IPC handle exchange\n");
98+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "pidfd_open Syscall failed, using fallback mechanism for IPC handle exchange\n");
9999
} else {
100100
unsigned int flags = 0u;
101101
int newfd = NEO::SysCalls::pidfdgetfd(pidfd, static_cast<int>(handle), flags);
102102
if (newfd < 0) {
103-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "pidfd_getfd Syscall failed, using fallback mechanism for IPC handle exchange\n");
103+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "pidfd_getfd Syscall failed, using fallback mechanism for IPC handle exchange\n");
104104
} else {
105105
importHandle = static_cast<uint64_t>(newfd);
106106
}

level_zero/core/source/device/device_imp.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,8 +1179,8 @@ ze_result_t DeviceImp::getGlobalTimestampsUsingOsInterface(uint64_t *hostTimesta
11791179
kernelTimestampMaxValueInCycles = (1ull << validBits) - 1;
11801180
}
11811181
const uint64_t deviceTsinNs = (*deviceTimestamp & kernelTimestampMaxValueInCycles) * this->neoDevice->getDeviceInfo().outProfilingTimerResolution;
1182-
NEO::printDebugString(true, stdout,
1183-
"Host timestamp in ns : %llu | Device timestamp in ns : %llu\n", *hostTimestamp, deviceTsinNs);
1182+
PRINT_STRING(true, stdout,
1183+
"Host timestamp in ns : %llu | Device timestamp in ns : %llu\n", *hostTimestamp, deviceTsinNs);
11841184
}
11851185

11861186
return ZE_RESULT_SUCCESS;
@@ -1492,8 +1492,8 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, bool
14921492
if (neoDevice->getCompilerInterface()) {
14931493
if (rootDeviceEnvironment.executionEnvironment.getDebuggingMode() == NEO::DebuggingMode::offline) {
14941494
if (NEO::SipKernel::getSipKernel(*neoDevice, nullptr).getCtxOffset() == 0) {
1495-
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
1496-
"Invalid SIP binary.\n");
1495+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
1496+
"Invalid SIP binary.\n");
14971497
}
14981498
}
14991499
auto &sipKernel = NEO::SipKernel::getSipKernel(*neoDevice, nullptr);

level_zero/core/source/device/device_imp_drm/device_imp_peer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ ze_result_t queryFabricStatsDrm(DeviceImp *pSourceDevice, DeviceImp *pPeerDevice
6363
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
6464
}
6565

66-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
67-
"Connection detected between device %d and peer device %d: latency %d hops, bandwidth %d GBPS\n",
68-
pSourceDevice->getRootDeviceIndex(), pPeerDevice->getRootDeviceIndex(), latency, bandwidth);
66+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
67+
"Connection detected between device %d and peer device %d: latency %d hops, bandwidth %d GBPS\n",
68+
pSourceDevice->getRootDeviceIndex(), pPeerDevice->getRootDeviceIndex(), latency, bandwidth);
6969

7070
return ZE_RESULT_SUCCESS;
7171
}

level_zero/core/source/event/event.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,10 @@ ze_result_t EventPool::openEventPoolIpcHandle(const ze_ipc_event_pool_handle_t &
487487

488488
eventPool->initializeSizeParameters(numDevices, deviceHandlesUsed, *driver, neoDevice->getRootDeviceEnvironment());
489489
if (eventPool->getEventMaxPackets() != poolData.maxEventPackets) {
490-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(),
491-
stderr,
492-
"IPC handle max event packets %u does not match context devices max event packet %u\n",
493-
poolData.maxEventPackets, eventPool->getEventMaxPackets());
490+
PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(),
491+
stderr,
492+
"IPC handle max event packets %u does not match context devices max event packet %u\n",
493+
poolData.maxEventPackets, eventPool->getEventMaxPackets());
494494
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
495495
}
496496

level_zero/core/source/event/event_impl.inl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ ze_result_t EventImp<TagSizeT>::calculateProfilingData() {
215215

216216
auto calculatedGlobalEndTs = getEndTS(isGlobalTsOverflowed, currentGlobal, globalEndTS);
217217
auto calculatedContextEndTs = getEndTS(isContextTsOverflowed, currentContext, contextEndTS);
218-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintTimestampPacketContents.get(), stdout, "kernel id: %d, packet: %d, globalStartTS: %llu, globalEndTS: %llu, contextStartTS: %llu, contextEndTS: %llu\n",
219-
kernelId, packetId, currentGlobal.first, calculatedGlobalEndTs, currentContext.first, calculatedContextEndTs);
218+
PRINT_STRING(NEO::debugManager.flags.PrintTimestampPacketContents.get(), stdout, "kernel id: %d, packet: %d, globalStartTS: %llu, globalEndTS: %llu, contextStartTS: %llu, contextEndTS: %llu\n",
219+
kernelId, packetId, currentGlobal.first, calculatedGlobalEndTs, currentContext.first, calculatedContextEndTs);
220220

221221
globalStartTS = std::min(globalStartTS, currentGlobal.first);
222222
contextStartTS = std::min(contextStartTS, currentContext.first);
@@ -832,10 +832,9 @@ ze_result_t EventImp<TagSizeT>::reset() {
832832
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
833833
}
834834

835-
if (NEO::debugManager.flags.SynchronizeEventBeforeReset.get() != -1) {
836-
if (NEO::debugManager.flags.SynchronizeEventBeforeReset.get() == 2 && queryStatus(0) != ZE_RESULT_SUCCESS) {
837-
printf("\nzeEventHostReset: Event %p not ready. Calling zeEventHostSynchronize.", this);
838-
}
835+
if (const auto flag = NEO::debugManager.flags.SynchronizeEventBeforeReset.get(); flag != -1) {
836+
PRINT_STRING((flag == 2 && queryStatus(0) != ZE_RESULT_SUCCESS), stdout,
837+
"\nzeEventHostReset: Event %p not ready. Calling zeEventHostSynchronize.", this);
839838

840839
hostSynchronize(std::numeric_limits<uint64_t>::max());
841840
}
@@ -915,8 +914,8 @@ ze_result_t EventImp<TagSizeT>::queryKernelTimestamp(ze_kernel_timestamp_result_
915914
eventTsSetFunc(globalEndTS, result.context.kernelEnd);
916915
eventTsSetFunc(globalEndTS, result.global.kernelEnd);
917916
}
918-
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintCalculatedTimestamps.get(), stdout, "globalStartTS: %llu, globalEndTS: %llu, contextStartTS: %llu, contextEndTS: %llu\n",
919-
result.global.kernelStart, result.global.kernelEnd, result.context.kernelStart, result.context.kernelEnd);
917+
PRINT_STRING(NEO::debugManager.flags.PrintCalculatedTimestamps.get(), stdout, "globalStartTS: %llu, globalEndTS: %llu, contextStartTS: %llu, contextEndTS: %llu\n",
918+
result.global.kernelStart, result.global.kernelEnd, result.context.kernelStart, result.context.kernelEnd);
920919

921920
return ZE_RESULT_SUCCESS;
922921
}

0 commit comments

Comments
 (0)