diff --git a/level_zero/api/driver_experimental/public/zex_graph.cpp b/level_zero/api/driver_experimental/public/zex_graph.cpp index 87ccc70fa0..bda6368b82 100644 --- a/level_zero/api/driver_experimental/public/zex_graph.cpp +++ b/level_zero/api/driver_experimental/public/zex_graph.cpp @@ -222,13 +222,13 @@ ze_result_t ZE_APICALL zeGraphDumpContentsExp(ze_graph_handle_t hGraph, const ch } else if (dumpDesc->mode == ZE_RECORD_REPLAY_GRAPH_EXP_DUMP_MODE_DETAILED) { exportStyle = L0::GraphExportStyle::detailed; } else { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Could not recognize provided graph dump mode, mode: 0x%x.\n", - dumpDesc->mode); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Could not recognize provided graph dump mode, mode: 0x%x.\n", + dumpDesc->mode); return ZE_RESULT_ERROR_INVALID_ARGUMENT; } } else { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Could not recognize provided extension, stype: 0x%x.\n", - desc->stype); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Could not recognize provided extension, stype: 0x%x.\n", + desc->stype); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } } diff --git a/level_zero/core/source/cmdlist/cmdlist_additional_args.cpp b/level_zero/core/source/cmdlist/cmdlist_additional_args.cpp index 443b10a2c9..216908c7e0 100644 --- a/level_zero/core/source/cmdlist/cmdlist_additional_args.cpp +++ b/level_zero/core/source/cmdlist/cmdlist_additional_args.cpp @@ -53,8 +53,8 @@ ze_result_t CommandList::obtainLaunchParamsFromExtensions(const ze_base_desc_t * auto cooperativeDesc = reinterpret_cast(desc); launchParams.isCooperative = cooperativeDesc->isCooperative; } else { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Could not recognize provided extension, stype: 0x%x.\n", - desc->stype); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Could not recognize provided extension, stype: 0x%x.\n", + desc->stype); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } desc = reinterpret_cast(desc->pNext); @@ -67,8 +67,8 @@ void CommandList::setAdditionalBlitPropertiesFromMemoryCopyParams(NEO::BlitPrope ze_result_t CommandList::obtainMemoryCopyParamsFromExtensions(const ze_base_desc_t *desc, CmdListMemoryCopyParams &memoryCopyParams, bool writesOnly) const { if (desc) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Could not recognize provided extension, stype: 0x%x.\n", - desc->stype); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Could not recognize provided extension, stype: 0x%x.\n", + desc->stype); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index feca02e6de..9b6488e743 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -944,8 +944,8 @@ ze_result_t CommandListCoreFamily::appendImageCopyFromMemoryExt(z if (pDstRegion->width % groupSizeX || pDstRegion->height % groupSizeY || pDstRegion->depth % groupSizeZ) { CREATE_DEBUG_STRING(str, "Invalid group size {%d, %d, %d} specified\n", groupSizeX, groupSizeY, groupSizeZ); driverHandle->setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n", - groupSizeX, groupSizeY, groupSizeZ); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n", + groupSizeX, groupSizeY, groupSizeZ); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_UNKNOWN; } @@ -1120,7 +1120,7 @@ ze_result_t CommandListCoreFamily::appendImageCopyToMemoryExt(voi default: { CREATE_DEBUG_STRING(str, "Invalid bytesPerPixel of size: %u\n", bytesPerPixel); driverHandle->setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "invalid bytesPerPixel of size: %u\n", bytesPerPixel); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "invalid bytesPerPixel of size: %u\n", bytesPerPixel); UNRECOVERABLE_IF(true); break; } @@ -1166,8 +1166,8 @@ ze_result_t CommandListCoreFamily::appendImageCopyToMemoryExt(voi if (pSrcRegion->width % groupSizeX || pSrcRegion->height % groupSizeY || pSrcRegion->depth % groupSizeZ) { CREATE_DEBUG_STRING(str, "Invalid group size {%d, %d, %d} specified\n", groupSizeX, groupSizeY, groupSizeZ); driverHandle->setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n", - groupSizeX, groupSizeY, groupSizeZ); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n", + groupSizeX, groupSizeY, groupSizeZ); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_UNKNOWN; } @@ -1325,8 +1325,8 @@ ze_result_t CommandListCoreFamily::appendImageCopyRegion(ze_image if (srcRegion.width % groupSizeX || srcRegion.height % groupSizeY || srcRegion.depth % groupSizeZ) { CREATE_DEBUG_STRING(str, "Invalid group size {%d, %d, %d} specified\n", groupSizeX, groupSizeY, groupSizeZ); driverHandle->setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n", - groupSizeX, groupSizeY, groupSizeZ); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n", + groupSizeX, groupSizeY, groupSizeZ); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_UNKNOWN; } @@ -2307,8 +2307,8 @@ ze_result_t CommandListCoreFamily::appendMemoryCopyKernel3d(Align if (srcRegion->width % groupSizeX || srcRegion->height % groupSizeY || srcRegion->depth % groupSizeZ) { CREATE_DEBUG_STRING(str, "Invalid group size {%d, %d, %d} specified\n", groupSizeX, groupSizeY, groupSizeZ); driverHandle->setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n", - groupSizeX, groupSizeY, groupSizeZ); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n", + groupSizeX, groupSizeY, groupSizeZ); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_UNKNOWN; } @@ -2401,8 +2401,8 @@ ze_result_t CommandListCoreFamily::appendMemoryCopyKernel2d(Align if (srcRegion->width % groupSizeX || srcRegion->height % groupSizeY) { CREATE_DEBUG_STRING(str, "Invalid group size {%d, %d} specified\n", groupSizeX, groupSizeY); driverHandle->setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d}\n", - groupSizeX, groupSizeY); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d}\n", + groupSizeX, groupSizeY); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_UNKNOWN; } @@ -2956,7 +2956,7 @@ inline uint64_t CommandListCoreFamily::getInputBufferSize(NEO::Im default: { CREATE_DEBUG_STRING(str, "invalid imageType: %d\n", static_cast(imageType)); driverHandle->setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "invalid imageType: %d\n", imageType); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "invalid imageType: %d\n", imageType); UNRECOVERABLE_IF(true); return 0; } diff --git a/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl b/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl index fc5e0803a9..a28a0a36f3 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl @@ -289,7 +289,7 @@ ze_result_t CommandListCoreFamily::appendLaunchKernelWithParams(K if (slmTotalSize > 0 && localMemSize < slmTotalSize) { CREATE_DEBUG_STRING(str, "Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize); deviceHandle->setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize); return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY; } diff --git a/level_zero/core/source/context/context_imp_drm/context_imp_drm.cpp b/level_zero/core/source/context/context_imp_drm/context_imp_drm.cpp index 739fc169aa..7d0abab32d 100644 --- a/level_zero/core/source/context/context_imp_drm/context_imp_drm.cpp +++ b/level_zero/core/source/context/context_imp_drm/context_imp_drm.cpp @@ -30,7 +30,7 @@ bool ContextImp::isOpaqueHandleSupported(IpcHandleType *handleType) { *handleType = IpcHandleType::fdHandle; if (useOpaqueHandle) { if (NEO::SysCalls::prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY) == -1) { - 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"); + 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"); return false; } } @@ -56,12 +56,12 @@ void *ContextImp::getMemHandlePtr(ze_device_handle_t hDevice, uint64_t handle, N unsigned int flags = 0u; int pidfd = NEO::SysCalls::pidfdopen(exporterPid, flags); if (pidfd == -1) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "pidfd_open Syscall failed, using fallback mechanism for IPC handle exchange\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "pidfd_open Syscall failed, using fallback mechanism for IPC handle exchange\n"); } else { unsigned int flags = 0u; int newfd = NEO::SysCalls::pidfdgetfd(pidfd, static_cast(handle), flags); if (newfd < 0) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "pidfd_getfd Syscall failed, using fallback mechanism for IPC handle exchange\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "pidfd_getfd Syscall failed, using fallback mechanism for IPC handle exchange\n"); } else { importHandle = static_cast(newfd); } diff --git a/level_zero/core/source/context/context_imp_drm_or_wddm/context_imp_drm_or_wddm.cpp b/level_zero/core/source/context/context_imp_drm_or_wddm/context_imp_drm_or_wddm.cpp index c735a2ca9d..9b84ed1c56 100644 --- a/level_zero/core/source/context/context_imp_drm_or_wddm/context_imp_drm_or_wddm.cpp +++ b/level_zero/core/source/context/context_imp_drm_or_wddm/context_imp_drm_or_wddm.cpp @@ -44,7 +44,7 @@ bool ContextImp::isOpaqueHandleSupported(IpcHandleType *handleType) { *handleType = IpcHandleType::fdHandle; if (useOpaqueHandle) { if (NEO::SysCalls::prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY) == -1) { - 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"); + 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"); return false; } } @@ -95,12 +95,12 @@ void *ContextImp::getMemHandlePtr(ze_device_handle_t hDevice, unsigned int flags = 0u; int pidfd = NEO::SysCalls::pidfdopen(exporterPid, flags); if (pidfd == -1) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "pidfd_open Syscall failed, using fallback mechanism for IPC handle exchange\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "pidfd_open Syscall failed, using fallback mechanism for IPC handle exchange\n"); } else { unsigned int flags = 0u; int newfd = NEO::SysCalls::pidfdgetfd(pidfd, static_cast(handle), flags); if (newfd < 0) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "pidfd_getfd Syscall failed, using fallback mechanism for IPC handle exchange\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "pidfd_getfd Syscall failed, using fallback mechanism for IPC handle exchange\n"); } else { importHandle = static_cast(newfd); } diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index 8f50464173..6ecfee08c3 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -1179,8 +1179,8 @@ ze_result_t DeviceImp::getGlobalTimestampsUsingOsInterface(uint64_t *hostTimesta kernelTimestampMaxValueInCycles = (1ull << validBits) - 1; } const uint64_t deviceTsinNs = (*deviceTimestamp & kernelTimestampMaxValueInCycles) * this->neoDevice->getDeviceInfo().outProfilingTimerResolution; - NEO::printDebugString(true, stdout, - "Host timestamp in ns : %llu | Device timestamp in ns : %llu\n", *hostTimestamp, deviceTsinNs); + PRINT_STRING(true, stdout, + "Host timestamp in ns : %llu | Device timestamp in ns : %llu\n", *hostTimestamp, deviceTsinNs); } return ZE_RESULT_SUCCESS; @@ -1492,8 +1492,8 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, bool if (neoDevice->getCompilerInterface()) { if (rootDeviceEnvironment.executionEnvironment.getDebuggingMode() == NEO::DebuggingMode::offline) { if (NEO::SipKernel::getSipKernel(*neoDevice, nullptr).getCtxOffset() == 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Invalid SIP binary.\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Invalid SIP binary.\n"); } } auto &sipKernel = NEO::SipKernel::getSipKernel(*neoDevice, nullptr); diff --git a/level_zero/core/source/device/device_imp_drm/device_imp_peer.cpp b/level_zero/core/source/device/device_imp_drm/device_imp_peer.cpp index a1f7e0e118..4961b51f11 100644 --- a/level_zero/core/source/device/device_imp_drm/device_imp_peer.cpp +++ b/level_zero/core/source/device/device_imp_drm/device_imp_peer.cpp @@ -63,9 +63,9 @@ ze_result_t queryFabricStatsDrm(DeviceImp *pSourceDevice, DeviceImp *pPeerDevice return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Connection detected between device %d and peer device %d: latency %d hops, bandwidth %d GBPS\n", - pSourceDevice->getRootDeviceIndex(), pPeerDevice->getRootDeviceIndex(), latency, bandwidth); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Connection detected between device %d and peer device %d: latency %d hops, bandwidth %d GBPS\n", + pSourceDevice->getRootDeviceIndex(), pPeerDevice->getRootDeviceIndex(), latency, bandwidth); return ZE_RESULT_SUCCESS; } diff --git a/level_zero/core/source/event/event.cpp b/level_zero/core/source/event/event.cpp index f15fa39373..2584ad62d0 100644 --- a/level_zero/core/source/event/event.cpp +++ b/level_zero/core/source/event/event.cpp @@ -487,10 +487,10 @@ ze_result_t EventPool::openEventPoolIpcHandle(const ze_ipc_event_pool_handle_t & eventPool->initializeSizeParameters(numDevices, deviceHandlesUsed, *driver, neoDevice->getRootDeviceEnvironment()); if (eventPool->getEventMaxPackets() != poolData.maxEventPackets) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), - stderr, - "IPC handle max event packets %u does not match context devices max event packet %u\n", - poolData.maxEventPackets, eventPool->getEventMaxPackets()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), + stderr, + "IPC handle max event packets %u does not match context devices max event packet %u\n", + poolData.maxEventPackets, eventPool->getEventMaxPackets()); return ZE_RESULT_ERROR_INVALID_ARGUMENT; } diff --git a/level_zero/core/source/event/event_impl.inl b/level_zero/core/source/event/event_impl.inl index 7a2eb110b9..1dbed7269d 100644 --- a/level_zero/core/source/event/event_impl.inl +++ b/level_zero/core/source/event/event_impl.inl @@ -215,8 +215,8 @@ ze_result_t EventImp::calculateProfilingData() { auto calculatedGlobalEndTs = getEndTS(isGlobalTsOverflowed, currentGlobal, globalEndTS); auto calculatedContextEndTs = getEndTS(isContextTsOverflowed, currentContext, contextEndTS); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintTimestampPacketContents.get(), stdout, "kernel id: %d, packet: %d, globalStartTS: %llu, globalEndTS: %llu, contextStartTS: %llu, contextEndTS: %llu\n", - kernelId, packetId, currentGlobal.first, calculatedGlobalEndTs, currentContext.first, calculatedContextEndTs); + PRINT_STRING(NEO::debugManager.flags.PrintTimestampPacketContents.get(), stdout, "kernel id: %d, packet: %d, globalStartTS: %llu, globalEndTS: %llu, contextStartTS: %llu, contextEndTS: %llu\n", + kernelId, packetId, currentGlobal.first, calculatedGlobalEndTs, currentContext.first, calculatedContextEndTs); globalStartTS = std::min(globalStartTS, currentGlobal.first); contextStartTS = std::min(contextStartTS, currentContext.first); @@ -832,10 +832,9 @@ ze_result_t EventImp::reset() { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - if (NEO::debugManager.flags.SynchronizeEventBeforeReset.get() != -1) { - if (NEO::debugManager.flags.SynchronizeEventBeforeReset.get() == 2 && queryStatus(0) != ZE_RESULT_SUCCESS) { - printf("\nzeEventHostReset: Event %p not ready. Calling zeEventHostSynchronize.", this); - } + if (const auto flag = NEO::debugManager.flags.SynchronizeEventBeforeReset.get(); flag != -1) { + PRINT_STRING((flag == 2 && queryStatus(0) != ZE_RESULT_SUCCESS), stdout, + "\nzeEventHostReset: Event %p not ready. Calling zeEventHostSynchronize.", this); hostSynchronize(std::numeric_limits::max()); } @@ -915,8 +914,8 @@ ze_result_t EventImp::queryKernelTimestamp(ze_kernel_timestamp_result_ eventTsSetFunc(globalEndTS, result.context.kernelEnd); eventTsSetFunc(globalEndTS, result.global.kernelEnd); } - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintCalculatedTimestamps.get(), stdout, "globalStartTS: %llu, globalEndTS: %llu, contextStartTS: %llu, contextEndTS: %llu\n", - result.global.kernelStart, result.global.kernelEnd, result.context.kernelStart, result.context.kernelEnd); + PRINT_STRING(NEO::debugManager.flags.PrintCalculatedTimestamps.get(), stdout, "globalStartTS: %llu, globalEndTS: %llu, contextStartTS: %llu, contextEndTS: %llu\n", + result.global.kernelStart, result.global.kernelEnd, result.context.kernelStart, result.context.kernelEnd); return ZE_RESULT_SUCCESS; } diff --git a/level_zero/core/source/fabric/linux/fabric_device_iaf.cpp b/level_zero/core/source/fabric/linux/fabric_device_iaf.cpp index 17f3095216..15ab9442ba 100644 --- a/level_zero/core/source/fabric/linux/fabric_device_iaf.cpp +++ b/level_zero/core/source/fabric/linux/fabric_device_iaf.cpp @@ -112,7 +112,7 @@ ze_result_t FabricSubDeviceIaf::enumerate() { auto pDrm = osInterface->getDriverModel()->as(); std::optional rootPciPath = NEO::getPciLinkPath(pDrm->getFileDescriptor()); if (!rootPciPath.has_value()) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PCI Path not found%s\n", ""); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PCI Path not found%s\n", ""); return ZE_RESULT_ERROR_UNKNOWN; } @@ -140,10 +140,10 @@ ze_result_t FabricSubDeviceIaf::enumerate() { FabricPortConnection connection = {}; ze_result_t result = getConnection(iafPort, connection); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "failure observed for IafPort{0x%x, 0x%x, 0x%x}: 0x%x\n", - iafPort.portId.fabricId, iafPort.portId.attachId, iafPort.portId.portNumber, - result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "failure observed for IafPort{0x%x, 0x%x, 0x%x}: 0x%x\n", + iafPort.portId.fabricId, iafPort.portId.attachId, iafPort.portId.portNumber, + result); continue; } connections.push_back(connection); @@ -154,10 +154,10 @@ ze_result_t FabricSubDeviceIaf::enumerate() { std::vector ports = {}; if (ZE_RESULT_SUCCESS != pIafNlApi->subdevicePropertiesGet(iafPorts[0].portId.fabricId, physicalSubDeviceId, guid, ports)) { connections.clear(); - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "failure during fabric port guid reading {0x%x, 0x%x, 0x%x}: result: 0x%x subdeviceId:%d\n", - iafPorts[0].portId.fabricId, iafPorts[0].portId.attachId, iafPorts[0].portId.portNumber, - result, physicalSubDeviceId); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "failure during fabric port guid reading {0x%x, 0x%x, 0x%x}: result: 0x%x subdeviceId:%d\n", + iafPorts[0].portId.fabricId, iafPorts[0].portId.attachId, iafPorts[0].portId.portNumber, + result, physicalSubDeviceId); return ZE_RESULT_ERROR_UNKNOWN; } } @@ -170,11 +170,11 @@ ze_result_t FabricSubDeviceIaf::getConnection(IafPort &port, FabricPortConnectio IafPortState iafPortState = {}; ze_result_t result = pIafNlApi->fPortStatusQuery(port.portId, iafPortState); if (result != ZE_RESULT_SUCCESS) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "fPortStatusQuery Unsuccessful: %s\n", result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "fPortStatusQuery Unsuccessful: %s\n", result); return result; } if (iafPortState.healthStatus != IAF_FPORT_HEALTH_HEALTHY) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "IAF PORT not Healthy%s\n", ""); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "IAF PORT not Healthy%s\n", ""); return ZE_RESULT_ERROR_UNKNOWN; } diff --git a/level_zero/core/source/gen12lp/cmdlist_gen12lp.cpp b/level_zero/core/source/gen12lp/cmdlist_gen12lp.cpp index ca114d4b77..13fd691886 100644 --- a/level_zero/core/source/gen12lp/cmdlist_gen12lp.cpp +++ b/level_zero/core/source/gen12lp/cmdlist_gen12lp.cpp @@ -187,7 +187,7 @@ ze_result_t CommandListCoreFamily::appendLaunchKernelWithParams(K if (slmTotalSize > 0 && localMemSize < slmTotalSize) { CREATE_DEBUG_STRING(str, "Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize); driverHandle->setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize); return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY; } diff --git a/level_zero/core/source/kernel/kernel_imp.cpp b/level_zero/core/source/kernel/kernel_imp.cpp index c35ce01f85..ce8b3307ba 100644 --- a/level_zero/core/source/kernel/kernel_imp.cpp +++ b/level_zero/core/source/kernel/kernel_imp.cpp @@ -487,9 +487,9 @@ ze_result_t KernelImp::setGroupSize(uint32_t groupSizeX, uint32_t groupSizeY, const NEO::KernelDescriptor &kernelDescriptor = getImmutableData()->getDescriptor(); if (auto maxGroupSize = module->getMaxGroupSize(kernelDescriptor); itemsInGroup > maxGroupSize) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Requested work-group size (%lu) exceeds maximum value (%u) for the kernel \"%s\" \n", - itemsInGroup, maxGroupSize, kernelDescriptor.kernelMetadata.kernelName.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Requested work-group size (%lu) exceeds maximum value (%u) for the kernel \"%s\" \n", + itemsInGroup, maxGroupSize, kernelDescriptor.kernelMetadata.kernelName.c_str()); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION; } @@ -500,12 +500,12 @@ ze_result_t KernelImp::setGroupSize(uint32_t groupSizeX, uint32_t groupSizeY, for (uint32_t i = 0u; i < 3u; i++) { if (kernelDescriptor.kernelAttributes.requiredWorkgroupSize[i] != 0 && kernelDescriptor.kernelAttributes.requiredWorkgroupSize[i] != this->privateState.groupSize[i]) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Invalid group size {%d, %d, %d} specified, requiredWorkGroupSize = {%d, %d, %d}\n", - this->privateState.groupSize[0], this->privateState.groupSize[1], this->privateState.groupSize[2], - kernelDescriptor.kernelAttributes.requiredWorkgroupSize[0], - kernelDescriptor.kernelAttributes.requiredWorkgroupSize[1], - kernelDescriptor.kernelAttributes.requiredWorkgroupSize[2]); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Invalid group size {%d, %d, %d} specified, requiredWorkGroupSize = {%d, %d, %d}\n", + this->privateState.groupSize[0], this->privateState.groupSize[1], this->privateState.groupSize[2], + kernelDescriptor.kernelAttributes.requiredWorkgroupSize[0], + kernelDescriptor.kernelAttributes.requiredWorkgroupSize[1], + kernelDescriptor.kernelAttributes.requiredWorkgroupSize[2]); return ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION; } } @@ -614,7 +614,7 @@ ze_result_t KernelImp::suggestGroupSize(uint32_t globalSizeX, uint32_t globalSiz CREATE_DEBUG_STRING(str, "Size of SLM (%u) larger than available (%u)\n", this->getSlmTotalSize(), localMemSize); driverHandle->setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", this->getSlmTotalSize(), localMemSize); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", this->getSlmTotalSize(), localMemSize); return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY; } @@ -830,7 +830,7 @@ ze_result_t KernelImp::setArgBuffer(uint32_t argIndex, size_t argSize, const voi NEO::SvmAllocationData *allocData = nullptr; if (argVal != nullptr) { const auto requestedAddress = *reinterpret_cast(argVal); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintL0SetKernelArg.get(), stderr, "set arg buffer index : %u requested address : %p\n", argIndex, requestedAddress); + PRINT_STRING(NEO::debugManager.flags.PrintL0SetKernelArg.get(), stderr, "set arg buffer index : %u requested address : %p\n", argIndex, requestedAddress); if (argInfo.allocId > 0 && argInfo.allocId < NEO::SvmAllocationData::uninitializedAllocId && requestedAddress == argInfo.value) { @@ -1122,7 +1122,7 @@ NEO::GraphicsAllocation *KernelImp::allocatePrivateMemoryGraphicsAllocation() { const auto maxGlobalMemorySize = neoDevice->getRootDevice()->getGlobalMemorySize(static_cast(neoDevice->getDeviceBitfield().to_ulong())); CREATE_DEBUG_STRING(str, "Failed to allocate private surface of %zu bytes, used local memory %zu, max global memory %zu\n", static_cast(privateSurfaceSize), usedLocalMemorySize, static_cast(maxGlobalMemorySize)); neoDevice->getRootDeviceEnvironment().executionEnvironment.setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, str.get()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, str.get()); } return privateMemoryGraphicsAllocation; @@ -1179,7 +1179,7 @@ ze_result_t KernelImp::initialize(const ze_kernel_desc_t *desc) { if (slmInlineSize > 0 && localMemSize < slmInlineSize) { CREATE_DEBUG_STRING(str, "Size of SLM (%u) larger than available (%u)\n", slmInlineSize, localMemSize); module->getDevice()->getDriverHandle()->setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", slmInlineSize, localMemSize); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", slmInlineSize, localMemSize); return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY; } diff --git a/level_zero/core/source/memory/cpu_page_fault_memory_manager.cpp b/level_zero/core/source/memory/cpu_page_fault_memory_manager.cpp index a43f09d1b6..99a3642318 100644 --- a/level_zero/core/source/memory/cpu_page_fault_memory_manager.cpp +++ b/level_zero/core/source/memory/cpu_page_fault_memory_manager.cpp @@ -80,7 +80,7 @@ void transferAndUnprotectMemoryWithHints(NEO::CpuPageFaultManager *pageFaultHand long long elapsedTime = std::chrono::duration_cast(end - start).count(); pageFaultData.unifiedMemoryManager->nonGpuDomainAllocs.push_back(allocPtr); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintUmdSharedMigration.get(), stdout, "UMD transferred shared allocation 0x%llx (%zu B) from GPU to CPU (%f us)\n", reinterpret_cast(allocPtr), pageFaultData.size, elapsedTime / 1e3); + PRINT_STRING(NEO::debugManager.flags.PrintUmdSharedMigration.get(), stdout, "UMD transferred shared allocation 0x%llx (%zu B) from GPU to CPU (%f us)\n", reinterpret_cast(allocPtr), pageFaultData.size, elapsedTime / 1e3); } } if (migration) { diff --git a/level_zero/core/source/module/module_imp.cpp b/level_zero/core/source/module/module_imp.cpp index 08b558a37b..f53f2af796 100644 --- a/level_zero/core/source/module/module_imp.cpp +++ b/level_zero/core/source/module/module_imp.cpp @@ -347,12 +347,12 @@ ze_result_t ModuleTranslationUnit::createFromNativeBinary(const char *input, siz decodeErrors, decodeWarnings); const auto driverHandle = static_cast(device->getDriverHandle()); if (decodeWarnings.empty() == false) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeWarnings.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeWarnings.c_str()); } if (singleDeviceBinary.intermediateRepresentation.empty() && singleDeviceBinary.deviceBinary.empty()) { CREATE_DEBUG_STRING(str, "%s\n", decodeErrors.c_str()); driverHandle->setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeErrors.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeErrors.c_str()); return ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; } else { this->irBinary = makeCopy(reinterpret_cast(singleDeviceBinary.intermediateRepresentation.begin()), singleDeviceBinary.intermediateRepresentation.size()); @@ -388,7 +388,7 @@ ze_result_t ModuleTranslationUnit::createFromNativeBinary(const char *input, siz } if (nullptr == this->unpackedDeviceBinary) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", NEO::CompilerWarnings::recompiledFromIr.data()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", NEO::CompilerWarnings::recompiledFromIr.data()); if (!shouldSuppressRebuildWarning) { updateBuildLog(NEO::CompilerWarnings::recompiledFromIr.str()); } @@ -421,13 +421,13 @@ ze_result_t ModuleTranslationUnit::processUnpackedBinary() { auto &gfxCoreHelper = device->getGfxCoreHelper(); std::tie(decodeError, singleDeviceBinaryFormat) = NEO::decodeSingleDeviceBinary(programInfo, binary, decodeErrors, decodeWarnings, gfxCoreHelper); if (decodeWarnings.empty() == false) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeWarnings.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeWarnings.c_str()); } if (NEO::DecodeError::success != decodeError) { CREATE_DEBUG_STRING(str, "%s\n", decodeErrors.c_str()); driverHandle->setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeErrors.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeErrors.c_str()); return ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; } @@ -450,8 +450,8 @@ ze_result_t ModuleTranslationUnit::processUnpackedBinary() { if (slmNeeded > slmAvailable) { CREATE_DEBUG_STRING(str, "Size of SLM (%u) larger than available (%u)\n", static_cast(slmNeeded), static_cast(slmAvailable)); driverHandle->setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", - static_cast(slmNeeded), static_cast(slmAvailable)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", + static_cast(slmNeeded), static_cast(slmAvailable)); return ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; } @@ -1304,7 +1304,7 @@ ze_result_t ModuleImp::getFunctionPointer(const char *pFunctionName, void **pfnF if (!this->isFunctionSymbolExportEnabled) { CREATE_DEBUG_STRING(str, "Function Pointers Not Supported Without Compiler flag %s\n", BuildOptions::enableLibraryCompile.str().c_str()); driverHandle->setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Function Pointers Not Supported Without Compiler flag %s\n", BuildOptions::enableLibraryCompile.str().c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Function Pointers Not Supported Without Compiler flag %s\n", BuildOptions::enableLibraryCompile.str().c_str()); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return ZE_RESULT_ERROR_INVALID_FUNCTION_NAME; @@ -1332,7 +1332,7 @@ ze_result_t ModuleImp::getGlobalPointer(const char *pGlobalName, size_t *pSize, if (!this->isGlobalSymbolExportEnabled) { CREATE_DEBUG_STRING(str, "Global Pointers Not Supported Without Compiler flag %s\n", BuildOptions::enableGlobalVariableSymbols.str().c_str()); driverHandle->setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Global Pointers Not Supported Without Compiler flag %s\n", BuildOptions::enableGlobalVariableSymbols.str().c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Global Pointers Not Supported Without Compiler flag %s\n", BuildOptions::enableGlobalVariableSymbols.str().c_str()); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } driverHandle->clearErrorDescription(); @@ -1404,8 +1404,8 @@ void ModuleImp::checkIfPrivateMemoryPerDispatchIsNeeded() { auto globalMemorySize = neoDevice->getRootDevice()->getGlobalMemorySize(static_cast(deviceBitfield.to_ulong())); auto numSubDevices = deviceBitfield.count(); this->allocatePrivateMemoryPerDispatch = modulePrivateMemorySize * numSubDevices > globalMemorySize; - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Private Memory Per Dispatch %d for modulePrivateMemorySize %zu subDevices %zu globalMemorySize %" PRIu64 "\n", - this->allocatePrivateMemoryPerDispatch, modulePrivateMemorySize, numSubDevices, globalMemorySize); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Private Memory Per Dispatch %d for modulePrivateMemorySize %zu subDevices %zu globalMemorySize %" PRIu64 "\n", + this->allocatePrivateMemoryPerDispatch, modulePrivateMemorySize, numSubDevices, globalMemorySize); } } @@ -1589,7 +1589,7 @@ ze_result_t ModuleImp::performDynamicLink(uint32_t numModules, if (functionSymbolExportEnabledCounter == 0) { CREATE_DEBUG_STRING(str, "Dynamic Link Not Supported Without Compiler flag %s\n", BuildOptions::enableLibraryCompile.str().c_str()); driverHandle->setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Dynamic Link Not Supported Without Compiler flag %s\n", BuildOptions::enableLibraryCompile.str().c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Dynamic Link Not Supported Without Compiler flag %s\n", BuildOptions::enableLibraryCompile.str().c_str()); } return ZE_RESULT_ERROR_MODULE_LINK_FAILURE; } diff --git a/level_zero/core/source/mutable_cmdlist/mutable_cmdlist_hw.inl b/level_zero/core/source/mutable_cmdlist/mutable_cmdlist_hw.inl index 16526ab208..b4e376ffb5 100644 --- a/level_zero/core/source/mutable_cmdlist/mutable_cmdlist_hw.inl +++ b/level_zero/core/source/mutable_cmdlist/mutable_cmdlist_hw.inl @@ -456,17 +456,17 @@ inline ze_result_t MutableCommandListCoreFamily::appendLaunchKern continue; } auto &varDescriptor = variable->getDesc(); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL kernel argument variable %p index %u type %" PRIu8 "\n", variable, index, varDescriptor.type); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL kernel argument variable %p index %u type %" PRIu8 "\n", variable, index, varDescriptor.type); if (varDescriptor.type == VariableType::buffer) { if (residencyContainer[index] != nullptr) { varDescriptor.bufferAlloc = residencyContainer[index]; varDescriptor.argValue = kernelArgInfos[index].value; varDescriptor.bufferGpuAddress = varDescriptor.bufferAlloc->getGpuAddress(); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL kernel argument buffer gpuva %" PRIx64 " ptr value %p\n", varDescriptor.bufferGpuAddress, kernelArgInfos[index].value); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL kernel argument buffer gpuva %" PRIx64 " ptr value %p\n", varDescriptor.bufferGpuAddress, kernelArgInfos[index].value); varDescriptor.state = VariableDescriptor::State::initialized; } else { varDescriptor.argValue = nullptr; - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL kernel argument nullptr buffer\n"); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL kernel argument nullptr buffer\n"); } } } diff --git a/level_zero/core/source/mutable_cmdlist/mutable_cmdlist_imp.cpp b/level_zero/core/source/mutable_cmdlist/mutable_cmdlist_imp.cpp index 89e1d4929b..d0532d5f55 100644 --- a/level_zero/core/source/mutable_cmdlist/mutable_cmdlist_imp.cpp +++ b/level_zero/core/source/mutable_cmdlist/mutable_cmdlist_imp.cpp @@ -157,10 +157,10 @@ ze_result_t MutableCommandListImp::addVariableDispatch(const NEO::KernelDescript return ZE_RESULT_ERROR_INVALID_ARGUMENT; } - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL kernel dispatch parameters variables: group count %p, group size %p, global offset %p\n", groupCount, groupSize, globalOffset); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL initial group count %u %u %u\n", dispatchParams.groupCount[0], dispatchParams.groupCount[1], dispatchParams.groupCount[2]); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL initial group size %u %u %u\n", dispatchParams.groupSize[0], dispatchParams.groupSize[1], dispatchParams.groupSize[2]); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL initial global offset %u %u %u\n", dispatchParams.globalOffset[0], dispatchParams.globalOffset[1], dispatchParams.globalOffset[2]); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL kernel dispatch parameters variables: group count %p, group size %p, global offset %p\n", groupCount, groupSize, globalOffset); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL initial group count %u %u %u\n", dispatchParams.groupCount[0], dispatchParams.groupCount[1], dispatchParams.groupCount[2]); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL initial group size %u %u %u\n", dispatchParams.groupSize[0], dispatchParams.groupSize[1], dispatchParams.groupSize[2]); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL initial global offset %u %u %u\n", dispatchParams.globalOffset[0], dispatchParams.globalOffset[1], dispatchParams.globalOffset[2]); const auto iohCpuBase = reinterpret_cast(base->getCmdContainer().getIndirectHeap(NEO::HeapType::indirectObject)->getCpuBase()); @@ -298,9 +298,9 @@ ze_result_t MutableCommandListImp::parseDispatchedKernel(L0::Kernel *kernel, Mut auto walkerCmd = mutableComputeWalker->getWalkerCmdPointer(); auto walkerCmdOffset = ptrDiff(walkerCmd, base->getCmdContainer().findCpuBaseForCmdBufferAddress(walkerCmd)); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL append kernel name %s from module: %p inline data %d\n", kernelData->kernelName.c_str(), kernelData->module, kernelData->passInlineData); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL append kernel IOH cpu base %p full offset %zx and gpuva %" PRIx64 "\n", ioh->getCpuBase(), kernelFullOffset, ioh->getGraphicsAllocation()->getGpuAddress()); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL append kernel ioh total %zu cross-thread total %zu per-thread total %zu\n", kernelIohSize, currentCrossThreadDataSize, totalPerThreadDataSize); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL append kernel name %s from module: %p inline data %d\n", kernelData->kernelName.c_str(), kernelData->module, kernelData->passInlineData); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL append kernel IOH cpu base %p full offset %zx and gpuva %" PRIx64 "\n", ioh->getCpuBase(), kernelFullOffset, ioh->getGraphicsAllocation()->getGpuAddress()); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL append kernel ioh total %zu cross-thread total %zu per-thread total %zu\n", kernelIohSize, currentCrossThreadDataSize, totalPerThreadDataSize); auto kdPtr = std::make_unique(); dispatches.emplace_back(std::move(kdPtr)); @@ -361,7 +361,7 @@ ze_result_t MutableCommandListImp::parseDispatchedKernel(L0::Kernel *kernel, Mut } ze_result_t MutableCommandListImp::getNextCommandId(const ze_mutable_command_id_exp_desc_t *desc, uint32_t numKernels, ze_kernel_handle_t *phKernels, uint64_t *pCommandId) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL getNextCommandId cmdlist: %p, flags: %u, numKernels: %u\n", this, desc->flags, numKernels); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL getNextCommandId cmdlist: %p, flags: %u, numKernels: %u\n", this, desc->flags, numKernels); AppendKernelMutation nextAppendKernel; AppendEventMutation nextAppendEvents; if (desc->flags == 0) { @@ -398,12 +398,12 @@ ze_result_t MutableCommandListImp::getNextCommandId(const ze_mutable_command_id_ *pCommandId = ++nextCommandId; nextAppendKernelMutable = true; - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL getNextCommandId cmdlist: %p, command id: %" PRIu64 "\n", this, *pCommandId); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL getNextCommandId cmdlist: %p, command id: %" PRIu64 "\n", this, *pCommandId); return ZE_RESULT_SUCCESS; } ze_result_t MutableCommandListImp::updateMutableCommandsExp(const ze_mutable_commands_exp_desc_t *desc) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL updateMutableCommandsExp cmdlist: %p\n", this); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL updateMutableCommandsExp cmdlist: %p\n", this); ze_result_t result = ZE_RESULT_SUCCESS; const void *next = desc->pNext; while (next != nullptr) { @@ -424,8 +424,8 @@ ze_result_t MutableCommandListImp::updateMutableCommandsExp(const ze_mutable_com if (kernelArgDesc.kernelArgumentVariable->getType() == VariableType::buffer) { auto argValue = apiKernelArgumentDesc->pArgValue == nullptr ? nullptr : *reinterpret_cast(apiKernelArgumentDesc->pArgValue); if (kernelArgDesc.kernelArgumentVariable->getDesc().argValue == argValue) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL update kernel arg commandId: %" PRIu64 " argument idx: %u, buffer - same value: %p\n", - apiKernelArgumentDesc->commandId, apiKernelArgumentDesc->argIndex, argValue); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL update kernel arg commandId: %" PRIu64 " argument idx: %u, buffer - same value: %p\n", + apiKernelArgumentDesc->commandId, apiKernelArgumentDesc->argIndex, argValue); next = extendedDesc->pNext; continue; } @@ -439,8 +439,8 @@ ze_result_t MutableCommandListImp::updateMutableCommandsExp(const ze_mutable_com auto varDispatch = kernelArgDesc.kernelArgumentVariable->getInitialVariableDispatch(); cooperativeKernelVariableDispatches.insert(varDispatch); } - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL update kernel arg commandId: %" PRIu64 " argument idx: %u, size: %zu, val: %p\n", - apiKernelArgumentDesc->commandId, apiKernelArgumentDesc->argIndex, apiKernelArgumentDesc->argSize, kernelArgDesc.kernelArgumentVariable->getDesc().argValue); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL update kernel arg commandId: %" PRIu64 " argument idx: %u, size: %zu, val: %p\n", + apiKernelArgumentDesc->commandId, apiKernelArgumentDesc->argIndex, apiKernelArgumentDesc->argSize, kernelArgDesc.kernelArgumentVariable->getDesc().argValue); } if (extendedDesc->stype == ZE_STRUCTURE_TYPE_MUTABLE_GROUP_COUNT_EXP_DESC) { const ze_mutable_group_count_exp_desc_t *groupCountDesc = reinterpret_cast(next); @@ -458,8 +458,8 @@ ze_result_t MutableCommandListImp::updateMutableCommandsExp(const ze_mutable_com auto varDispatch = currentVariables->groupCount->getInitialVariableDispatch(); cooperativeKernelVariableDispatches.insert(varDispatch); } - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL update group count commandId: %" PRIu64 " x: %u y: %u z: %u\n", - groupCountDesc->commandId, groupCountDesc->pGroupCount->groupCountX, groupCountDesc->pGroupCount->groupCountY, groupCountDesc->pGroupCount->groupCountZ); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL update group count commandId: %" PRIu64 " x: %u y: %u z: %u\n", + groupCountDesc->commandId, groupCountDesc->pGroupCount->groupCountX, groupCountDesc->pGroupCount->groupCountY, groupCountDesc->pGroupCount->groupCountZ); } if (extendedDesc->stype == ZE_STRUCTURE_TYPE_MUTABLE_GROUP_SIZE_EXP_DESC) { const ze_mutable_group_size_exp_desc_t *groupSizeDesc = reinterpret_cast(next); @@ -478,8 +478,8 @@ ze_result_t MutableCommandListImp::updateMutableCommandsExp(const ze_mutable_com auto varDispatch = currentVariables->groupSize->getInitialVariableDispatch(); cooperativeKernelVariableDispatches.insert(varDispatch); } - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL update group size commandId: %" PRIu64 " x: %u y: %u z: %u\n", - groupSizeDesc->commandId, groupSizeDesc->groupSizeX, groupSizeDesc->groupSizeY, groupSizeDesc->groupSizeZ); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL update group size commandId: %" PRIu64 " x: %u y: %u z: %u\n", + groupSizeDesc->commandId, groupSizeDesc->groupSizeX, groupSizeDesc->groupSizeY, groupSizeDesc->groupSizeZ); } if (extendedDesc->stype == ZE_STRUCTURE_TYPE_MUTABLE_GLOBAL_OFFSET_EXP_DESC) { const ze_mutable_global_offset_exp_desc_t *globalOffsetDesc = reinterpret_cast(next); @@ -494,8 +494,8 @@ ze_result_t MutableCommandListImp::updateMutableCommandsExp(const ze_mutable_com return result; } this->updatedCommandList = true; - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL update global offset commandId: %" PRIu64 " x: %u y: %u z: %u\n", - globalOffsetDesc->commandId, globalOffsetDesc->offsetX, globalOffsetDesc->offsetY, globalOffsetDesc->offsetZ); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL update global offset commandId: %" PRIu64 " x: %u y: %u z: %u\n", + globalOffsetDesc->commandId, globalOffsetDesc->offsetX, globalOffsetDesc->offsetY, globalOffsetDesc->offsetZ); } next = extendedDesc->pNext; } @@ -512,7 +512,7 @@ ze_result_t MutableCommandListImp::updateMutableCommandsExp(const ze_mutable_com } ze_result_t MutableCommandListImp::updateMutableCommandSignalEventExp(uint64_t commandId, ze_event_handle_t signalEvent) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL updateMutableCommandSignalEventExp cmdlist: %p commandId: %" PRIu64 " new signal event handle: %p\n", this, commandId, signalEvent); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL updateMutableCommandSignalEventExp cmdlist: %p commandId: %" PRIu64 " new signal event handle: %p\n", this, commandId, signalEvent); AppendEventMutation &selectedAppend = this->eventMutations[(commandId - 1)]; if (selectedAppend.signalEvent.eventVariable == nullptr) { return ZE_RESULT_ERROR_INVALID_ARGUMENT; @@ -531,7 +531,7 @@ ze_result_t MutableCommandListImp::updateMutableCommandSignalEventExp(uint64_t c } ze_result_t MutableCommandListImp::updateMutableCommandWaitEventsExp(uint64_t commandId, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL updateMutableCommandWaitEventsExp cmdlist: %p commandId: %" PRIu64 " numWaitEvents: %u\n", this, commandId, numWaitEvents); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL updateMutableCommandWaitEventsExp cmdlist: %p commandId: %" PRIu64 " numWaitEvents: %u\n", this, commandId, numWaitEvents); AppendEventMutation &selectedAppend = this->eventMutations[(commandId - 1)]; if (numWaitEvents > selectedAppend.waitEvents.size()) { return ZE_RESULT_ERROR_INVALID_ARGUMENT; @@ -552,14 +552,14 @@ ze_result_t MutableCommandListImp::updateMutableCommandWaitEventsExp(uint64_t co } else { return retCode; } - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL event number: %u new wait event handle: %p\n", eventNum, waitEventHandle); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL event number: %u new wait event handle: %p\n", eventNum, waitEventHandle); } return ZE_RESULT_SUCCESS; } ze_result_t MutableCommandListImp::updateMutableCommandKernelsExp(uint32_t numKernels, uint64_t *pCommandId, ze_kernel_handle_t *phKernels) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL updateMutableCommandKernelsExp cmdlist: %p numKernels: %u\n", this, numKernels); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL updateMutableCommandKernelsExp cmdlist: %p numKernels: %u\n", this, numKernels); for (uint32_t id = 0; id < numKernels; id++) { auto commandId = pCommandId[id]; auto kernelHandle = toInternalType(phKernels[id]); @@ -668,7 +668,7 @@ ze_result_t MutableCommandListImp::updateMutableCommandKernelsExp(uint32_t numKe updateKernelMemoryPrefetch(*kernel, kernelGroup->getIohForPrefetch(), kernelGroup->getPrefetchCmd(), commandId); this->updatedCommandList = true; - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL kernel number: %u commandId: %" PRIu64 " new kernel handle: %p\n", id, commandId, kernelHandle); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL kernel number: %u commandId: %" PRIu64 " new kernel handle: %p\n", id, commandId, kernelHandle); } return ZE_RESULT_SUCCESS; } diff --git a/level_zero/core/source/mutable_cmdlist/mutable_indirect_data.cpp b/level_zero/core/source/mutable_cmdlist/mutable_indirect_data.cpp index d784dd5fb9..cafa0ca825 100644 --- a/level_zero/core/source/mutable_cmdlist/mutable_indirect_data.cpp +++ b/level_zero/core/source/mutable_cmdlist/mutable_indirect_data.cpp @@ -19,14 +19,14 @@ void MutableIndirectData::setAddress(CrossThreadDataOffset offset, uint64_t addr if (isDefined(offset)) { if (inlineData.begin() != nullptr) { if (offset < inlineData.size()) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL store address value %" PRIx64 " size %zu in inline at offset %" PRIu16 "\n", address, addressSize, offset); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL store address value %" PRIx64 " size %zu in inline at offset %" PRIu16 "\n", address, addressSize, offset); memcpy_s(reinterpret_cast(inlineData.begin() + offset), addressSize, &address, addressSize); } else { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL store address value %" PRIx64 " size %zu in cross-thread minus inline at offset %" PRIu16 "\n", address, addressSize, offset); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL store address value %" PRIx64 " size %zu in cross-thread minus inline at offset %" PRIu16 "\n", address, addressSize, offset); memcpy_s(reinterpret_cast(crossThreadData.begin() + offset - inlineData.size()), addressSize, &address, addressSize); } } else { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL store address value %" PRIx64 " size %zu in cross-thread at offset %" PRIu16 "\n", address, addressSize, offset); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL store address value %" PRIx64 " size %zu in cross-thread at offset %" PRIu16 "\n", address, addressSize, offset); memcpy_s(reinterpret_cast(crossThreadData.begin() + offset), addressSize, &address, addressSize); } } @@ -43,10 +43,10 @@ inline void MutableIndirectData::setIfDefined(const CrossThreadDataOffset (&offs if (offsets[0] < inlineData.size()) { // check if all data fits in inline data if (offsets[0] + sizeToCopy <= inlineData.size()) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL store data in inline at offset %" PRIu16 "\n", offsets[0]); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL store data in inline at offset %" PRIu16 "\n", offsets[0]); memcpy_s(reinterpret_cast(inlineData.begin() + offsets[0]), sizeToCopy, data.data(), sizeToCopy); } else { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL store data in inline split at offset %" PRIu16 "\n", offsets[0]); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL store data in inline split at offset %" PRIu16 "\n", offsets[0]); // data is split between inline and crossthread size_t inlineDataCopySize = inlineData.size() - offsets[0]; memcpy_s(reinterpret_cast(inlineData.begin() + offsets[0]), inlineDataCopySize, data.data(), inlineDataCopySize); @@ -57,23 +57,23 @@ inline void MutableIndirectData::setIfDefined(const CrossThreadDataOffset (&offs } } else { // offset does not start in existing inline, decrease crossthread offset by inline data size - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL store data in cross-thread minus inline at offset %" PRIu16 "\n", offsets[0]); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL store data in cross-thread minus inline at offset %" PRIu16 "\n", offsets[0]); memcpy_s(reinterpret_cast(crossThreadData.begin() + offsets[0] - inlineData.size()), sizeToCopy, data.data(), sizeToCopy); } } else { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL store data in cross-thread at offset %" PRIu16 "\n", offsets[0]); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL store data in cross-thread at offset %" PRIu16 "\n", offsets[0]); memcpy_s(reinterpret_cast(crossThreadData.begin() + offsets[0]), sizeToCopy, data.data(), sizeToCopy); } } } void MutableIndirectData::setLocalWorkSize(std::array localWorkSize) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutation set lws %u %u %u\n", localWorkSize[0], localWorkSize[1], localWorkSize[2]); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutation set lws %u %u %u\n", localWorkSize[0], localWorkSize[1], localWorkSize[2]); setIfDefined(offsets->localWorkSize, localWorkSize); } void MutableIndirectData::setLocalWorkSize2(std::array localWorkSize2) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutation set lws2 %u %u %u\n", localWorkSize2[0], localWorkSize2[1], localWorkSize2[2]); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutation set lws2 %u %u %u\n", localWorkSize2[0], localWorkSize2[1], localWorkSize2[2]); setIfDefined(offsets->localWorkSize2, localWorkSize2); } @@ -82,12 +82,12 @@ void MutableIndirectData::setEnqLocalWorkSize(std::array enqLocalWo } void MutableIndirectData::setGlobalWorkSize(std::array globalWorkSize) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutation set gws %u %u %u\n", globalWorkSize[0], globalWorkSize[1], globalWorkSize[2]); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutation set gws %u %u %u\n", globalWorkSize[0], globalWorkSize[1], globalWorkSize[2]); setIfDefined(offsets->globalWorkSize, globalWorkSize); } void MutableIndirectData::setNumWorkGroups(std::array numWorkGroups) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutation set num wgs %u %u %u\n", numWorkGroups[0], numWorkGroups[1], numWorkGroups[2]); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutation set num wgs %u %u %u\n", numWorkGroups[0], numWorkGroups[1], numWorkGroups[2]); setIfDefined(offsets->numWorkGroups, numWorkGroups); } @@ -111,7 +111,7 @@ void MutableIndirectData::setGlobalWorkOffset(std::array globalWork void MutableIndirectData::setPerThreadData(ArrayRef perThreadData) { UNRECOVERABLE_IF(this->perThreadData.size() < perThreadData.size()); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL copy local IDs into per-thread %p\n", this->perThreadData.begin()); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL copy local IDs into per-thread %p\n", this->perThreadData.begin()); memcpy_s(this->perThreadData.begin(), this->perThreadData.size(), perThreadData.begin(), perThreadData.size()); } diff --git a/level_zero/core/source/mutable_cmdlist/mutable_kernel.cpp b/level_zero/core/source/mutable_cmdlist/mutable_kernel.cpp index 4c8084627f..219908eae0 100644 --- a/level_zero/core/source/mutable_cmdlist/mutable_kernel.cpp +++ b/level_zero/core/source/mutable_cmdlist/mutable_kernel.cpp @@ -161,8 +161,8 @@ bool MutableKernel::checkKernelCompatible() { useStackCalls || privateMemoryPerDispatch; if (usesUnsupportedFeature) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL MutableKernel compatible property requiresImplicitArgs: %d, usesPrintf: %d, useStackCalls: %d, privateMemoryPerDispatch: %d\n", - requiresImplicitArgs, usesPrintf, useStackCalls, privateMemoryPerDispatch); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL MutableKernel compatible property requiresImplicitArgs: %d, usesPrintf: %d, useStackCalls: %d, privateMemoryPerDispatch: %d\n", + requiresImplicitArgs, usesPrintf, useStackCalls, privateMemoryPerDispatch); return false; } return true; diff --git a/level_zero/core/source/mutable_cmdlist/variable.cpp b/level_zero/core/source/mutable_cmdlist/variable.cpp index a4fbf4b12c..58ff16a5ca 100644 --- a/level_zero/core/source/mutable_cmdlist/variable.cpp +++ b/level_zero/core/source/mutable_cmdlist/variable.cpp @@ -186,8 +186,8 @@ ze_result_t Variable::addKernelArgUsage(const NEO::ArgDescriptor &kernelArg, Ind if (arg.stateless < mutableComputeWalker->getInlineDataSize()) { bufferUsages.commandBufferOffsets.push_back(walkerCmdOffset + mutableComputeWalker->getInlineDataOffset() + arg.stateless); auto walkerInlineFullOffset = reinterpret_cast(mutableComputeWalker->getInlineDataPointer()) + arg.stateless; - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured buffer kernel arg patchlist inline %zx stateless offset %" PRIu16 "\n", - walkerInlineFullOffset, arg.stateless); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured buffer kernel arg patchlist inline %zx stateless offset %" PRIu16 "\n", + walkerInlineFullOffset, arg.stateless); bufferUsages.commandBufferWithoutOffset.push_back(walkerInlineFullOffset); } else { auto statelessOffset = arg.stateless - mutableComputeWalker->getInlineDataSize(); @@ -195,16 +195,16 @@ ze_result_t Variable::addKernelArgUsage(const NEO::ArgDescriptor &kernelArg, Ind IndirectObjectHeapOffset iohFullStatelessOffset = iohFullOffset + statelessOffset; bufferUsages.statelessWithoutOffset.push_back(iohFullStatelessOffset); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured buffer kernel arg patchlist heap decreased by inline %zx stateless offset %" PRIu16 " decreased %zu\n", - iohFullStatelessOffset, arg.stateless, statelessOffset); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured buffer kernel arg patchlist heap decreased by inline %zx stateless offset %" PRIu16 " decreased %zu\n", + iohFullStatelessOffset, arg.stateless, statelessOffset); } } else { bufferUsages.statelessIndirect.push_back(iohOffset + arg.stateless); IndirectObjectHeapOffset iohFullStatelessOffset = iohFullOffset + arg.stateless; bufferUsages.statelessWithoutOffset.push_back(iohFullStatelessOffset); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured buffer kernel arg patchlist heap %zx stateless offset %" PRIu16 "\n", - iohFullStatelessOffset, arg.stateless); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured buffer kernel arg patchlist heap %zx stateless offset %" PRIu16 "\n", + iohFullStatelessOffset, arg.stateless); } } @@ -229,8 +229,8 @@ ze_result_t Variable::addKernelArgUsage(const NEO::ArgDescriptor &kernelArg, Ind if (arg.slmOffset < mutableComputeWalker->getInlineDataSize()) { bufferUsages.commandBufferOffsets.push_back(walkerCmdOffset + mutableComputeWalker->getInlineDataOffset() + arg.slmOffset); auto walkerInlineFullOffset = reinterpret_cast(mutableComputeWalker->getInlineDataPointer()) + arg.slmOffset; - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured slm kernel arg patchlist inline %zx slm offset %" PRIu16 "\n", - walkerInlineFullOffset, arg.slmOffset); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured slm kernel arg patchlist inline %zx slm offset %" PRIu16 "\n", + walkerInlineFullOffset, arg.slmOffset); bufferUsages.commandBufferWithoutOffset.push_back(walkerInlineFullOffset); } else { auto slmOffset = arg.slmOffset - mutableComputeWalker->getInlineDataSize(); @@ -238,16 +238,16 @@ ze_result_t Variable::addKernelArgUsage(const NEO::ArgDescriptor &kernelArg, Ind IndirectObjectHeapOffset iohFullSlmOffset = iohFullOffset + slmOffset; bufferUsages.statelessWithoutOffset.push_back(iohFullSlmOffset); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured slm kernel arg patchlist heap decreased by inline %zx slm offset %" PRIu16 " decreased %zu\n", - iohFullSlmOffset, arg.slmOffset, slmOffset); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured slm kernel arg patchlist heap decreased by inline %zx slm offset %" PRIu16 " decreased %zu\n", + iohFullSlmOffset, arg.slmOffset, slmOffset); } } else { bufferUsages.statelessIndirect.push_back(iohOffset + arg.slmOffset); IndirectObjectHeapOffset iohFullSlmOffset = iohFullOffset + arg.slmOffset; bufferUsages.statelessWithoutOffset.push_back(iohFullSlmOffset); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured buffer slm kernel arg patchlist heap %zx slm offset %" PRIu16 "\n", - iohFullSlmOffset, arg.slmOffset); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured buffer slm kernel arg patchlist heap %zx slm offset %" PRIu16 "\n", + iohFullSlmOffset, arg.slmOffset); } } } break; @@ -272,7 +272,7 @@ ze_result_t Variable::addKernelArgUsageImmediateAsChunk(const NEO::ArgDescriptor fullSize = valueChunk.sourceOffset + chunkSize; - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured value kernel arg chunk source offset %zu size %zu start offset %zu\n", valueChunk.sourceOffset, chunkSize, startOffset); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured value kernel arg chunk source offset %zu size %zu start offset %zu\n", valueChunk.sourceOffset, chunkSize, startOffset); if (inlineData) { auto inlineSize = mutableComputeWalker->getInlineDataSize(); @@ -281,8 +281,8 @@ ze_result_t Variable::addKernelArgUsageImmediateAsChunk(const NEO::ArgDescriptor valueChunk.commandBufferUsageIndex = valueUsages.commandBufferWithoutOffset.size(); auto walkerInlineFullOffset = reinterpret_cast(mutableComputeWalker->getInlineDataPointer()) + startOffset; valueUsages.commandBufferWithoutOffset.push_back(walkerInlineFullOffset); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured value kernel arg cmdbuffer patchlist full offset %zx stateless offset %zu\n", - walkerInlineFullOffset, startOffset); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured value kernel arg cmdbuffer patchlist full offset %zx stateless offset %zu\n", + walkerInlineFullOffset, startOffset); valueUsages.commandBufferOffsets.push_back(walkerCmdOffset + mutableComputeWalker->getInlineDataOffset() + startOffset); // check immediate variable fits fully in inline @@ -302,8 +302,8 @@ ze_result_t Variable::addKernelArgUsageImmediateAsChunk(const NEO::ArgDescriptor size_t heapSize = (startOffset + chunkSize) - inlineSize; valueUsages.statelessIndirectPatchSize.push_back(heapSize); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured value kernel arg partial heap patchlist full offset %zx\n", - iohFullOffset); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured value kernel arg partial heap patchlist full offset %zx\n", + iohFullOffset); } } else { // immediate fits only in cross-thread, just decrease start offset by inline size @@ -315,8 +315,8 @@ ze_result_t Variable::addKernelArgUsageImmediateAsChunk(const NEO::ArgDescriptor valueUsages.statelessIndirect.push_back(iohOffset + startOffset); valueUsages.statelessIndirectPatchSize.push_back(chunkSize); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured value kernel arg - inline - heap patchlist full offset %zx stateless offset %zu\n", - (iohFullOffset + startOffset), startOffset); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured value kernel arg - inline - heap patchlist full offset %zx stateless offset %zu\n", + (iohFullOffset + startOffset), startOffset); } } else { // no inline in kernel, no need to decrease start offset @@ -326,8 +326,8 @@ ze_result_t Variable::addKernelArgUsageImmediateAsChunk(const NEO::ArgDescriptor valueUsages.statelessIndirect.push_back(iohOffset + startOffset); valueUsages.statelessIndirectPatchSize.push_back(chunkSize); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured value kernel arg - clean - heap patchlist full offset %zx stateless offset %zu\n", - (iohFullOffset + startOffset), startOffset); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL captured value kernel arg - clean - heap patchlist full offset %zx stateless offset %zu\n", + (iohFullOffset + startOffset), startOffset); } } @@ -398,12 +398,12 @@ ze_result_t Variable::setBufferVariable(size_t size, const void *argVal) { desc.bufferGpuAddress = gpuAddress; desc.argValue = argValue; - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutate kernel argument variable %p buffer gpuva %" PRIx64 " arg value %p from allocation %p\n", - this, gpuAddress, argValue, newBufferAlloc); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutate kernel argument variable %p buffer gpuva %" PRIx64 " arg value %p from allocation %p\n", + this, gpuAddress, argValue, newBufferAlloc); if (bufferUsages.statelessWithoutOffset.size() > 0) { for (const auto statelessPatch : bufferUsages.statelessWithoutOffset) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL patching kernel argument buffer into heap offset %zx\n", statelessPatch); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL patching kernel argument buffer into heap offset %zx\n", statelessPatch); memcpy_s(reinterpret_cast(statelessPatch), sizeof(GpuAddress), &gpuAddress, sizeof(GpuAddress)); } } else { @@ -415,7 +415,7 @@ ze_result_t Variable::setBufferVariable(size_t size, const void *argVal) { if (bufferUsages.commandBufferWithoutOffset.size() > 0) { for (const auto csPatch : bufferUsages.commandBufferWithoutOffset) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL patching kernel argument buffer into inline data cmd buffer offset %zx\n", csPatch); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL patching kernel argument buffer into inline data cmd buffer offset %zx\n", csPatch); memcpy_s(reinterpret_cast(csPatch), sizeof(GpuAddress), &gpuAddress, sizeof(GpuAddress)); } } else { @@ -795,8 +795,8 @@ bool Variable::isCooperativeVariable() const { } ze_result_t Variable::setSlmBufferVariable(size_t size, const void *argVal) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutate kernel slm argument variable %p new size %u, old size %u\n", - this, size, this->slmValue.slmSize); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutate kernel slm argument variable %p new size %u, old size %u\n", + this, size, this->slmValue.slmSize); if (this->slmValue.slmSize != static_cast(size)) { this->slmValue.slmSize = static_cast(size); @@ -811,15 +811,15 @@ void Variable::setNextSlmVariableOffset(SlmOffset nextSlmOffset) { SlmOffset alignedNewOffset = alignUp(nextSlmOffset, this->slmValue.slmAlignment); bool patchSlmOffset = alignedNewOffset != this->slmValue.slmOffsetValue; - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutate kernel slm argument variable %p new slm offset %u, old slm offset %u\n", - this, alignedNewOffset, this->slmValue.slmOffsetValue); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutate kernel slm argument variable %p new slm offset %u, old slm offset %u\n", + this, alignedNewOffset, this->slmValue.slmOffsetValue); if (patchSlmOffset) { auto &commandContainer = cmdList->getBase()->getCmdContainer(); if (bufferUsages.statelessWithoutOffset.size() > 0) { for (const auto statelessPatch : bufferUsages.statelessWithoutOffset) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL patching kernel slm argument buffer into heap offset %zx\n", statelessPatch); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL patching kernel slm argument buffer into heap offset %zx\n", statelessPatch); *reinterpret_cast(statelessPatch) = alignedNewOffset; } } else { @@ -831,7 +831,7 @@ void Variable::setNextSlmVariableOffset(SlmOffset nextSlmOffset) { if (bufferUsages.commandBufferWithoutOffset.size() > 0) { for (const auto csPatch : bufferUsages.commandBufferWithoutOffset) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL patching kernel slm argument into inline data cmd buffer offset %zx\n", csPatch); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL patching kernel slm argument into inline data cmd buffer offset %zx\n", csPatch); *reinterpret_cast(csPatch) = alignedNewOffset; } } else { @@ -856,8 +856,8 @@ void Variable::processVariableDispatchForSlm() { vd->setSlmSize(slmArgsTotalSize, *cmdList->getBase()->getDevice()->getNEODevice(), desc.isStageCommit); } setCommitVariable(); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutate kernel slm argument variable %p aligned total arg size %u\n", - this, slmArgsTotalSize); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutate kernel slm argument variable %p aligned total arg size %u\n", + this, slmArgsTotalSize); } } diff --git a/level_zero/core/source/mutable_cmdlist/variable_dispatch.cpp b/level_zero/core/source/mutable_cmdlist/variable_dispatch.cpp index e64a21d261..cd1cca85b2 100644 --- a/level_zero/core/source/mutable_cmdlist/variable_dispatch.cpp +++ b/level_zero/core/source/mutable_cmdlist/variable_dispatch.cpp @@ -128,11 +128,11 @@ void VariableDispatch::setGroupSize(const uint32_t groupSize[3], NEO::Device &de } this->localIdGenerationByRuntime = requiresLocalIdGeneration(this->totalLwsSize, this->walkOrder, device.getRootDeviceEnvironment()); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutation group size variable %p new value %u %u %u totalLws %zu SW generated %d\n", - groupSizeVar, - groupSize[0], groupSize[1], groupSize[2], - this->totalLwsSize, - this->localIdGenerationByRuntime); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutation group size variable %p new value %u %u %u totalLws %zu SW generated %d\n", + groupSizeVar, + groupSize[0], groupSize[1], groupSize[2], + this->totalLwsSize, + this->localIdGenerationByRuntime); if (this->localIdGenerationByRuntime) { generateLocalIds(this->totalLwsSize, device.getRootDeviceEnvironment()); @@ -235,7 +235,7 @@ void VariableDispatch::setGroupCount(const uint32_t groupCount[3], const NEO::De this->threadGroupCount *= this->groupCount[dimension]; } - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutation group count variable %p new value %u %u %u\n", groupCountVar, groupCount[0], groupCount[1], groupCount[2]); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutation group count variable %p new value %u %u %u\n", groupCountVar, groupCount[0], groupCount[1], groupCount[2]); if (kernelDispatch->kernelData->usesSyncBuffer) { auto newSize = NEO::KernelHelper::getSyncBufferSize(this->threadGroupCount); @@ -369,7 +369,7 @@ void VariableDispatch::setGlobalOffset(const uint32_t globalOffset[3]) { this->globalOffset[i] = globalOffset[i]; } - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutation global offset variable %p new value %u %u %u\n", globalOffsetVar, globalOffset[0], globalOffset[1], globalOffset[2]); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutation global offset variable %p new value %u %u %u\n", globalOffsetVar, globalOffset[0], globalOffset[1], globalOffset[2]); indirectData->setGlobalWorkOffset(this->globalOffset); } @@ -379,7 +379,7 @@ void VariableDispatch::setGws() { for (auto dimension = 0u; dimension < numChannels; dimension++) { gws[dimension] = groupSize[dimension] * groupCount[dimension]; } - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutation set gws %u %u %u\n", gws[0], gws[1], gws[2]); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutation set gws %u %u %u\n", gws[0], gws[1], gws[2]); indirectData->setGlobalWorkSize(gws); } @@ -390,7 +390,7 @@ void VariableDispatch::setWorkDim() { } else if (groupCount[1] * groupSize[1] > 1) { workDimensions = 2; } - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutation set work dim %u\n", workDimensions); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL mutation set work dim %u\n", workDimensions); indirectData->setWorkDimensions(workDimensions); } @@ -405,8 +405,8 @@ bool VariableDispatch::requiresLocalIdGeneration(size_t localWorkSize, uint32_t kernelDispatch->kernelData->requiresWorkgroupWalkOrder, outWalkOrder, kernelDispatch->kernelData->simdSize); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL local id generation - requiresWalkOrder %d %" PRIu8 " %" PRIu8 " %" PRIu8 " simd %" PRIu8 " outWalkOrder %u num channels\n", - kernelDispatch->kernelData->requiresWorkgroupWalkOrder, kernelWalkOrder[0], kernelWalkOrder[1], kernelWalkOrder[2], kernelDispatch->kernelData->simdSize, outWalkOrder, numChannels); + PRINT_STRING(NEO::debugManager.flags.PrintMclData.get(), stderr, "MCL local id generation - requiresWalkOrder %d %" PRIu8 " %" PRIu8 " %" PRIu8 " simd %" PRIu8 " outWalkOrder %u num channels\n", + kernelDispatch->kernelData->requiresWorkgroupWalkOrder, kernelWalkOrder[0], kernelWalkOrder[1], kernelWalkOrder[2], kernelDispatch->kernelData->simdSize, outWalkOrder, numChannels); return returnCode; } diff --git a/level_zero/core/source/printf_handler/printf_handler.cpp b/level_zero/core/source/printf_handler/printf_handler.cpp index d2764f35ae..4b42140a04 100644 --- a/level_zero/core/source/printf_handler/printf_handler.cpp +++ b/level_zero/core/source/printf_handler/printf_handler.cpp @@ -62,7 +62,7 @@ void PrintfHandler::printOutput(const KernelImmutableData *kernelData, const auto newTaskCount = bcsEngine->commandStreamReceiver->flushBcsTask(blitPropertiesContainer, true, *selectedDevice); if (newTaskCount == NEO::CompletionStamp::gpuHang) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Failed to copy printf buffer.\n", ""); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Failed to copy printf buffer.\n", ""); printfOutputBuffer = static_cast(printfBuffer->getUnderlyingBuffer()); } } diff --git a/level_zero/core/source/rtas/rtas.cpp b/level_zero/core/source/rtas/rtas.cpp index 8663bb231b..28cdf19780 100644 --- a/level_zero/core/source/rtas/rtas.cpp +++ b/level_zero/core/source/rtas/rtas.cpp @@ -217,7 +217,7 @@ ze_result_t DriverHandleImp::loadRTASLibrary() { if (this->rtasLibraryHandle == nullptr || (!rtasExpAvailable && !rtasExtAvailable)) { this->rtasLibraryUnavailable = true; - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Failed to load Ray Tracing Support Library %s\n", L0::rtasLibraryName.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Failed to load Ray Tracing Support Library %s\n", L0::rtasLibraryName.c_str()); return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; } } diff --git a/level_zero/experimental/source/graph/graph_export.cpp b/level_zero/experimental/source/graph/graph_export.cpp index 32b2450921..2ff7310bd0 100644 --- a/level_zero/experimental/source/graph/graph_export.cpp +++ b/level_zero/experimental/source/graph/graph_export.cpp @@ -31,7 +31,7 @@ ze_result_t GraphDotExporter::exportToFile(const Graph &graph, const char *fileP FILE *file = NEO::IoFunctions::fopenPtr(filePath, "w"); if (nullptr == file) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Failed to open file %s for writing graph content\n", filePath); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Failed to open file %s for writing graph content\n", filePath); return ZE_RESULT_ERROR_UNKNOWN; } @@ -40,7 +40,7 @@ ze_result_t GraphDotExporter::exportToFile(const Graph &graph, const char *fileP NEO::IoFunctions::fclosePtr(file); if (bytesWritten != dotContent.size()) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Failed to write graph content to file %s\n", filePath); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Failed to write graph content to file %s\n", filePath); return ZE_RESULT_ERROR_UNKNOWN; } diff --git a/level_zero/sysman/source/api/diagnostics/linux/sysman_os_diagnostics_imp.cpp b/level_zero/sysman/source/api/diagnostics/linux/sysman_os_diagnostics_imp.cpp index cce655de86..bd4c612ccb 100644 --- a/level_zero/sysman/source/api/diagnostics/linux/sysman_os_diagnostics_imp.cpp +++ b/level_zero/sysman/source/api/diagnostics/linux/sysman_os_diagnostics_imp.cpp @@ -60,7 +60,7 @@ ze_result_t LinuxDiagnosticsImp::waitForQuiescentCompletion() { } while (count < 10); result = pSysfsAccess->write(invalidateLmemFile, intVal); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s and returning error:0x%x \n", __FUNCTION__, invalidateLmemFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s and returning error:0x%x \n", __FUNCTION__, invalidateLmemFile.c_str(), result); return result; } return result; @@ -71,17 +71,17 @@ ze_result_t LinuxDiagnosticsImp::osRunDiagTestsinFW(zes_diag_result_t *pResult) pLinuxSysmanImp->releaseSysmanDeviceResources(); ze_result_t result = pLinuxSysmanImp->gpuProcessCleanup(true); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): gpuProcessCleanup() failed and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): gpuProcessCleanup() failed and returning error:0x%x \n", __FUNCTION__, result); return result; } result = waitForQuiescentCompletion(); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): waitForQuiescentCompletion() failed and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): waitForQuiescentCompletion() failed and returning error:0x%x \n", __FUNCTION__, result); return result; } result = pFwInterface->fwRunDiagTests(osDiagType, pResult); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): fwRunDiagTests() failed and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): fwRunDiagTests() failed and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -92,13 +92,13 @@ ze_result_t LinuxDiagnosticsImp::osRunDiagTestsinFW(zes_diag_result_t *pResult) if (*pResult == ZES_DIAG_RESULT_REBOOT_FOR_REPAIR) { result = pLinuxSysmanImp->osColdReset(); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): osColdReset() failed and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): osColdReset() failed and returning error:0x%x \n", __FUNCTION__, result); return result; } } else { result = pLinuxSysmanImp->osWarmReset(); // we need to at least do a Warm reset to bring the machine out of wedged state if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): osWarmReset() failed and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): osWarmReset() failed and returning error:0x%x \n", __FUNCTION__, result); return result; } } @@ -114,7 +114,7 @@ void LinuxDiagnosticsImp::osGetDiagProperties(zes_diag_properties_t *pProperties } ze_result_t LinuxDiagnosticsImp::osGetDiagTests(uint32_t *pCount, zes_diag_test_t *pTests) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/level_zero/sysman/source/api/ecc/sysman_ecc_imp.cpp b/level_zero/sysman/source/api/ecc/sysman_ecc_imp.cpp index 98a7c748e7..a4d43fb180 100644 --- a/level_zero/sysman/source/api/ecc/sysman_ecc_imp.cpp +++ b/level_zero/sysman/source/api/ecc/sysman_ecc_imp.cpp @@ -28,7 +28,7 @@ zes_device_ecc_state_t EccImp::getEccState(uint8_t state) { ze_result_t EccImp::getEccFwUtilInterface(FirmwareUtil *&pFwUtil) { pFwUtil = getFirmwareUtilInterface(pOsSysman); if (pFwUtil == nullptr) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting FirmwareUtilInterface() and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting FirmwareUtilInterface() and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return ZE_RESULT_SUCCESS; @@ -101,7 +101,7 @@ ze_result_t EccImp::setEccState(const zes_device_ecc_desc_t *newState, zes_devic if (pFwInterface == nullptr) { ze_result_t result = getEccFwUtilInterface(pFwInterface); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting EccFwUtilInterface() and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting EccFwUtilInterface() and returning error:0x%x \n", __FUNCTION__, result); return result; } UNRECOVERABLE_IF(pFwInterface == nullptr); @@ -117,13 +117,13 @@ ze_result_t EccImp::setEccState(const zes_device_ecc_desc_t *newState, zes_devic } else if (newState->state == ZES_DEVICE_ECC_STATE_UNAVAILABLE) { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Invalid ecc enumeration and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INVALID_ENUMERATION); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Invalid ecc enumeration and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INVALID_ENUMERATION); return ZE_RESULT_ERROR_INVALID_ENUMERATION; } ze_result_t result = pFwInterface->fwSetEccConfig(state, ¤tState, &pendingState); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set ecc configuration and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set ecc configuration and returning error:0x%x \n", __FUNCTION__, result); return result; } diff --git a/level_zero/sysman/source/api/engine/linux/sysman_os_engine_imp.cpp b/level_zero/sysman/source/api/engine/linux/sysman_os_engine_imp.cpp index 9d1b7424d9..149890b5b6 100644 --- a/level_zero/sysman/source/api/engine/linux/sysman_os_engine_imp.cpp +++ b/level_zero/sysman/source/api/engine/linux/sysman_os_engine_imp.cpp @@ -65,7 +65,7 @@ ze_result_t OsEngine::getNumEngineTypeAndInstances(MapOfEngineInfo &mapEngineInf } if (status == false) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():sysmanQueryEngineInfo is returning false and error message:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():sysmanQueryEngineInfo is returning false and error message:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -136,12 +136,12 @@ void LinuxEngineImp::init(MapOfEngineInfo &mapEngineInfo) { } if (initStatus != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to fetch Pmu Configs \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to fetch Pmu Configs \n", __FUNCTION__); return; } else { if (pmuConfigs.empty()) { initStatus = ZE_RESULT_ERROR_UNKNOWN; - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Pmu Configs Not Available \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Pmu Configs Not Available \n", __FUNCTION__); return; } else { for (auto &config : pmuConfigs) { @@ -153,14 +153,14 @@ void LinuxEngineImp::init(MapOfEngineInfo &mapEngineInfo) { fd = pPmuInterface->pmuInterfaceOpen(config, -1, PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP); } if (fd < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not open Ticks Handle \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not open Ticks Handle \n", __FUNCTION__); initStatus = pSysmanKmdInterface->checkErrorNumberAndReturnStatus(); return; } } else { fd = pPmuInterface->pmuInterfaceOpen(config, static_cast(fdList[0]), PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP); if (fd < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not open Ticks Handle \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not open Ticks Handle \n", __FUNCTION__); for (auto &fd : fdList) { NEO::SysCalls::close(static_cast(fd)); } diff --git a/level_zero/sysman/source/api/events/linux/sysman_os_events_imp.cpp b/level_zero/sysman/source/api/events/linux/sysman_os_events_imp.cpp index 60de003254..cb82b7cc3c 100644 --- a/level_zero/sysman/source/api/events/linux/sysman_os_events_imp.cpp +++ b/level_zero/sysman/source/api/events/linux/sysman_os_events_imp.cpp @@ -37,8 +37,8 @@ ze_result_t LinuxEventsImp::eventRegister(zes_event_type_flags_t events) { auto pLinuxSysmanDriverImp = static_cast(globalSysmanDriver->pOsSysmanDriver); if (pLinuxSysmanDriverImp == nullptr) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "%s", "Os Sysman driver not initialized\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "%s", "Os Sysman driver not initialized\n"); return ZE_RESULT_ERROR_UNINITIALIZED; } pLinuxSysmanDriverImp->eventRegister(events, pLinuxSysmanImp->getSysmanDeviceImp()); @@ -132,8 +132,8 @@ void LinuxEventsUtil::eventRegister(zes_event_type_flags_t events, SysmanDeviceI if ((pipeFd[1] != -1) && (prevRegisteredEvents != deviceEventsMap[pSysmanDevice])) { uint8_t value = 0x00; if (NEO::SysCalls::write(pipeFd[1], &value, 1) < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "%s", "Write to Pipe failed\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "%s", "Write to Pipe failed\n"); } } eventsMutex.unlock(); @@ -273,8 +273,8 @@ void LinuxEventsUtil::getDevIndexToDevPathMap(std::vector(device->deviceGetOsInterface()); if (!osInterface) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "%s", "Failed to get OS Interface\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "%s", "Failed to get OS Interface\n"); UNRECOVERABLE_IF(true); } std::string bdf; @@ -286,16 +286,16 @@ void LinuxEventsUtil::getDevIndexToDevPathMap(std::vector mapOfDevIndexToDevPath = {}; if (pUdevLib == nullptr) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "%s", "libudev library instantiation failed\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "%s", "libudev library instantiation failed\n"); return retval; } @@ -363,8 +363,8 @@ bool LinuxEventsUtil::listenSystemEvents(zes_event_type_flags_t *pEvents, uint32 eventsMutex.lock(); if (NEO::SysCalls::pipe(pipeFd) < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "%s", "Creation of pipe failed\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "%s", "Creation of pipe failed\n"); } pfd[1].fd = pipeFd[0]; diff --git a/level_zero/sysman/source/api/fabric_port/linux/sysman_fabric_device_access_imp.cpp b/level_zero/sysman/source/api/fabric_port/linux/sysman_fabric_device_access_imp.cpp index 628a2e5e81..c4f361a90d 100644 --- a/level_zero/sysman/source/api/fabric_port/linux/sysman_fabric_device_access_imp.cpp +++ b/level_zero/sysman/source/api/fabric_port/linux/sysman_fabric_device_access_imp.cpp @@ -58,7 +58,7 @@ ze_result_t FabricDeviceAccessNl::getState(const zes_fabric_port_id_t portId, ze const IafPortId iafPortId(portId.fabricId, portId.attachId, portId.portNumber); ze_result_t result = pIafNlApi->fPortStatusQuery(iafPortId, iafPortState); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Iaf port status query failed for fabricId : %d, attachId : %d, portnumber : %d and returning error:0x%x \n", __FUNCTION__, iafPortId.fabricId, iafPortId.attachId, iafPortId.portNumber, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Iaf port status query failed for fabricId : %d, attachId : %d, portnumber : %d and returning error:0x%x \n", __FUNCTION__, iafPortId.fabricId, iafPortId.attachId, iafPortId.portNumber, result); return result; } readIafPortStatus(state, iafPortState); @@ -72,7 +72,7 @@ ze_result_t FabricDeviceAccessNl::getState(const zes_fabric_port_id_t portId, ze result = pIafNlApi->fportProperties(iafPortId, guid, portNumber, maxRxSpeed, maxTxSpeed, rxSpeed, txSpeed); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Iaf port properties query failed for fabricId : %d, attachId : %d, portnumber : %d and returning error:0x%x \n", __FUNCTION__, iafPortId.fabricId, iafPortId.attachId, iafPortId.portNumber, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Iaf port properties query failed for fabricId : %d, attachId : %d, portnumber : %d and returning error:0x%x \n", __FUNCTION__, iafPortId.fabricId, iafPortId.attachId, iafPortId.portNumber, result); return result; } readIafPortSpeed(state.rxSpeed, rxSpeed); @@ -117,7 +117,7 @@ ze_result_t FabricDeviceAccessNl::getMultiPortThroughput(std::vectorgetMultiPortThroughPut(iafPortIdList, iafThroughPutList); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to retrieve throughput, Returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to retrieve throughput, Returning error:0x%x \n", __FUNCTION__, result); return result; } zes_fabric_port_throughput_t *throughputArray = *pThroughput; @@ -190,7 +190,7 @@ ze_result_t FabricDeviceAccessNl::getPorts(std::vector &po pLinuxSysmanImp->getSysfsAccess().getRealPath(iafPath, iafRealPath); ze_result_t result = pIafNlApi->getPorts(iafRealPath, iafPorts); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Iaf getPorts query failed to retrieve ports from %s and returning error:0x%x \n", __FUNCTION__, iafRealPath.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Iaf getPorts query failed to retrieve ports from %s and returning error:0x%x \n", __FUNCTION__, iafRealPath.c_str(), result); return result; } diff --git a/level_zero/sysman/source/api/fabric_port/linux/sysman_os_fabric_port_imp.cpp b/level_zero/sysman/source/api/fabric_port/linux/sysman_os_fabric_port_imp.cpp index 944d282b58..a9659e8e23 100644 --- a/level_zero/sysman/source/api/fabric_port/linux/sysman_os_fabric_port_imp.cpp +++ b/level_zero/sysman/source/api/fabric_port/linux/sysman_os_fabric_port_imp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Intel Corporation + * Copyright (C) 2022-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -51,15 +51,15 @@ ze_result_t LinuxFabricDeviceImp::getFabricDevicePath(std::string &fabricDeviceP std::string devicePciPath(""); ze_result_t result = pSysfsAccess->getRealPath("device/", devicePciPath); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } std::vector list; result = pFsAccess->listDirectory(devicePciPath, list); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } @@ -74,8 +74,8 @@ ze_result_t LinuxFabricDeviceImp::getFabricDevicePath(std::string &fabricDeviceP } if (fabricDevicePath.empty()) { // This device does not have a fabric - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__); return ZE_RESULT_ERROR_NOT_AVAILABLE; } return result; @@ -88,16 +88,16 @@ void LinuxFabricDeviceImp::getLinkErrorCount(zes_fabric_port_error_counters_t *p std::string linkFailureFile = fabricLinkErrorPath + "/link_failures"; ze_result_t result = pFsAccess->read(linkFailureFile, linkErrorCount); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, linkFailureFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, linkFailureFile.c_str(), result); linkErrorCount = 0; } uint64_t linkDegradeCount = 0; std::string linkDegradeFile = fabricLinkErrorPath + "/link_degrades"; result = pFsAccess->read(linkDegradeFile, linkDegradeCount); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, linkDegradeFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, linkDegradeFile.c_str(), result); linkDegradeCount = 0; } pErrors->linkFailureCount = linkErrorCount; @@ -111,16 +111,16 @@ void LinuxFabricDeviceImp::getFwErrorCount(zes_fabric_port_error_counters_t *pEr std::string fwErrorFile = fabricFwErrorPath + "/fw_error"; ze_result_t result = pFsAccess->read(fwErrorFile, fwErrorCount); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, fwErrorFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, fwErrorFile.c_str(), result); fwErrorCount = 0; } uint64_t fwCommErrorCount = 0; std::string fwCommErrorFile = fabricFwErrorPath + "/fw_comm_errors"; result = pFsAccess->read(fwCommErrorFile, fwCommErrorCount); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, fwCommErrorFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, fwCommErrorFile.c_str(), result); fwCommErrorCount = 0; } pErrors->fwErrorCount = fwErrorCount; @@ -152,19 +152,19 @@ ze_result_t LinuxFabricDeviceImp::performSweep() { result = forceSweep(); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): forceSweep() failed and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): forceSweep() failed and returning error:0x%x \n", __FUNCTION__, result); return result; } result = routingQuery(start, end); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): routingQuery() failed from %d to %d and returning error:0x%x \n", __FUNCTION__, start, end, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): routingQuery() failed from %d to %d and returning error:0x%x \n", __FUNCTION__, start, end, result); return result; } while (end < start) { uint32_t newStart; result = routingQuery(newStart, end); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): routingQuery() failed from %d to %d and returning error:0x%x \n", __FUNCTION__, newStart, end, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): routingQuery() failed from %d to %d and returning error:0x%x \n", __FUNCTION__, newStart, end, result); return result; } } @@ -212,7 +212,7 @@ ze_result_t LinuxFabricDeviceImp::enable(const zes_fabric_port_id_t portId) { ze_result_t result = ZE_RESULT_SUCCESS; result = pFabricDeviceAccess->enable(portId); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FabricDeviceAccess->enable() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FabricDeviceAccess->enable() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); return result; } return performSweep(); @@ -222,7 +222,7 @@ ze_result_t LinuxFabricDeviceImp::disable(const zes_fabric_port_id_t portId) { ze_result_t result = ZE_RESULT_SUCCESS; result = pFabricDeviceAccess->disable(portId); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FabricDeviceAccess->disable() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FabricDeviceAccess->disable() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); return result; } return performSweep(); @@ -232,7 +232,7 @@ ze_result_t LinuxFabricDeviceImp::enableUsage(const zes_fabric_port_id_t portId) ze_result_t result = ZE_RESULT_SUCCESS; result = pFabricDeviceAccess->enableUsage(portId); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FabricDeviceAccess->enableUsage() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FabricDeviceAccess->enableUsage() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); return result; } return performSweep(); @@ -242,7 +242,7 @@ ze_result_t LinuxFabricDeviceImp::disableUsage(const zes_fabric_port_id_t portId ze_result_t result = ZE_RESULT_SUCCESS; result = pFabricDeviceAccess->disableUsage(portId); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FabricDeviceAccess->disableUsage() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FabricDeviceAccess->disableUsage() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); return result; } return performSweep(); @@ -276,13 +276,13 @@ ze_result_t LinuxFabricPortImp::getConfig(zes_fabric_port_config_t *pConfig) { bool enabled = false; result = pLinuxFabricDeviceImp->getPortEnabledState(portId, enabled); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): LinuxFabricDeviceImp->getPortEnabledState() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): LinuxFabricDeviceImp->getPortEnabledState() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); return result; } pConfig->enabled = enabled == true; result = pLinuxFabricDeviceImp->getPortBeaconState(portId, enabled); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): LinuxFabricDeviceImp->getPortBeaconState() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): LinuxFabricDeviceImp->getPortBeaconState() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); return result; } pConfig->beaconing = enabled == true; diff --git a/level_zero/sysman/source/api/fabric_port/sysman_fabric_port.cpp b/level_zero/sysman/source/api/fabric_port/sysman_fabric_port.cpp index af20de62b1..0bf02c287d 100644 --- a/level_zero/sysman/source/api/fabric_port/sysman_fabric_port.cpp +++ b/level_zero/sysman/source/api/fabric_port/sysman_fabric_port.cpp @@ -59,7 +59,7 @@ ze_result_t FabricPortHandleContext::fabricPortGet(uint32_t *pCount, zes_fabric_ ze_result_t FabricPortHandleContext::fabricPortGetMultiPortThroughput(uint32_t numPorts, zes_fabric_port_handle_t *phPort, zes_fabric_port_throughput_t **pThroughput) { if (!numPorts) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Invalid number of ports \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Invalid number of ports \n", __FUNCTION__); return ZE_RESULT_ERROR_INVALID_ARGUMENT; } diff --git a/level_zero/sysman/source/api/firmware/linux/sysman_os_firmware_imp_helper.cpp b/level_zero/sysman/source/api/firmware/linux/sysman_os_firmware_imp_helper.cpp index 7c28aedef2..d7df04fe77 100644 --- a/level_zero/sysman/source/api/firmware/linux/sysman_os_firmware_imp_helper.cpp +++ b/level_zero/sysman/source/api/firmware/linux/sysman_os_firmware_imp_helper.cpp @@ -31,7 +31,7 @@ ze_result_t LinuxFirmwareImp::getFirmwareVersion(std::string fwType, zes_firmwar ze_result_t result = pSysfsAccess->scanDirEntries(iafPath, list); if (ZE_RESULT_SUCCESS != result) { // There should be a device directory - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to scan directories at %s and returning error:0x%x \n", __FUNCTION__, iafPath.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to scan directories at %s and returning error:0x%x \n", __FUNCTION__, iafPath.c_str(), result); return result; } for (const auto &entry : list) { @@ -42,7 +42,7 @@ ze_result_t LinuxFirmwareImp::getFirmwareVersion(std::string fwType, zes_firmwar } if (path.empty()) { // This device does not have a PSC Version - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): device does not have a PSC version and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): device does not have a PSC version and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } std::string pscVersion; @@ -50,7 +50,7 @@ ze_result_t LinuxFirmwareImp::getFirmwareVersion(std::string fwType, zes_firmwar result = pSysfsAccess->read(path, pscVersion); if (ZE_RESULT_SUCCESS != result) { // not able to read PSC version from iaf.x - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read PSC version from iaf.x at %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read PSC version from iaf.x at %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); return result; } strncpy_s(static_cast(pProperties->version), ZES_STRING_PROPERTY_SIZE, pscVersion.c_str(), ZES_STRING_PROPERTY_SIZE - 1); diff --git a/level_zero/sysman/source/api/frequency/linux/sysman_os_frequency_imp.cpp b/level_zero/sysman/source/api/frequency/linux/sysman_os_frequency_imp.cpp index d0731ec621..44c9a6d1ad 100644 --- a/level_zero/sysman/source/api/frequency/linux/sysman_os_frequency_imp.cpp +++ b/level_zero/sysman/source/api/frequency/linux/sysman_os_frequency_imp.cpp @@ -28,8 +28,8 @@ ze_result_t LinuxFrequencyImp::osFrequencyGetProperties(zes_freq_properties_t &p ze_result_t result2 = getMaxVal(properties.max); // If can't figure out the valid range, then can't control it. if (ZE_RESULT_SUCCESS != result1 || ZE_RESULT_SUCCESS != result2) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result1, result2); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result1, result2); properties.canControl = false; properties.min = 0.0; properties.max = 0.0; @@ -49,15 +49,15 @@ double LinuxFrequencyImp::osFrequencyGetStepSize() { ze_result_t LinuxFrequencyImp::osFrequencyGetRange(zes_freq_range_t *pLimits) { ze_result_t result = getMax(pLimits->max); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pLimits->max = -1; } result = getMin(pLimits->min); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pLimits->min = -1; } return ZE_RESULT_SUCCESS; @@ -80,8 +80,8 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi if (result1 == ZE_RESULT_SUCCESS && result2 == ZE_RESULT_SUCCESS) { result = setMax(maxDefault); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } return setMin(minDefault); @@ -92,16 +92,16 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi double currentMax = 0.0; ze_result_t result = getMax(currentMax); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } if (newMin > currentMax) { // set the max first ze_result_t result = setMax(newMax); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } return setMin(newMin); @@ -110,8 +110,8 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi // set the min first result = setMin(newMin); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } return setMax(newMax); @@ -122,29 +122,29 @@ ze_result_t LinuxFrequencyImp::osFrequencyGetState(zes_freq_state_t *pState) { result = getRequest(pState->request); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->request = -1; } result = getTdp(pState->tdp); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->tdp = -1; } result = getEfficient(pState->efficient); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->efficient = -1; } result = getActual(pState->actual); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->actual = -1; } @@ -210,8 +210,8 @@ ze_result_t LinuxFrequencyImp::getMin(double &min) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, minFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, minFreqFile.c_str(), result); return result; } min = freqVal; @@ -224,8 +224,8 @@ ze_result_t LinuxFrequencyImp::setMin(double min) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, minFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, minFreqFile.c_str(), result); return result; } return ZE_RESULT_SUCCESS; @@ -238,8 +238,8 @@ ze_result_t LinuxFrequencyImp::getMax(double &max) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, maxFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, maxFreqFile.c_str(), result); return result; } max = freqVal; @@ -252,8 +252,8 @@ ze_result_t LinuxFrequencyImp::setMax(double max) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, maxFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, maxFreqFile.c_str(), result); return result; } @@ -272,8 +272,8 @@ ze_result_t LinuxFrequencyImp::getRequest(double &request) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, requestFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, requestFreqFile.c_str(), result); return result; } request = freqVal; @@ -290,8 +290,8 @@ ze_result_t LinuxFrequencyImp::getTdp(double &tdp) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, tdpFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, tdpFreqFile.c_str(), result); return result; } tdp = freqVal; @@ -309,8 +309,8 @@ ze_result_t LinuxFrequencyImp::getActual(double &actual) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, actualFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, actualFreqFile.c_str(), result); return result; } actual = freqVal; @@ -325,8 +325,8 @@ ze_result_t LinuxFrequencyImp::getEfficient(double &efficient) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, efficientFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, efficientFreqFile.c_str(), result); return result; } efficient = freqVal; @@ -341,8 +341,8 @@ ze_result_t LinuxFrequencyImp::getMaxVal(double &maxVal) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, maxValFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, maxValFreqFile.c_str(), result); return result; } maxVal = freqVal; @@ -357,8 +357,8 @@ ze_result_t LinuxFrequencyImp::getMinVal(double &minVal) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, minValFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, minValFreqFile.c_str(), result); return result; } minVal = freqVal; diff --git a/level_zero/sysman/source/api/global_operations/linux/sysman_os_global_operations_imp.cpp b/level_zero/sysman/source/api/global_operations/linux/sysman_os_global_operations_imp.cpp index 9c634ee3c7..7cc7b91573 100644 --- a/level_zero/sysman/source/api/global_operations/linux/sysman_os_global_operations_imp.cpp +++ b/level_zero/sysman/source/api/global_operations/linux/sysman_os_global_operations_imp.cpp @@ -71,7 +71,7 @@ bool LinuxGlobalOperationsImp::getSerialNumber(char (&serialNumber)[ZES_STRING_P memcpy_s(serialNumber, ZES_STRING_PROPERTY_SIZE, telemDataString.str().c_str(), telemDataString.str().size()); return true; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read serial number \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read serial number \n", __FUNCTION__); return false; } @@ -107,7 +107,7 @@ bool LinuxGlobalOperationsImp::getBoardNumber(char (&boardNumber)[ZES_STRING_PRO memcpy_s(boardNumber, ZES_STRING_PROPERTY_SIZE, value.data(), bytesRead); return true; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read board number \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read board number \n", __FUNCTION__); return false; } @@ -289,7 +289,7 @@ void LinuxGlobalOperationsImp::getDriverName(char (&driverVersion)[ZES_STRING_PR if (!version.empty()) { std::strncpy(driverVersion, version.c_str(), ZES_STRING_PROPERTY_SIZE); } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get driver name from drm \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get driver name from drm \n", __FUNCTION__); std::strncpy(driverVersion, unknown.data(), ZES_STRING_PROPERTY_SIZE); } } @@ -309,21 +309,21 @@ ze_result_t LinuxGlobalOperationsImp::resetImpl(ze_bool_t force, zes_reset_type_ auto pSysmanKmdInterface = pLinuxSysmanImp->getSysmanKmdInterface(); if (!pSysfsAccess->isRootUser()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Not running as root user and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Not running as root user and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS); return ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS; } pLinuxSysmanImp->releaseSysmanDeviceResources(); ze_result_t result = pLinuxSysmanImp->gpuProcessCleanup(force); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): gpuProcessCleanup() failed and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): gpuProcessCleanup() failed and returning error:0x%x \n", __FUNCTION__, result); return result; } std::string resetName; result = pSysfsAccess->getRealPath(deviceDir, resetName); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get reset sysfs path and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get reset sysfs path and returning error:0x%x \n", __FUNCTION__, result); return result; } std::string flrPath = resetName + functionLevelReset; @@ -332,7 +332,7 @@ ze_result_t LinuxGlobalOperationsImp::resetImpl(ze_bool_t force, zes_reset_type_ if (resetType == ZES_RESET_TYPE_FLR || resetType == ZES_RESET_TYPE_COLD) { result = pSysfsAccess->unbindDevice(pSysmanKmdInterface->getGpuUnBindEntry(), resetName); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to unbind device:%s and returning error:0x%x \n", __FUNCTION__, resetName.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to unbind device:%s and returning error:0x%x \n", __FUNCTION__, resetName.c_str(), result); return result; } } @@ -340,7 +340,7 @@ ze_result_t LinuxGlobalOperationsImp::resetImpl(ze_bool_t force, zes_reset_type_ std::vector<::pid_t> processes; result = pProcfsAccess->listProcesses(processes); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to list processes and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to list processes and returning error:0x%x \n", __FUNCTION__, result); return result; } std::vector<::pid_t> deviceUsingPids; @@ -367,18 +367,18 @@ ze_result_t LinuxGlobalOperationsImp::resetImpl(ze_bool_t force, zes_reset_type_ if (resetType == ZES_RESET_TYPE_FLR || resetType == ZES_RESET_TYPE_COLD) { result = pSysfsAccess->bindDevice(pSysmanKmdInterface->getGpuBindEntry(), resetName); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to bind the device to the kernel driver and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to bind the device to the kernel driver and returning error:0x%x \n", __FUNCTION__, result); return result; } } result = pLinuxSysmanImp->reInitSysmanDeviceResources(); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to init the device and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to init the device and returning error:0x%x \n", __FUNCTION__, result); return result; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Timeout reached, device still in use and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Timeout reached, device still in use and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE); return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } struct ::timespec timeout = {.tv_sec = 0, .tv_nsec = 1000}; @@ -402,14 +402,14 @@ ze_result_t LinuxGlobalOperationsImp::resetImpl(ze_bool_t force, zes_reset_type_ } if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to reset the device and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to reset the device and returning error:0x%x \n", __FUNCTION__, result); return result; } if (resetType == ZES_RESET_TYPE_FLR || resetType == ZES_RESET_TYPE_COLD) { result = pSysfsAccess->bindDevice(pSysmanKmdInterface->getGpuBindEntry(), resetName); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to bind the device to the kernel driver and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to bind the device to the kernel driver and returning error:0x%x \n", __FUNCTION__, result); return result; } } @@ -472,9 +472,9 @@ ze_result_t LinuxGlobalOperationsImp::getListOfEnginesUsedByProcess(std::vector< std::string engineClass = label.substr(stringPrefix.length()); auto it = sysfsEngineMapToLevel0EngineType.find(engineClass); if (it == sysfsEngineMapToLevel0EngineType.end()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Error@ %s(): unknown engine type: %s and returning error:0x%x \n", __FUNCTION__, label.c_str(), - ZE_RESULT_ERROR_UNKNOWN); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Error@ %s(): unknown engine type: %s and returning error:0x%x \n", __FUNCTION__, label.c_str(), + ZE_RESULT_ERROR_UNKNOWN); DEBUG_BREAK_IF(1); return ZE_RESULT_ERROR_UNKNOWN; } @@ -529,7 +529,7 @@ ze_result_t LinuxGlobalOperationsImp::readClientInfoFromFdInfo(std::map processes; result = pProcfsAccess->listProcesses(processes); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Unable to list processes and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Unable to list processes and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -565,17 +565,17 @@ ze_result_t LinuxGlobalOperationsImp::readClientInfoFromFdInfo(std::map clientIds; ze_result_t result = pSysfsAccess->scanDirEntries(clientsDir, clientIds); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to scan directory entries from %s and returning error:0x%x \n", __FUNCTION__, clientsDir.c_str(), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to scan directory entries from %s and returning error:0x%x \n", __FUNCTION__, clientsDir.c_str(), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -686,7 +686,7 @@ ze_result_t LinuxGlobalOperationsImp::readClientInfoFromSysfs(std::mapread(realClientTotalMemoryPath, memSize); if (ZE_RESULT_SUCCESS != result) { if (ZE_RESULT_ERROR_NOT_AVAILABLE != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read memory size from:%s and returning error:0x%x \n", __FUNCTION__, realClientTotalMemoryPath.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read memory size from:%s and returning error:0x%x \n", __FUNCTION__, realClientTotalMemoryPath.c_str(), result); return result; } } @@ -696,7 +696,7 @@ ze_result_t LinuxGlobalOperationsImp::readClientInfoFromSysfs(std::mapread(realClientTotalSharedMemoryPath, sharedMemSize); if (ZE_RESULT_SUCCESS != result) { if (ZE_RESULT_ERROR_NOT_AVAILABLE != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read shared memory size from:%s and returning error:0x%x \n", __FUNCTION__, realClientTotalSharedMemoryPath.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read shared memory size from:%s and returning error:0x%x \n", __FUNCTION__, realClientTotalSharedMemoryPath.c_str(), result); return result; } } diff --git a/level_zero/sysman/source/api/memory/linux/sysman_os_memory_imp.cpp b/level_zero/sysman/source/api/memory/linux/sysman_os_memory_imp.cpp index bc16e240eb..684b1dd143 100644 --- a/level_zero/sysman/source/api/memory/linux/sysman_os_memory_imp.cpp +++ b/level_zero/sysman/source/api/memory/linux/sysman_os_memory_imp.cpp @@ -67,8 +67,8 @@ ze_result_t LinuxMemoryImp::getState(zes_mem_state_t *pState) { if (errno == ENODEV) { status = ZE_RESULT_ERROR_DEVICE_LOST; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Error@ %s():createMemoryInfo failed errno:%d \n", __FUNCTION__, errno); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Error@ %s():createMemoryInfo failed errno:%d \n", __FUNCTION__, errno); return status; } diff --git a/level_zero/sysman/source/api/pci/linux/sysman_os_pci_imp.cpp b/level_zero/sysman/source/api/pci/linux/sysman_os_pci_imp.cpp index 9ec25ca00c..2fbc8c3e77 100644 --- a/level_zero/sysman/source/api/pci/linux/sysman_os_pci_imp.cpp +++ b/level_zero/sysman/source/api/pci/linux/sysman_os_pci_imp.cpp @@ -54,7 +54,7 @@ ze_result_t LinuxPciImp::getPciBdf(zes_pci_properties_t &pciProperties) { std::string bdfDir; ze_result_t result = pSysfsAccess->readSymLink(deviceDir, bdfDir); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): readSymLink() failed to retrieve BDF from %s and returning error:0x%x \n", __FUNCTION__, deviceDir.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): readSymLink() failed to retrieve BDF from %s and returning error:0x%x \n", __FUNCTION__, deviceDir.c_str(), result); return result; } const auto loc = bdfDir.find_last_of('/'); @@ -123,7 +123,7 @@ ze_result_t LinuxPciImp::initializeBarProperties(std::vector readBytes; ze_result_t result = pSysfsAccess->read(resourceFile, readBytes); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): read() failed to read %s and returning error:0x%x \n", __FUNCTION__, resourceFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): read() failed to read %s and returning error:0x%x \n", __FUNCTION__, resourceFile.c_str(), result); return result; } for (uint32_t i = 0; i <= maxPciBars; i++) { @@ -151,7 +151,7 @@ ze_result_t LinuxPciImp::initializeBarProperties(std::vectorgetRealPath("device/config", pciConfigNode); std::vector configMemory(PCI_CFG_SPACE_EXP_SIZE); if (!getPciConfigMemory(std::move(pciConfigNode), configMemory)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Unable to get pci config space \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Unable to get pci config space \n", __FUNCTION__); return false; } return (L0::Sysman::LinuxPciImp::getRebarCapabilityPos(configMemory.data(), false) > 0); @@ -246,7 +246,7 @@ bool LinuxPciImp::resizableBarEnabled(uint32_t barIndex) { pSysfsAccess->getRealPath("device/config", pciConfigNode); std::vector configMemory(PCI_CFG_SPACE_EXP_SIZE); if (!getPciConfigMemory(std::move(pciConfigNode), configMemory)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Unable to get pci config space \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Unable to get pci config space \n", __FUNCTION__); return false; } @@ -391,17 +391,17 @@ ze_result_t LinuxPciImp::getStats(zes_pci_stats_t *stats) { bool LinuxPciImp::getPciConfigMemory(std::string pciPath, std::vector &configMem) { if (!pSysfsAccess->isRootUser()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Need to be root to read config space \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Need to be root to read config space \n", __FUNCTION__); return false; } auto fd = NEO::FileDescriptor(pciPath.c_str(), O_RDONLY); if (fd < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() Config File Open Failed \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() Config File Open Failed \n", __FUNCTION__); return false; } if (this->preadFunction(fd, configMem.data(), configMem.size(), 0) < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() Config Mem Read Failed \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() Config Mem Read Failed \n", __FUNCTION__); return false; } return true; diff --git a/level_zero/sysman/source/api/performance/linux/sysman_os_performance_imp.cpp b/level_zero/sysman/source/api/performance/linux/sysman_os_performance_imp.cpp index 8fca5a9b0d..38b6437cf9 100644 --- a/level_zero/sysman/source/api/performance/linux/sysman_os_performance_imp.cpp +++ b/level_zero/sysman/source/api/performance/linux/sysman_os_performance_imp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -45,7 +45,7 @@ ze_result_t LinuxPerformanceImp::osPerformanceGetConfig(double *pFactor) { case ZES_ENGINE_TYPE_FLAG_OTHER: result = pSysFsAccess->read(systemPowerBalance, sysPwrBalanceReading); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, systemPowerBalance.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, systemPowerBalance.c_str(), getErrorCode(result)); return getErrorCode(result); } if (sysPwrBalanceReading >= minSysPowerBalanceReading && sysPwrBalanceReading <= defaultSysPowerBalanceReading) { @@ -60,7 +60,7 @@ ze_result_t LinuxPerformanceImp::osPerformanceGetConfig(double *pFactor) { case ZES_ENGINE_TYPE_FLAG_MEDIA: result = pSysFsAccess->read(mediaFreqFactor, mediaFactorReading); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, mediaFreqFactor.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, mediaFreqFactor.c_str(), getErrorCode(result)); return getErrorCode(result); } multiplier = (mediaFactorReading * mediaScaleReading); // Value retrieved from media_freq_factor file is in U(fixed point decimal) format convert it into decimal by multiplication with scale factor @@ -71,7 +71,7 @@ ze_result_t LinuxPerformanceImp::osPerformanceGetConfig(double *pFactor) { } else if (multiplier == 0) { *pFactor = minPerformanceFactor; } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): multiplier for MEDIA is not matching with given presets and returning UNKNOWN ERROR \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): multiplier for MEDIA is not matching with given presets and returning UNKNOWN ERROR \n", __FUNCTION__); result = ZE_RESULT_ERROR_UNKNOWN; } break; @@ -79,7 +79,7 @@ ze_result_t LinuxPerformanceImp::osPerformanceGetConfig(double *pFactor) { case ZES_ENGINE_TYPE_FLAG_COMPUTE: result = pSysFsAccess->read(baseFreqFactor, baseFactorReading); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, baseFreqFactor.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, baseFreqFactor.c_str(), getErrorCode(result)); return getErrorCode(result); } multiplier = (baseFactorReading * baseScaleReading); // Value retrieved from base_freq_factor file is in U(fixed point decimal) format convert it into decimal by multiplication with scale factor @@ -88,13 +88,13 @@ ze_result_t LinuxPerformanceImp::osPerformanceGetConfig(double *pFactor) { } else if (multiplier > 1 && multiplier <= 2) { *pFactor = (2 - multiplier) * halfOfMaxPerformanceFactor; } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): multiplier for COMPUTE is not matching with given presets and returning UNKNOWN ERROR\n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): multiplier for COMPUTE is not matching with given presets and returning UNKNOWN ERROR\n", __FUNCTION__); result = ZE_RESULT_ERROR_UNKNOWN; } break; default: - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE as osPerformanceGetConfig is not supported\n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE as osPerformanceGetConfig is not supported\n", __FUNCTION__); break; } @@ -138,7 +138,7 @@ ze_result_t LinuxPerformanceImp::osPerformanceSetConfig(double perfFactor) { break; default: - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE as osPerformanceSetConfig is not supported\n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE as osPerformanceSetConfig is not supported\n", __FUNCTION__); break; } @@ -161,21 +161,21 @@ bool LinuxPerformanceImp::isPerformanceSupported(void) { switch (domain) { case ZES_ENGINE_TYPE_FLAG_OTHER: if (pSysmanKmdInterface->isSystemPowerBalanceAvailable() == false) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_OTHER returns false as System Power Balance is not Available\n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_OTHER returns false as System Power Balance is not Available\n", __FUNCTION__); return false; } if (pSysFsAccess->canRead(systemPowerBalance) != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_OTHER returns false SysfsAccess->canRead() failed for %s\n", __FUNCTION__, systemPowerBalance.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_OTHER returns false SysfsAccess->canRead() failed for %s\n", __FUNCTION__, systemPowerBalance.c_str()); return false; } break; case ZES_ENGINE_TYPE_FLAG_MEDIA: if (pSysmanKmdInterface->isMediaFrequencyFactorAvailable() == false) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_MEDIA returns false as Media Frequency is not Available\n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_MEDIA returns false as Media Frequency is not Available\n", __FUNCTION__); return false; } if (pSysFsAccess->canRead(mediaFreqFactor) != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_MEDIA returns false as SysfsAccess->canRead() failed for %s\n", __FUNCTION__, mediaFreqFactor.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_MEDIA returns false as SysfsAccess->canRead() failed for %s\n", __FUNCTION__, mediaFreqFactor.c_str()); return false; } if (getMediaFrequencyScaleFactor() != ZE_RESULT_SUCCESS) { @@ -184,11 +184,11 @@ bool LinuxPerformanceImp::isPerformanceSupported(void) { break; case ZES_ENGINE_TYPE_FLAG_COMPUTE: if (pSysmanKmdInterface->isBaseFrequencyFactorAvailable() == false) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_COMPUTE returns false as Base Frequency is not Available\n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_COMPUTE returns false as Base Frequency is not Available\n", __FUNCTION__); return false; } if (pSysFsAccess->canRead(baseFreqFactor) != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_COMPUTE returns false as SysfsAccess->canRead() failed for %s\n", __FUNCTION__, baseFreqFactor.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_COMPUTE returns false as SysfsAccess->canRead() failed for %s\n", __FUNCTION__, baseFreqFactor.c_str()); return false; } if (getBaseFrequencyScaleFactor() != ZE_RESULT_SUCCESS) { diff --git a/level_zero/sysman/source/api/power/linux/sysman_os_power_imp.cpp b/level_zero/sysman/source/api/power/linux/sysman_os_power_imp.cpp index 7970c931b5..4b30bf46de 100644 --- a/level_zero/sysman/source/api/power/linux/sysman_os_power_imp.cpp +++ b/level_zero/sysman/source/api/power/linux/sysman_os_power_imp.cpp @@ -50,7 +50,7 @@ ze_result_t LinuxPowerImp::getDefaultLimit(int32_t &defaultLimit) { uint64_t powerLimit = 0; auto result = pSysfsAccess->read(defaultPowerLimitFile, powerLimit); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), defaultPowerLimitFile.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), defaultPowerLimitFile.c_str(), getErrorCode(result)); return getErrorCode(result); } @@ -87,7 +87,7 @@ ze_result_t LinuxPowerImp::getEnergyCounter(zes_power_energy_counter_t *pEnergy) } if ((result = pSysfsAccess->read(energyCounterNodeFile, pEnergy->energy)) != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), energyCounterNodeFile.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), energyCounterNodeFile.c_str(), getErrorCode(result)); return result; } @@ -107,7 +107,7 @@ ze_result_t LinuxPowerImp::getLimits(zes_power_sustained_limit_t *pSustained, ze val = 0; result = pSysfsAccess->read(sustainedPowerLimitFile, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), sustainedPowerLimitFile.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), sustainedPowerLimitFile.c_str(), getErrorCode(result)); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } pSysmanKmdInterface->convertSysfsValueUnit(SysfsValueUnit::milli, pSysmanKmdInterface->getNativeUnit(SysfsName::sysfsNamePackageSustainedPowerLimit), val, val); @@ -124,7 +124,7 @@ ze_result_t LinuxPowerImp::getLimits(zes_power_sustained_limit_t *pSustained, ze if (pPeak != nullptr) { result = pSysfsAccess->read(criticalPowerLimitFile, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), criticalPowerLimitFile.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), criticalPowerLimitFile.c_str(), getErrorCode(result)); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } pSysmanKmdInterface->convertSysfsValueUnit(SysfsValueUnit::milli, pSysmanKmdInterface->getNativeUnit(SysfsName::sysfsNamePackageCriticalPowerLimit), val, val); @@ -149,7 +149,7 @@ ze_result_t LinuxPowerImp::setLimits(const zes_power_sustained_limit_t *pSustain pSysmanKmdInterface->convertSysfsValueUnit(pSysmanKmdInterface->getNativeUnit(SysfsName::sysfsNamePackageSustainedPowerLimit), SysfsValueUnit::milli, val, val); result = pSysfsAccess->write(sustainedPowerLimitFile, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), sustainedPowerLimitFile.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), sustainedPowerLimitFile.c_str(), getErrorCode(result)); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } } @@ -159,7 +159,7 @@ ze_result_t LinuxPowerImp::setLimits(const zes_power_sustained_limit_t *pSustain pSysmanKmdInterface->convertSysfsValueUnit(pSysmanKmdInterface->getNativeUnit(SysfsName::sysfsNamePackageCriticalPowerLimit), SysfsValueUnit::milli, val, val); result = pSysfsAccess->write(criticalPowerLimitFile, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), criticalPowerLimitFile.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), criticalPowerLimitFile.c_str(), getErrorCode(result)); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } } @@ -168,12 +168,12 @@ ze_result_t LinuxPowerImp::setLimits(const zes_power_sustained_limit_t *pSustain } ze_result_t LinuxPowerImp::getEnergyThreshold(zes_energy_threshold_t *pThreshold) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } ze_result_t LinuxPowerImp::setEnergyThreshold(double threshold) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -200,14 +200,14 @@ ze_result_t LinuxPowerImp::getLimitsExt(uint32_t *pCount, zes_power_limit_ext_de if (sustainedPowerLimitFileExists) { result = pSysfsAccess->read(sustainedPowerLimitFile, powerLimit); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), sustainedPowerLimitFile.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), sustainedPowerLimitFile.c_str(), getErrorCode(result)); sustainedLimitReadSuccess = false; } if (sustainedLimitReadSuccess) { result = pSysfsAccess->read(sustainedPowerLimitIntervalFile, interval); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), sustainedPowerLimitIntervalFile.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), sustainedPowerLimitIntervalFile.c_str(), getErrorCode(result)); sustainedLimitIntervalReadSuccess = false; } } @@ -232,7 +232,7 @@ ze_result_t LinuxPowerImp::getLimitsExt(uint32_t *pCount, zes_power_limit_ext_de powerLimit = 0; result = pSysfsAccess->read(burstPowerLimitFile, powerLimit); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), burstPowerLimitFile.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), burstPowerLimitFile.c_str(), getErrorCode(result)); burstLimitReadSuccess = false; } @@ -240,7 +240,7 @@ ze_result_t LinuxPowerImp::getLimitsExt(uint32_t *pCount, zes_power_limit_ext_de interval = 0; result = pSysfsAccess->read(burstPowerLimitIntervalFile, interval); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), burstPowerLimitIntervalFile.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), burstPowerLimitIntervalFile.c_str(), getErrorCode(result)); burstLimitIntervalReadSuccess = false; } } @@ -265,7 +265,7 @@ ze_result_t LinuxPowerImp::getLimitsExt(uint32_t *pCount, zes_power_limit_ext_de powerLimit = 0; result = pSysfsAccess->read(criticalPowerLimitFile, powerLimit); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), criticalPowerLimitFile.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), criticalPowerLimitFile.c_str(), getErrorCode(result)); return getErrorCode(result); } @@ -297,37 +297,37 @@ ze_result_t LinuxPowerImp::setLimitsExt(uint32_t *pCount, zes_power_limit_ext_de pSysmanKmdInterface->convertSysfsValueUnit(pSysmanKmdInterface->getNativeUnit(SysfsName::sysfsNamePackageSustainedPowerLimit), SysfsValueUnit::milli, val, val); result = pSysfsAccess->write(sustainedPowerLimitFile, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), sustainedPowerLimitFile.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), sustainedPowerLimitFile.c_str(), getErrorCode(result)); return getErrorCode(result); } result = pSysfsAccess->write(sustainedPowerLimitIntervalFile, pLimitExt[i].interval); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), sustainedPowerLimitIntervalFile.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), sustainedPowerLimitIntervalFile.c_str(), getErrorCode(result)); return getErrorCode(result); } } else if (pLimitExt[i].level == ZES_POWER_LEVEL_BURST) { val = pSysmanProductHelper->setPowerLimitValue(pLimitExt[i].limit); result = pSysfsAccess->write(burstPowerLimitFile, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), burstPowerLimitFile.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), burstPowerLimitFile.c_str(), getErrorCode(result)); return getErrorCode(result); } result = pSysfsAccess->write(burstPowerLimitIntervalFile, pLimitExt[i].interval); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), burstPowerLimitIntervalFile.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), burstPowerLimitIntervalFile.c_str(), getErrorCode(result)); return getErrorCode(result); } } else if (pLimitExt[i].level == ZES_POWER_LEVEL_PEAK) { val = pSysmanProductHelper->setPowerLimitValue(pLimitExt[i].limit); result = pSysfsAccess->write(criticalPowerLimitFile, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), criticalPowerLimitFile.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, intelGraphicsHwmonDir.c_str(), criticalPowerLimitFile.c_str(), getErrorCode(result)); return getErrorCode(result); } } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } } diff --git a/level_zero/sysman/source/api/power/windows/sysman_os_power_imp.cpp b/level_zero/sysman/source/api/power/windows/sysman_os_power_imp.cpp index 85bd6de3f2..ebc8ceb615 100644 --- a/level_zero/sysman/source/api/power/windows/sysman_os_power_imp.cpp +++ b/level_zero/sysman/source/api/power/windows/sysman_os_power_imp.cpp @@ -626,8 +626,8 @@ std::vector OsPower::getSupportedPowerDomains(OsSysman *pOsS std::vector powerDomains; if (status != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "No power domains are supported, power handles will not be created.\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "No power domains are supported, power handles will not be created.\n"); } else { uint32_t supportedPowerDomains = 0; memcpy_s(&supportedPowerDomains, sizeof(uint32_t), response.dataBuffer, sizeof(uint32_t)); @@ -641,8 +641,8 @@ std::vector OsPower::getSupportedPowerDomains(OsSysman *pOsS powerDomains.push_back(ZES_POWER_DOMAIN_CARD); break; default: - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Unexpected value returned by KMD. KMD based power handles will not be created.\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Unexpected value returned by KMD. KMD based power handles will not be created.\n"); break; } } diff --git a/level_zero/sysman/source/api/ras/linux/ras_util/sysman_ras_util_pmu.cpp b/level_zero/sysman/source/api/ras/linux/ras_util/sysman_ras_util_pmu.cpp index c96103cbd4..f668e995de 100644 --- a/level_zero/sysman/source/api/ras/linux/ras_util/sysman_ras_util_pmu.cpp +++ b/level_zero/sysman/source/api/ras/linux/ras_util/sysman_ras_util_pmu.cpp @@ -84,7 +84,7 @@ static ze_result_t readI915EventsDirectory(LinuxSysmanImp *pLinuxSysmanImp, std: std::string bdfDir; ze_result_t result = pSysfsAccess->readSymLink(deviceDir, bdfDir); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Symlink from %s and returning error:0x%x \n", __FUNCTION__, deviceDir.c_str(), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Symlink from %s and returning error:0x%x \n", __FUNCTION__, deviceDir.c_str(), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } const auto loc = bdfDir.find_last_of('/'); @@ -98,7 +98,7 @@ static ze_result_t readI915EventsDirectory(LinuxSysmanImp *pLinuxSysmanImp, std: FsAccessInterface *pFsAccess = &pLinuxSysmanImp->getFsAccess(); result = pFsAccess->listDirectory(sysfsNode, listOfEvents); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to list directories from %s and returning error:0x%x \n", __FUNCTION__, sysfsNode.c_str(), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to list directories from %s and returning error:0x%x \n", __FUNCTION__, sysfsNode.c_str(), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return ZE_RESULT_SUCCESS; @@ -258,7 +258,7 @@ ze_result_t PmuRasUtil::getConfig( std::string &pmuConfig) { auto findErrorInList = std::find(listOfEvents.begin(), listOfEvents.end(), errorFileToGetConfig); if (findErrorInList == listOfEvents.end()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to find %s from list of events and returning error:0x%x \n", __FUNCTION__, errorFileToGetConfig.c_str(), ZE_RESULT_ERROR_UNKNOWN); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to find %s from list of events and returning error:0x%x \n", __FUNCTION__, errorFileToGetConfig.c_str(), ZE_RESULT_ERROR_UNKNOWN); return ZE_RESULT_ERROR_UNKNOWN; } return pFsAccess->read(eventDirectory + "/" + errorFileToGetConfig, pmuConfig); diff --git a/level_zero/sysman/source/api/ras/linux/sysman_os_ras_imp.cpp b/level_zero/sysman/source/api/ras/linux/sysman_os_ras_imp.cpp index 8f19f00c22..fe93165bb6 100644 --- a/level_zero/sysman/source/api/ras/linux/sysman_os_ras_imp.cpp +++ b/level_zero/sysman/source/api/ras/linux/sysman_os_ras_imp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -51,7 +51,7 @@ ze_result_t LinuxRasImp::osRasSetConfig(const zes_ras_config_t *config) { memcpy_s(categoryThreshold, maxRasErrorCategoryCount * sizeof(uint64_t), config->detailedThresholds.category, maxRasErrorCategoryCount * sizeof(uint64_t)); return ZE_RESULT_SUCCESS; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Insufficient permissions and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Insufficient permissions and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS); return ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS; } @@ -66,7 +66,7 @@ ze_result_t LinuxRasImp::osRasGetProperties(zes_ras_properties_t &properties) { ze_result_t LinuxRasImp::osRasGetState(zes_ras_state_t &state, ze_bool_t clear) { if (clear == true) { if (pFsAccess->isRootUser() == false) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Insufficient permissions and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Insufficient permissions and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS); return ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS; } } @@ -121,7 +121,7 @@ ze_result_t LinuxRasImp::osRasGetStateExp(uint32_t *pCount, zes_ras_state_exp_t ze_result_t LinuxRasImp::osRasClearStateExp(zes_ras_error_category_exp_t category) { if (pFsAccess->isRootUser() == false) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Insufficient permissions and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Insufficient permissions and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS); return ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS; } diff --git a/level_zero/sysman/source/api/ras/linux/sysman_os_ras_imp_hbm.cpp b/level_zero/sysman/source/api/ras/linux/sysman_os_ras_imp_hbm.cpp index a5c9e40440..690cb086d2 100644 --- a/level_zero/sysman/source/api/ras/linux/sysman_os_ras_imp_hbm.cpp +++ b/level_zero/sysman/source/api/ras/linux/sysman_os_ras_imp_hbm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -27,7 +27,7 @@ void LinuxRasSourceHbm::getSupportedRasErrorTypes(std::set GscRasUtil::getSupportedRasErrorTypes(errorType, pLinuxSysmanImp, isSubDevice, subDeviceId); break; default: - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, "No Supported Ras Error Types for HBM \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, "No Supported Ras Error Types for HBM \n", __FUNCTION__); break; } } diff --git a/level_zero/sysman/source/api/scheduler/linux/sysman_os_scheduler_imp.cpp b/level_zero/sysman/source/api/scheduler/linux/sysman_os_scheduler_imp.cpp index 3527fc99ba..a50d005cc9 100644 --- a/level_zero/sysman/source/api/scheduler/linux/sysman_os_scheduler_imp.cpp +++ b/level_zero/sysman/source/api/scheduler/linux/sysman_os_scheduler_imp.cpp @@ -48,7 +48,7 @@ static ze_result_t readSchedulerValueFromSysfs(SysfsName schedulerSysfsName, if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); return result; } } @@ -87,7 +87,7 @@ static ze_result_t writeSchedulerValueToSysfs(SysfsName schedulerSysfsName, if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write into %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write into %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); return result; } } @@ -100,17 +100,17 @@ ze_result_t LinuxSchedulerImp::getCurrentMode(zes_sched_mode_t *pMode) { uint64_t heartbeat = 0; ze_result_t result = getPreemptTimeout(timeout, false); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get preempt timeout and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } result = getTimesliceDuration(timeslice, false); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get timeslice duration and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get timeslice duration and returning error:0x%x \n", __FUNCTION__, result); return result; } result = getHeartbeatInterval(heartbeat, false); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get heartbeat interval and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get heartbeat interval and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -135,12 +135,12 @@ ze_result_t LinuxSchedulerImp::setExclusiveModeImp() { uint64_t timeslice = 0, timeout = 0, heartbeat = 0; ze_result_t result = setPreemptTimeout(timeout); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } result = setTimesliceDuration(timeslice); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set timeslice duration and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set timeslice duration and returning error:0x%x \n", __FUNCTION__, result); return result; } result = setHeartbeatInterval(heartbeat); @@ -162,7 +162,7 @@ ze_result_t LinuxSchedulerImp::setExclusiveMode(ze_bool_t *pNeedReload) { zes_sched_mode_t currMode; ze_result_t result = getCurrentMode(&currMode); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -170,7 +170,7 @@ ze_result_t LinuxSchedulerImp::setExclusiveMode(ze_bool_t *pNeedReload) { // Unset this mode result = disableComputeUnitDebugMode(pNeedReload); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to disable COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to disable COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); return result; } } @@ -182,7 +182,7 @@ ze_result_t LinuxSchedulerImp::getTimeoutModeProperties(ze_bool_t getDefaults, z uint64_t heartbeat = 0; ze_result_t result = getHeartbeatInterval(heartbeat, getDefaults); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get heart beat interval and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get heart beat interval and returning error:0x%x \n", __FUNCTION__, result); return result; } pConfig->watchdogTimeout = heartbeat; @@ -194,12 +194,12 @@ ze_result_t LinuxSchedulerImp::getTimesliceModeProperties(ze_bool_t getDefaults, uint64_t timeout = 0, timeslice = 0; ze_result_t result = getPreemptTimeout(timeout, getDefaults); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get preempt timeout and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } result = getTimesliceDuration(timeslice, getDefaults); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get timeslice duration and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get timeslice duration and returning error:0x%x \n", __FUNCTION__, result); return result; } pConfig->interval = timeslice; @@ -218,7 +218,7 @@ ze_result_t LinuxSchedulerImp::setTimeoutMode(zes_sched_timeout_properties_t *pP zes_sched_mode_t currMode; ze_result_t result = getCurrentMode(&currMode); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -233,28 +233,28 @@ ze_result_t LinuxSchedulerImp::setTimeoutMode(zes_sched_timeout_properties_t *pP // Unset this mode result = disableComputeUnitDebugMode(pNeedReload); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to disable COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to disable COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); return result; } } result = setHeartbeatInterval(pProperties->watchdogTimeout); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set heartbeat interval and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set heartbeat interval and returning error:0x%x \n", __FUNCTION__, result); return result; } uint64_t timeout = (pProperties->watchdogTimeout) / 5; result = setPreemptTimeout(timeout); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } uint64_t timeslice = 0; result = setTimesliceDuration(timeslice); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set timeslice duration and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set timeslice duration and returning error:0x%x \n", __FUNCTION__, result); return result; } return result; @@ -271,7 +271,7 @@ ze_result_t LinuxSchedulerImp::setTimesliceMode(zes_sched_timeslice_properties_t zes_sched_mode_t currMode; ze_result_t result = getCurrentMode(&currMode); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -279,19 +279,19 @@ ze_result_t LinuxSchedulerImp::setTimesliceMode(zes_sched_timeslice_properties_t // Unset this mode result = disableComputeUnitDebugMode(pNeedReload); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to disable COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to disable COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); return result; } } result = setPreemptTimeout(pProperties->yieldTimeout); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } result = setTimesliceDuration(pProperties->interval); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set timeslice duration and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set timeslice duration and returning error:0x%x \n", __FUNCTION__, result); return result; } uint64_t heartbeat = 2500 * (pProperties->interval); diff --git a/level_zero/sysman/source/api/standby/linux/sysman_os_standby_imp.cpp b/level_zero/sysman/source/api/standby/linux/sysman_os_standby_imp.cpp index 56ca1a4467..cf15be3f12 100644 --- a/level_zero/sysman/source/api/standby/linux/sysman_os_standby_imp.cpp +++ b/level_zero/sysman/source/api/standby/linux/sysman_os_standby_imp.cpp @@ -38,8 +38,8 @@ ze_result_t LinuxStandbyImp::getMode(zes_standby_promo_mode_t &mode) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, standbyModeFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, standbyModeFile.c_str(), result); return result; } if (standbyModeDefault == currentMode) { @@ -48,8 +48,8 @@ ze_result_t LinuxStandbyImp::getMode(zes_standby_promo_mode_t &mode) { mode = ZES_STANDBY_PROMO_MODE_NEVER; } else { result = ZE_RESULT_ERROR_UNKNOWN; - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, currentMode, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, currentMode, result); } return result; } @@ -64,8 +64,8 @@ ze_result_t LinuxStandbyImp::setMode(zes_standby_promo_mode_t mode) { if (ZE_RESULT_ERROR_NOT_AVAILABLE == result) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); } return result; } diff --git a/level_zero/sysman/source/api/vf_management/linux/sysman_os_vf_imp.cpp b/level_zero/sysman/source/api/vf_management/linux/sysman_os_vf_imp.cpp index 361aa68aa2..4b1b09b024 100644 --- a/level_zero/sysman/source/api/vf_management/linux/sysman_os_vf_imp.cpp +++ b/level_zero/sysman/source/api/vf_management/linux/sysman_os_vf_imp.cpp @@ -29,12 +29,12 @@ ze_result_t LinuxVfImp::getVfBDFAddress(uint32_t vfIdMinusOne, zes_pci_address_t std::string vfPath = pathForVfBdf + std::to_string(vfIdMinusOne); ze_result_t result = pSysfsAccess->getRealPath(vfPath, vfRealPath); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get the real path and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get the real path and returning error:0x%x \n", __FUNCTION__, result); return result; } std::size_t loc = vfRealPath.find_last_of("/"); if (loc == std::string::npos) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get the last occurrence of '/' and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get the last occurrence of '/' and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE); return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; } std::string vfBdfString = vfRealPath.substr(loc + 1); @@ -43,7 +43,7 @@ ze_result_t LinuxVfImp::getVfBDFAddress(uint32_t vfIdMinusOne, zes_pci_address_t uint16_t domain = -1; uint8_t bus = -1, device = -1, function = -1; if (NEO::parseBdfString(vfBdfString, domain, bus, device, function) != vfBdfTokensNum) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get the correct token sum and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get the correct token sum and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE); return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; } address->domain = domain; @@ -126,12 +126,12 @@ ze_result_t LinuxVfImp::vfEngineDataInit() { auto hwDeviceId = pLinuxSysmanImp->getSysmanHwDeviceIdInstance(); if (hwDeviceId.getFileDescriptor() < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not get Device Id Fd and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not get Device Id Fd and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } if (pDrm->sysmanQueryEngineInfo() == false) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():sysmanQueryEngineInfo is returning false and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():sysmanQueryEngineInfo is returning false and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -142,7 +142,7 @@ ze_result_t LinuxVfImp::vfEngineDataInit() { std::pair configPair{UINT64_MAX, UINT64_MAX}; auto result = pSysmanKmdInterface->getBusyAndTotalTicksConfigsForVf(pPmuInterface, vfId, engine.second.first, engineClass->second, engine.second.second, configPair); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get the busy config and total ticks config and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get the busy config and total ticks config and returning error:0x%x \n", __FUNCTION__, result); cleanup(); return result; } @@ -150,7 +150,7 @@ ze_result_t LinuxVfImp::vfEngineDataInit() { uint64_t busyTicksConfig = configPair.first; int64_t busyTicksFd = pPmuInterface->pmuInterfaceOpen(busyTicksConfig, -1, PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP); if (busyTicksFd < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not open Busy Ticks Handle and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not open Busy Ticks Handle and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); cleanup(); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -158,7 +158,7 @@ ze_result_t LinuxVfImp::vfEngineDataInit() { uint64_t totalTicksConfig = configPair.second; int64_t totalTicksFd = pPmuInterface->pmuInterfaceOpen(totalTicksConfig, static_cast(busyTicksFd), PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP); if (totalTicksFd < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not open Total Ticks Handle and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not open Total Ticks Handle and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); NEO::SysCalls::close(static_cast(busyTicksFd)); cleanup(); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; @@ -186,7 +186,7 @@ ze_result_t LinuxVfImp::vfOsGetEngineUtilization(uint32_t *pCount, zes_vf_util_e uint32_t engineCount = static_cast(pEngineUtils.size()); if (engineCount == 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): The Total Engine Count Is Zero and hence returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): The Total Engine Count Is Zero and hence returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -205,7 +205,7 @@ ze_result_t LinuxVfImp::vfOsGetEngineUtilization(uint32_t *pCount, zes_vf_util_e uint64_t pmuData[4] = {}; auto ret = pPmuInterface->pmuRead(static_cast(pEngineUtils[i].busyTicksFd), pmuData, sizeof(pmuData)); if (ret < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pmuRead is returning value:%d and error:0x%x \n", __FUNCTION__, ret, ZE_RESULT_ERROR_UNKNOWN); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pmuRead is returning value:%d and error:0x%x \n", __FUNCTION__, ret, ZE_RESULT_ERROR_UNKNOWN); *pCount = 0; return ZE_RESULT_ERROR_UNKNOWN; } @@ -225,7 +225,7 @@ bool LinuxVfImp::vfOsGetLocalMemoryUsed(uint64_t &lMemUsed) { auto result = pSysfsAccess->read(pathForDeviceMemUsed.data(), lMemUsed); if (result != ZE_RESULT_SUCCESS) { lMemUsed = 0; - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Local Memory Used with error 0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Local Memory Used with error 0x%x \n", __FUNCTION__, result); return false; } return true; @@ -266,7 +266,7 @@ uint32_t OsVf::getNumEnabledVfs(OsSysman *pOsSysman) { auto result = pSysfsAccess->read(pathForNumberOfVfs.data(), numberOfVfs); if (result != ZE_RESULT_SUCCESS) { numberOfVfs = 0; - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Number Of Vfs with error 0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Number Of Vfs with error 0x%x \n", __FUNCTION__, result); } return numberOfVfs; } diff --git a/level_zero/sysman/source/driver/linux/sysman_os_driver_imp.cpp b/level_zero/sysman/source/driver/linux/sysman_os_driver_imp.cpp index 2605524bfa..6829272744 100644 --- a/level_zero/sysman/source/driver/linux/sysman_os_driver_imp.cpp +++ b/level_zero/sysman/source/driver/linux/sysman_os_driver_imp.cpp @@ -126,8 +126,8 @@ SysmanDriverHandle *LinuxDriverImp::initSurvivabilityDevicesWithDriver(ze_result pSysmanDriverHandle = createInSurvivabilityMode(std::move(hwSurvivabilityDeviceIds), result); *driverCount = 1; } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "%s\n", "No devices found"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "%s\n", "No devices found"); *result = ZE_RESULT_ERROR_UNINITIALIZED; } diff --git a/level_zero/sysman/source/driver/sysman_driver.cpp b/level_zero/sysman/source/driver/sysman_driver.cpp index 11a9b9baf2..9cac88fb33 100644 --- a/level_zero/sysman/source/driver/sysman_driver.cpp +++ b/level_zero/sysman/source/driver/sysman_driver.cpp @@ -46,8 +46,8 @@ void SysmanDriverImp::initialize(ze_result_t *result) { executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->initOsInterface(std::move(sysmanHwDeviceId), rootDeviceIndex); if (!initStatus) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "OsInterface initialization failed for device : %d\n", rootDeviceIndex); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "OsInterface initialization failed for device : %d\n", rootDeviceIndex); *result = ZE_RESULT_ERROR_UNINITIALIZED; executionEnvironment->decRefInternal(); return; @@ -58,8 +58,8 @@ void SysmanDriverImp::initialize(ze_result_t *result) { globalSysmanDriverHandle = SysmanDriverHandle::create(*executionEnvironment, result); driverCount = 1; } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "%s\n", "No devices found"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "%s\n", "No devices found"); *result = ZE_RESULT_ERROR_UNINITIALIZED; } executionEnvironment->decRefInternal(); diff --git a/level_zero/sysman/source/driver/sysman_driver_handle_imp.cpp b/level_zero/sysman/source/driver/sysman_driver_handle_imp.cpp index 81348e7976..cc0d0a0fb8 100644 --- a/level_zero/sysman/source/driver/sysman_driver_handle_imp.cpp +++ b/level_zero/sysman/source/driver/sysman_driver_handle_imp.cpp @@ -84,7 +84,7 @@ SysmanDevice *SysmanDriverHandleImp::getSysmanDeviceFromCoreDeviceHandle(ze_devi std::string uuid(reinterpret_cast(deviceProperties.uuid.id), ZES_MAX_UUID_SIZE); auto it = uuidDeviceMap.find(uuid); if (it == uuidDeviceMap.end()) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "SysmanDriverHandleImp::getSysmanDeviceFromCoreDeviceHandle() - sysman device handle equivalent to core device handle not found!! %s\n", ""); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "SysmanDriverHandleImp::getSysmanDeviceFromCoreDeviceHandle() - sysman device handle equivalent to core device handle not found!! %s\n", ""); return nullptr; } sysmanDevice = it->second; @@ -151,7 +151,7 @@ SysmanDriverHandle *SysmanDriverHandleImp::getSysmanDriverHandleFromCoreDriverHa uint32_t deviceCount = 0; ze_result_t result = DriverHandle::fromHandle(handle)->getDevice(&deviceCount, nullptr); if (result != ZE_RESULT_SUCCESS || deviceCount == 0) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "failed to get device count for core driver handle\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "failed to get device count for core driver handle\n"); return nullptr; } @@ -168,7 +168,7 @@ SysmanDriverHandle *SysmanDriverHandleImp::getSysmanDriverHandleFromCoreDriverHa uint32_t sysmanDriverCount = 0; result = L0::Sysman::driverHandleGet(&sysmanDriverCount, nullptr); if (result != ZE_RESULT_SUCCESS) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "failed to get sysman driver count\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "failed to get sysman driver count\n"); return nullptr; } @@ -189,7 +189,7 @@ SysmanDriverHandle *SysmanDriverHandleImp::getSysmanDriverHandleFromCoreDriverHa } } - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "No matching sysman driver found for core driver\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "No matching sysman driver found for core driver\n"); return nullptr; } @@ -255,8 +255,8 @@ ze_result_t SysmanDriverHandleImp::getExtensionProperties(uint32_t *pCount, zes_ ze_result_t SysmanDriverHandleImp::sysmanEventsListen(uint32_t timeout, uint32_t count, zes_device_handle_t *phDevices, uint32_t *pNumDeviceEvents, zes_event_type_flags_t *pEvents) { if (pOsSysmanDriver == nullptr) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "%s", "Os Sysman Driver Not initialized\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "%s", "Os Sysman Driver Not initialized\n"); return ZE_RESULT_ERROR_UNINITIALIZED; } return pOsSysmanDriver->eventsListen(timeout, count, phDevices, pNumDeviceEvents, pEvents); @@ -264,8 +264,8 @@ ze_result_t SysmanDriverHandleImp::sysmanEventsListen(uint32_t timeout, uint32_t ze_result_t SysmanDriverHandleImp::sysmanEventsListenEx(uint64_t timeout, uint32_t count, zes_device_handle_t *phDevices, uint32_t *pNumDeviceEvents, zes_event_type_flags_t *pEvents) { if (pOsSysmanDriver == nullptr) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "%s", "Os Sysman Driver Not initialized\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "%s", "Os Sysman Driver Not initialized\n"); return ZE_RESULT_ERROR_UNINITIALIZED; } return pOsSysmanDriver->eventsListen(timeout, count, phDevices, pNumDeviceEvents, pEvents); diff --git a/level_zero/sysman/source/shared/firmware_util/sysman_firmware_util_imp.cpp b/level_zero/sysman/source/shared/firmware_util/sysman_firmware_util_imp.cpp index 584bed3a30..c862bd7267 100644 --- a/level_zero/sysman/source/shared/firmware_util/sysman_firmware_util_imp.cpp +++ b/level_zero/sysman/source/shared/firmware_util/sysman_firmware_util_imp.cpp @@ -80,7 +80,7 @@ void firmwareFlashProgressFunc(uint32_t done, uint32_t total, void *ctx) { uint32_t percent = (done * 100) / total; FirmwareUtilImp *pFirmwareUtilImp = static_cast(ctx); pFirmwareUtilImp->updateFirmwareFlashProgress(percent); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, "Progress: %d/%d:%d/%\n", done, total, percent); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, "Progress: %d/%d:%d/%\n", done, total, percent); } } diff --git a/level_zero/sysman/source/shared/firmware_util/sysman_firmware_util_imp_helper.cpp b/level_zero/sysman/source/shared/firmware_util/sysman_firmware_util_imp_helper.cpp index 5a65062a6e..c1e7b6f349 100644 --- a/level_zero/sysman/source/shared/firmware_util/sysman_firmware_util_imp_helper.cpp +++ b/level_zero/sysman/source/shared/firmware_util/sysman_firmware_util_imp_helper.cpp @@ -75,8 +75,8 @@ ze_result_t FirmwareUtilImp::fwGetMemoryErrorCount(zes_ras_error_type_t type, ui } if (ret != IGSC_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Error@ %s(): Could not retrieve tile count from igsc\n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Error@ %s(): Could not retrieve tile count from igsc\n", __FUNCTION__); // igsc_gfsp_count_tiles returns max tile info rather than actual count, igsc behaves in such a way that // it expects buffer (igsc_gfsp_mem_err) to be allocated for max tile count and not actual tile count. // This is fallback path when igsc_gfsp_count_tiles fails, where buffer for actual tile count is used to @@ -92,14 +92,14 @@ ze_result_t FirmwareUtilImp::fwGetMemoryErrorCount(zes_ras_error_type_t type, ui tiles->num_of_tiles = numOfTiles; // set the number of tiles in the structure that will be passed as a buffer ret = gfspMemoryErrors(&fwDeviceHandle, tiles); if (ret != IGSC_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Error@ %s(): Could not retrieve memory errors from igsc (error:0x%x) \n", __FUNCTION__, ret); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Error@ %s(): Could not retrieve memory errors from igsc (error:0x%x) \n", __FUNCTION__, ret); return ZE_RESULT_ERROR_UNINITIALIZED; } if (tiles->num_of_tiles < subDeviceCount) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Error@ %s(): Inappropriate tile count \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Error@ %s(): Inappropriate tile count \n", __FUNCTION__); return ZE_RESULT_ERROR_UNKNOWN; } if (type == ZES_RAS_ERROR_TYPE_CORRECTABLE) { @@ -140,7 +140,7 @@ void FirmwareUtilImp::fwGetMemoryHealthIndicator(zes_mem_health_t *health) { } } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(); Could not get memory health indicator from igsc\n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(); Could not get memory health indicator from igsc\n", __FUNCTION__); } ze_result_t FirmwareUtilImp::fwGetEccConfig(uint8_t *currentState, uint8_t *pendingState, uint8_t *defaultState) { @@ -255,8 +255,8 @@ ze_result_t FirmwareUtilImp::fwSetGfspConfig(uint32_t gfspHeciCmdCode, std::vect if (ret == IGSC_SUCCESS) { return ZE_RESULT_SUCCESS; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Error@ %s(): Could not successfully call gfspHeciCmd number %x from igsc (error:0x%x) \n", __FUNCTION__, gfspHeciCmdCode, ret); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Error@ %s(): Could not successfully call gfspHeciCmd number %x from igsc (error:0x%x) \n", __FUNCTION__, gfspHeciCmdCode, ret); } return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -271,8 +271,8 @@ ze_result_t FirmwareUtilImp::fwGetGfspConfig(uint32_t gfspHeciCmdCode, std::vect if (ret == IGSC_SUCCESS) { return ZE_RESULT_SUCCESS; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Error@ %s(): Could not successfully call gfspHeciCmd number %x from igsc (error:0x%x) \n", __FUNCTION__, gfspHeciCmdCode, ret); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Error@ %s(): Could not successfully call gfspHeciCmd number %x from igsc (error:0x%x) \n", __FUNCTION__, gfspHeciCmdCode, ret); } return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/level_zero/sysman/source/shared/linux/kmd_interface/sysman_kmd_interface.cpp b/level_zero/sysman/source/shared/linux/kmd_interface/sysman_kmd_interface.cpp index 94028b2b6e..d476de1328 100644 --- a/level_zero/sysman/source/shared/linux/kmd_interface/sysman_kmd_interface.cpp +++ b/level_zero/sysman/source/shared/linux/kmd_interface/sysman_kmd_interface.cpp @@ -62,7 +62,7 @@ ze_result_t SysmanKmdInterface::initFsAccessInterface(const NEO::Drm &drm) { std::string deviceName; auto result = pProcfsAccess->getFileName(pProcfsAccess->myProcessId(), drm.getFileDescriptor(), deviceName); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to device name and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to device name and returning error:0x%x \n", __FUNCTION__, result); return result; } pSysfsAccess = SysFsAccessInterface::create(std::move(deviceName)); @@ -106,9 +106,9 @@ ze_result_t SysmanKmdInterface::getNumEngineTypeAndInstancesForSubDevices(std::m std::string sysfsEngineDirNode = sysfEngineString + std::to_string(engine.engineInstance); auto level0EngineType = sysfsEngineMapToLevel0EngineType.find(sysfEngineString); if (level0EngineType == sysfsEngineMapToLevel0EngineType.end()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Error@ %s(): unknown engine type: %s and returning error:0x%x \n", __FUNCTION__, sysfEngineString.c_str(), - ZE_RESULT_ERROR_UNKNOWN); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Error@ %s(): unknown engine type: %s and returning error:0x%x \n", __FUNCTION__, sysfEngineString.c_str(), + ZE_RESULT_ERROR_UNKNOWN); return ZE_RESULT_ERROR_UNKNOWN; } auto ret = mapOfEngines.find(level0EngineType->second); @@ -131,7 +131,7 @@ ze_result_t SysmanKmdInterface::getNumEngineTypeAndInstancesForDevice(std::strin if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to scan directory entries to list all engines and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to scan directory entries to list all engines and returning error:0x%x \n", __FUNCTION__, result); return result; } for_each(localListOfAllEngines.begin(), localListOfAllEngines.end(), @@ -205,7 +205,7 @@ void SysmanKmdInterface::getWedgedStatusImpl(LinuxSysmanImp *pLinuxSysmanImp, ze ze_result_t SysmanKmdInterface::checkErrorNumberAndReturnStatus() { if (errno == EMFILE || errno == ENFILE) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): System has run out of file handles. Suggested action is to increase the file handle limit. \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): System has run out of file handles. Suggested action is to increase the file handle limit. \n", __FUNCTION__); return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; } return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; diff --git a/level_zero/sysman/source/shared/linux/kmd_interface/sysman_kmd_interface_i915_prelim.cpp b/level_zero/sysman/source/shared/linux/kmd_interface/sysman_kmd_interface_i915_prelim.cpp index a75f6b19a0..70f04d06e8 100644 --- a/level_zero/sysman/source/shared/linux/kmd_interface/sysman_kmd_interface_i915_prelim.cpp +++ b/level_zero/sysman/source/shared/linux/kmd_interface/sysman_kmd_interface_i915_prelim.cpp @@ -144,7 +144,7 @@ ze_result_t SysmanKmdInterfaceI915Prelim::getPmuConfigsForGroupEngines(const Map busyTicksConfig = __PRELIM_I915_PMU_MEDIA_GROUP_BUSY_TICKS(engineInfo.tileId); break; default: - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Engine Group Not Supported and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Engine Group Not Supported and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -179,7 +179,7 @@ ze_result_t SysmanKmdInterfaceI915Prelim::readBusynessFromGroupFd(PmuInterface * auto ret = pPmuInterface->pmuRead(static_cast(fdList[0]), data, sizeof(data)); if (ret < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pmuRead is returning value:%d and error:0x%x \n", __FUNCTION__, ret, ZE_RESULT_ERROR_UNKNOWN); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pmuRead is returning value:%d and error:0x%x \n", __FUNCTION__, ret, ZE_RESULT_ERROR_UNKNOWN); return ZE_RESULT_ERROR_UNKNOWN; } @@ -228,7 +228,7 @@ void SysmanKmdInterfaceI915Prelim::getDriverVersion(char (&driverVersion)[ZES_ST std::string strVal = {}; ze_result_t result = pFsAccess->read(agamaVersionFile, strVal); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read driver version from %s and returning error:0x%x \n", __FUNCTION__, agamaVersionFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read driver version from %s and returning error:0x%x \n", __FUNCTION__, agamaVersionFile.c_str(), result); std::strncpy(driverVersion, unknown.data(), ZES_STRING_PROPERTY_SIZE); } else { std::strncpy(driverVersion, strVal.c_str(), ZES_STRING_PROPERTY_SIZE); diff --git a/level_zero/sysman/source/shared/linux/kmd_interface/sysman_kmd_interface_i915_upstream.cpp b/level_zero/sysman/source/shared/linux/kmd_interface/sysman_kmd_interface_i915_upstream.cpp index f283c023bc..b65381b08e 100644 --- a/level_zero/sysman/source/shared/linux/kmd_interface/sysman_kmd_interface_i915_upstream.cpp +++ b/level_zero/sysman/source/shared/linux/kmd_interface/sysman_kmd_interface_i915_upstream.cpp @@ -139,7 +139,7 @@ ze_result_t SysmanKmdInterfaceI915Upstream::readBusynessFromGroupFd(PmuInterface uint64_t data[2] = {}; auto ret = pPmuInterface->pmuRead(static_cast(fdList[0]), data, sizeof(data)); if (ret < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pmuRead is returning value:%d and error:0x%x \n", __FUNCTION__, ret, ZE_RESULT_ERROR_UNKNOWN); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pmuRead is returning value:%d and error:0x%x \n", __FUNCTION__, ret, ZE_RESULT_ERROR_UNKNOWN); return ZE_RESULT_ERROR_UNKNOWN; } @@ -179,7 +179,7 @@ void SysmanKmdInterfaceI915Upstream::getDriverVersion(char (&driverVersion)[ZES_ std::string strVal = {}; ze_result_t result = pFsAccess->read(srcVersionFile, strVal); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read driver version from %s and returning error:0x%x\n", __FUNCTION__, srcVersionFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read driver version from %s and returning error:0x%x\n", __FUNCTION__, srcVersionFile.c_str(), result); std::strncpy(driverVersion, unknown.data(), ZES_STRING_PROPERTY_SIZE); } else { std::strncpy(driverVersion, strVal.c_str(), ZES_STRING_PROPERTY_SIZE); diff --git a/level_zero/sysman/source/shared/linux/kmd_interface/sysman_kmd_interface_xe.cpp b/level_zero/sysman/source/shared/linux/kmd_interface/sysman_kmd_interface_xe.cpp index bf57fc2b19..d064337ca9 100644 --- a/level_zero/sysman/source/shared/linux/kmd_interface/sysman_kmd_interface_xe.cpp +++ b/level_zero/sysman/source/shared/linux/kmd_interface/sysman_kmd_interface_xe.cpp @@ -194,7 +194,7 @@ static ze_result_t getConfigs(PmuInterface *const &pPmuInterface, auto ret = pPmuInterface->getPmuConfigs(sysmanDeviceDir, engineClass->second, engineInstanceAndTileId.first, gtId, activeTicksConfig, totalTicksConfig); if (ret < 0) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get configs and returning error:0x%x\n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get configs and returning error:0x%x\n", __FUNCTION__, result); return result; } @@ -210,7 +210,7 @@ static ze_result_t getConfigs(PmuInterface *const &pPmuInterface, vfActiveTicksConfig, vfTotalTicksConfig); if (vfRet < 0) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get configs for VF and returning error:0x%x\n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get configs for VF and returning error:0x%x\n", __FUNCTION__, result); return result; } configs.push_back(vfActiveTicksConfig); @@ -228,7 +228,7 @@ static uint32_t getNumberOfEnabledVfs(SysFsAccessInterface *pSysFsAccess) { auto result = pSysFsAccess->read(pathForNumberOfVfs.data(), numberOfVfs); if (result != ZE_RESULT_SUCCESS) { numberOfVfs = 0; - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Number Of Vfs with error 0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Number Of Vfs with error 0x%x \n", __FUNCTION__, result); } return numberOfVfs; } @@ -330,7 +330,7 @@ ze_result_t SysmanKmdInterfaceXe::readBusynessFromGroupFd(PmuInterface *const &p auto ret = pPmuInterface->pmuRead(static_cast(fdList[0]), readData.data(), sizeof(uint64_t) * (dataCount + dataOffset)); if (ret < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pmuRead is returning value:%d and error:0x%x \n", __FUNCTION__, ret, ZE_RESULT_ERROR_UNKNOWN); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pmuRead is returning value:%d and error:0x%x \n", __FUNCTION__, ret, ZE_RESULT_ERROR_UNKNOWN); return ZE_RESULT_ERROR_UNKNOWN; } @@ -384,7 +384,7 @@ void SysmanKmdInterfaceXe::getDriverVersion(char (&driverVersion)[ZES_STRING_PRO std::string strVal = {}; ze_result_t result = pFsAccess->read(srcVersionFile, strVal); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read driver version from %s and returning error:0x%x\n", __FUNCTION__, srcVersionFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read driver version from %s and returning error:0x%x\n", __FUNCTION__, srcVersionFile.c_str(), result); std::strncpy(driverVersion, unknown.data(), ZES_STRING_PROPERTY_SIZE); } else { std::strncpy(driverVersion, strVal.c_str(), ZES_STRING_PROPERTY_SIZE); @@ -405,14 +405,14 @@ ze_result_t SysmanKmdInterfaceXe::getBusyAndTotalTicksConfigsForVf(PmuInterface auto ret = pPmuInterface->getPmuConfigs(sysmanDeviceDir, engineClass, engineInstance, gtId, configPair.first, configPair.second); if (ret < 0) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get configs and returning error:0x%x\n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get configs and returning error:0x%x\n", __FUNCTION__, result); return result; } ret = pPmuInterface->getPmuConfigsForVf(sysmanDeviceDir, fnNumber, configPair.first, configPair.second); if (ret < 0) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get configs for VF and returning error:0x%x\n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get configs for VF and returning error:0x%x\n", __FUNCTION__, result); return result; } diff --git a/level_zero/sysman/source/shared/linux/nl_api/sysman_iaf_nl_api.cpp b/level_zero/sysman/source/shared/linux/nl_api/sysman_iaf_nl_api.cpp index 5beadaf4dc..d4fdcff277 100644 --- a/level_zero/sysman/source/shared/linux/nl_api/sysman_iaf_nl_api.cpp +++ b/level_zero/sysman/source/shared/linux/nl_api/sysman_iaf_nl_api.cpp @@ -730,7 +730,7 @@ ze_result_t IafNlApi::init() { int retval = pNlApi->genlRegisterFamily(&ops); if (-NLE_EXIST == retval) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to register netlink family and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to register netlink family and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } else if (!retval) { nlSock = pNlApi->nlSocketAlloc(); diff --git a/level_zero/sysman/source/shared/linux/pmt/sysman_pmt.cpp b/level_zero/sysman/source/shared/linux/pmt/sysman_pmt.cpp index ea4d6e420f..9f85a5d9b4 100644 --- a/level_zero/sysman/source/shared/linux/pmt/sysman_pmt.cpp +++ b/level_zero/sysman/source/shared/linux/pmt/sysman_pmt.cpp @@ -20,12 +20,12 @@ static const std::string baseTelemSysfs("/sys/class/intel_pmt"); bool PlatformMonitoringTech::getKeyOffsetMap(SysmanProductHelper *pSysmanProductHelper, const std::string &guid, std::map &keyOffsetMap) { auto pGuidToKeyOffsetMap = pSysmanProductHelper->getGuidToKeyOffsetMap(); if (pGuidToKeyOffsetMap == nullptr) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get the pGuidToKeyOffsetMap \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get the pGuidToKeyOffsetMap \n", __FUNCTION__); return false; } auto keyOffsetMapEntry = pGuidToKeyOffsetMap->find(guid); if (keyOffsetMapEntry == pGuidToKeyOffsetMap->end()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to find keyOffset in keyOffsetMap \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to find keyOffset in keyOffsetMap \n", __FUNCTION__); return false; } keyOffsetMap = keyOffsetMapEntry->second; @@ -39,7 +39,7 @@ bool PlatformMonitoringTech::getTelemOffsetAndTelemDir(LinuxSysmanImp *pLinuxSys NEO::PmtUtil::getTelemNodesInPciPath(std::string_view(rootPath), telemPciPath); uint32_t subDeviceCount = pLinuxSysmanImp->getSubDeviceCount() + 1; if (telemPciPath.size() < subDeviceCount) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Number of telemetry nodes:%d is lessthan %d \n", __FUNCTION__, telemPciPath.size(), subDeviceCount); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Number of telemetry nodes:%d is lessthan %d \n", __FUNCTION__, telemPciPath.size(), subDeviceCount); return false; } @@ -47,7 +47,7 @@ bool PlatformMonitoringTech::getTelemOffsetAndTelemDir(LinuxSysmanImp *pLinuxSys telemDir = iterator->second; if (!NEO::PmtUtil::readOffset(telemDir, telemOffset)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read offset from %s\n", __FUNCTION__, telemDir.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read offset from %s\n", __FUNCTION__, telemDir.c_str()); return false; } return true; @@ -56,19 +56,19 @@ bool PlatformMonitoringTech::getTelemOffsetAndTelemDir(LinuxSysmanImp *pLinuxSys bool PlatformMonitoringTech::getTelemOffsetForContainer(SysmanProductHelper *pSysmanProductHelper, const std::string &telemDir, const std::string &key, uint64_t &telemOffset) { std::array guidString = {}; if (!NEO::PmtUtil::readGuid(telemDir, guidString)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read GUID from %s \n", __FUNCTION__, telemDir.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read GUID from %s \n", __FUNCTION__, telemDir.c_str()); return false; } std::map keyOffsetMap; if (!PlatformMonitoringTech::getKeyOffsetMap(pSysmanProductHelper, guidString.data(), keyOffsetMap)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get KeyOffsetMap for Guid : %s\n", __FUNCTION__, guidString.data()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get KeyOffsetMap for Guid : %s\n", __FUNCTION__, guidString.data()); return false; } auto keyOffset = keyOffsetMap.find(key.c_str()); if (keyOffset == keyOffsetMap.end()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to find keyOffset in keyOffsetMap \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to find keyOffset in keyOffsetMap \n", __FUNCTION__); return false; } @@ -80,14 +80,14 @@ bool PlatformMonitoringTech::readValue(const std::map key auto containerOffset = keyOffsetMap.find(key); if (containerOffset == keyOffsetMap.end()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to find keyOffset in keyOffsetMap \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to find keyOffset in keyOffsetMap \n", __FUNCTION__); return false; } uint64_t offset = telemOffset + containerOffset->second; ssize_t bytesRead = NEO::PmtUtil::readTelem(telemDir.data(), sizeof(uint32_t), offset, &value); if (bytesRead != sizeof(uint32_t)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read value for %s key \n", __FUNCTION__, key.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read value for %s key \n", __FUNCTION__, key.c_str()); return false; } return true; @@ -97,14 +97,14 @@ bool PlatformMonitoringTech::readValue(const std::map key auto containerOffset = keyOffsetMap.find(key); if (containerOffset == keyOffsetMap.end()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to find keyOffset in keyOffsetMap \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to find keyOffset in keyOffsetMap \n", __FUNCTION__); return false; } uint64_t offset = telemOffset + containerOffset->second; ssize_t bytesRead = NEO::PmtUtil::readTelem(telemDir.data(), sizeof(uint64_t), offset, &value); if (bytesRead != sizeof(uint64_t)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read value for %s key \n", __FUNCTION__, key.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read value for %s key \n", __FUNCTION__, key.c_str()); return false; } return true; @@ -116,13 +116,13 @@ bool PlatformMonitoringTech::getTelemDataForTileAggregator(const std::map guidString = {}; if (!NEO::PmtUtil::readGuid(telemDir, guidString)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read GUID from %s \n", __FUNCTION__, telemDir.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read GUID from %s \n", __FUNCTION__, telemDir.c_str()); return false; } @@ -134,13 +134,13 @@ bool PlatformMonitoringTech::getTelemData(const std::map auto iterator = telemNodesInPciPath.begin(); telemDir = iterator->second; if (!NEO::PmtUtil::readOffset(telemDir, telemOffset)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read offset from %s\n", __FUNCTION__, telemDir.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read offset from %s\n", __FUNCTION__, telemDir.c_str()); return false; } std::array guidString = {}; if (!NEO::PmtUtil::readGuid(telemDir, guidString)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read GUID from %s \n", __FUNCTION__, telemDir.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read GUID from %s \n", __FUNCTION__, telemDir.c_str()); return false; } @@ -161,14 +161,14 @@ bool PlatformMonitoringTech::isTelemetrySupportAvailable(LinuxSysmanImp *pLinuxS std::map keyOffsetMap; auto pSysmanProductHelper = pLinuxSysmanImp->getSysmanProductHelper(); if (!PlatformMonitoringTech::getKeyOffsetMap(pSysmanProductHelper, guid, keyOffsetMap)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get KeyOffsetMap for Guid : %s\n", __FUNCTION__, guid.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get KeyOffsetMap for Guid : %s\n", __FUNCTION__, guid.c_str()); return false; } std::string telemetryDeviceEntry = telemDir + "/telem"; auto pFsAccess = &pLinuxSysmanImp->getFsAccess(); if (!pFsAccess->fileExists(telemetryDeviceEntry)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Telemetry support not available. No file %s\n", telemetryDeviceEntry.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Telemetry support not available. No file %s\n", telemetryDeviceEntry.c_str()); return false; } diff --git a/level_zero/sysman/source/shared/linux/product_helper/gen12lp/dg1/sysman_product_helper_dg1.cpp b/level_zero/sysman/source/shared/linux/product_helper/gen12lp/dg1/sysman_product_helper_dg1.cpp index 1c63a2b6c2..d37d3185b0 100644 --- a/level_zero/sysman/source/shared/linux/product_helper/gen12lp/dg1/sysman_product_helper_dg1.cpp +++ b/level_zero/sysman/source/shared/linux/product_helper/gen12lp/dg1/sysman_product_helper_dg1.cpp @@ -52,7 +52,7 @@ ze_result_t SysmanProductHelperHw::getGlobalMaxTemperature(LinuxSysm auto isValidTemperature = [](auto temperature) { if ((temperature > invalidMaxTemperature) || (temperature < invalidMinTemperature)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): temperature:%f is not in valid limits \n", __FUNCTION__, temperature); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): temperature:%f is not in valid limits \n", __FUNCTION__, temperature); return false; } return true; @@ -78,7 +78,7 @@ ze_result_t SysmanProductHelperHw::getGlobalMaxTemperature(LinuxSysm uint32_t computeTemperature = 0; key = "COMPUTE_TEMPERATURES"; if (!PlatformMonitoringTech::readValue(keyOffsetMap, telemDir, key, telemOffset, computeTemperature)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): readValue for COMPUTE_TEMPERATURES returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): readValue for COMPUTE_TEMPERATURES returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } // Check max temperature among IA, GT and LLC sensors across COMPUTE_TEMPERATURES @@ -87,7 +87,7 @@ ze_result_t SysmanProductHelperHw::getGlobalMaxTemperature(LinuxSysm uint32_t coreTemperature = 0; key = "CORE_TEMPERATURES"; if (!PlatformMonitoringTech::readValue(keyOffsetMap, telemDir, key, telemOffset, coreTemperature)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): readValue for CORE_TEMPERATURES returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): readValue for CORE_TEMPERATURES returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } // Check max temperature among CORE0, CORE1, CORE2, CORE3 sensors across CORE_TEMPERATURES @@ -96,7 +96,7 @@ ze_result_t SysmanProductHelperHw::getGlobalMaxTemperature(LinuxSysm uint64_t socTemperature = 0; key = "SOC_TEMPERATURES"; if (!PlatformMonitoringTech::readValue(keyOffsetMap, telemDir, key, telemOffset, socTemperature)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): readValue for SOC_TEMPERATURES returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): readValue for SOC_TEMPERATURES returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } // Check max temperature among possible sensors like PCH or GT_TEMP, DRAM, SA, PSF, DE, PCIE, TYPEC across SOC_TEMPERATURES @@ -129,7 +129,7 @@ ze_result_t SysmanProductHelperHw::getGpuMaxTemperature(LinuxSysmanI uint32_t computeTemperature = 0; std::string key("COMPUTE_TEMPERATURES"); if (!PlatformMonitoringTech::readValue(keyOffsetMap, telemDir, key, telemOffset, computeTemperature)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): readValue for COMPUTE_TEMPERATURES returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): readValue for COMPUTE_TEMPERATURES returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } diff --git a/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_hw.inl b/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_hw.inl index c021b68279..68ccab626c 100644 --- a/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_hw.inl +++ b/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_hw.inl @@ -202,7 +202,7 @@ zes_freq_throttle_reason_flags_t SysmanProductHelperHw::getThrottleR throttleReasons |= ZES_FREQ_THROTTLE_REASON_FLAG_THERMAL_LIMIT; } } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read file %s, returning error 0x%x>\n", __func__, throttleReasonStatusFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read file %s, returning error 0x%x>\n", __func__, throttleReasonStatusFile.c_str(), result); } return throttleReasons; @@ -233,7 +233,7 @@ ze_result_t SysmanProductHelperHw::getGlobalMaxTemperature(LinuxSysm auto isValidTemperature = [](auto temperature) { if ((temperature > invalidMaxTemperature) || (temperature < invalidMinTemperature)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): temperature:%f is not in valid limits \n", __FUNCTION__, temperature); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): temperature:%f is not in valid limits \n", __FUNCTION__, temperature); return false; } return true; @@ -255,7 +255,7 @@ ze_result_t SysmanProductHelperHw::getGlobalMaxTemperature(LinuxSysm std::string key = "SOC_TEMPERATURES"; uint64_t socTemperature = 0; if (!PlatformMonitoringTech::readValue(keyOffsetMap, telemDir, key, telemOffset, socTemperature)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): readValue for SOC_TEMPERATURES returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): readValue for SOC_TEMPERATURES returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } uint32_t maxSocTemperature = getMaxTemperature(socTemperature, numSocTemperatureEntries); @@ -290,7 +290,7 @@ ze_result_t SysmanProductHelperHw::getGpuMaxTemperature(LinuxSysmanI uint64_t socTemperature = 0; std::string key = "SOC_TEMPERATURES"; if (!PlatformMonitoringTech::readValue(keyOffsetMap, telemDir, key, telemOffset, socTemperature)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): readValue for SOC_TEMPERATURES returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): readValue for SOC_TEMPERATURES returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } gpuMaxTemperature = static_cast(socTemperature & 0xff); diff --git a/level_zero/sysman/source/shared/linux/product_helper/xe2_hpg_core/bmg/sysman_product_helper_bmg.cpp b/level_zero/sysman/source/shared/linux/product_helper/xe2_hpg_core/bmg/sysman_product_helper_bmg.cpp index f6996ad029..095dc33b53 100644 --- a/level_zero/sysman/source/shared/linux/product_helper/xe2_hpg_core/bmg/sysman_product_helper_bmg.cpp +++ b/level_zero/sysman/source/shared/linux/product_helper/xe2_hpg_core/bmg/sysman_product_helper_bmg.cpp @@ -1637,7 +1637,7 @@ ze_result_t SysmanProductHelperHw::getNumberOfMemoryChannels(LinuxSy } if (keyOffsetMap.empty()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): key Offset map is empty\n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): key Offset map is empty\n", __FUNCTION__); return ZE_RESULT_ERROR_NOT_AVAILABLE; } diff --git a/level_zero/sysman/source/shared/linux/product_helper/xe_hpc_core/pvc/sysman_product_helper_pvc.cpp b/level_zero/sysman/source/shared/linux/product_helper/xe_hpc_core/pvc/sysman_product_helper_pvc.cpp index 08287fcb35..0c008228a4 100644 --- a/level_zero/sysman/source/shared/linux/product_helper/xe_hpc_core/pvc/sysman_product_helper_pvc.cpp +++ b/level_zero/sysman/source/shared/linux/product_helper/xe_hpc_core/pvc/sysman_product_helper_pvc.cpp @@ -151,20 +151,20 @@ ze_result_t getVFIDString(std::map keyOffsetMap, std::str uint32_t vf0VfIdVal = 0; std::string key = "VF0_VFID"; if (!PlatformMonitoringTech::readValue(keyOffsetMap, telemDir, key, telemOffset, vf0VfIdVal)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for VF0_VFID is returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for VF0_VFID is returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } uint32_t vf1VfIdVal = 0; key = "VF1_VFID"; if (!PlatformMonitoringTech::readValue(std::move(keyOffsetMap), telemDir, key, telemOffset, vf1VfIdVal)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for VF1_VFID is returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for VF1_VFID is returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } if (((vf0VfIdVal == 0) && (vf1VfIdVal == 0)) || ((vf0VfIdVal > 0) && (vf1VfIdVal > 0))) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() VF0 returning 0x%x and VF1 returning 0x%x as both should not be the same \n", __FUNCTION__, vf0VfIdVal, vf1VfIdVal); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() VF0 returning 0x%x and VF1 returning 0x%x as both should not be the same \n", __FUNCTION__, vf0VfIdVal, vf1VfIdVal); return ZE_RESULT_ERROR_UNKNOWN; } @@ -187,7 +187,7 @@ ze_result_t getHBMBandwidth(std::map keyOffsetMap, zes_me std::string vfId = ""; result = getVFIDString(keyOffsetMap, vfId, telemDir, telemOffset); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():getVFIDString returning error:0x%x while retrieving VFID string \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():getVFIDString returning error:0x%x while retrieving VFID string \n", __FUNCTION__, result); return result; } @@ -195,7 +195,7 @@ ze_result_t getHBMBandwidth(std::map keyOffsetMap, zes_me uint32_t counterValue = 0; std::string readCounterKey = vfId + "_HBM" + std::to_string(hbmModuleIndex) + "_READ"; if (!PlatformMonitoringTech::readValue(keyOffsetMap, telemDir, readCounterKey, telemOffset, counterValue)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for readCounterKey returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for readCounterKey returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } pBandwidth->readCounter += counterValue; @@ -203,7 +203,7 @@ ze_result_t getHBMBandwidth(std::map keyOffsetMap, zes_me counterValue = 0; std::string writeCounterKey = vfId + "_HBM" + std::to_string(hbmModuleIndex) + "_WRITE"; if (!PlatformMonitoringTech::readValue(keyOffsetMap, telemDir, writeCounterKey, telemOffset, counterValue)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for writeCounterKey returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for writeCounterKey returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } pBandwidth->writeCounter += counterValue; @@ -257,21 +257,21 @@ ze_result_t getHBMBandwidth(zes_mem_bandwidth_t *pBandwidth, LinuxSysmanImp *pLi result = getVFIDString(keyOffsetMap, vfId, telemDir, telemOffset); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():getVFIDString returning error:0x%x while retrieving VFID string \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():getVFIDString returning error:0x%x while retrieving VFID string \n", __FUNCTION__, result); return result; } uint32_t readCounterL = 0; std::string readCounterKey = vfId + "_HBM_READ_L"; if (!PlatformMonitoringTech::readValue(keyOffsetMap, telemDir, readCounterKey, telemOffset, readCounterL)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for readCounterL returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for readCounterL returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } uint32_t readCounterH = 0; readCounterKey = vfId + "_HBM_READ_H"; if (!PlatformMonitoringTech::readValue(keyOffsetMap, telemDir, readCounterKey, telemOffset, readCounterH)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for readCounterH returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for readCounterH returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } @@ -283,14 +283,14 @@ ze_result_t getHBMBandwidth(zes_mem_bandwidth_t *pBandwidth, LinuxSysmanImp *pLi uint32_t writeCounterL = 0; std::string writeCounterKey = vfId + "_HBM_WRITE_L"; if (!PlatformMonitoringTech::readValue(keyOffsetMap, telemDir, writeCounterKey, telemOffset, writeCounterL)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for writeCounterL returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for writeCounterL returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } uint32_t writeCounterH = 0; writeCounterKey = vfId + "_HBM_WRITE_H"; if (!PlatformMonitoringTech::readValue(keyOffsetMap, telemDir, writeCounterKey, telemOffset, writeCounterH)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for writeCounterH returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for writeCounterH returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } @@ -355,7 +355,7 @@ ze_result_t SysmanProductHelperHw::getGlobalMaxTemperature(LinuxSysm uint32_t globalMaxTemperature = 0; std::string key("TileMaxTemperature"); if (!PlatformMonitoringTech::readValue(keyOffsetMap, telemDir, key, telemOffset, globalMaxTemperature)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for TileMaxTemperature returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for TileMaxTemperature returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } *pTemperature = static_cast(globalMaxTemperature); @@ -383,7 +383,7 @@ ze_result_t SysmanProductHelperHw::getGpuMaxTemperature(LinuxSysmanI uint32_t gpuMaxTemperature = 0; std::string key("GTMaxTemperature"); if (!PlatformMonitoringTech::readValue(keyOffsetMap, telemDir, key, telemOffset, gpuMaxTemperature)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for GTMaxTemperature returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for GTMaxTemperature returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } *pTemperature = static_cast(gpuMaxTemperature); @@ -414,7 +414,7 @@ ze_result_t SysmanProductHelperHw::getMemoryMaxTemperature(LinuxSysm uint32_t maxDeviceTemperature = 0; std::string key = "HBM" + std::to_string(hbmModuleIndex) + "MaxDeviceTemperature"; if (!PlatformMonitoringTech::readValue(keyOffsetMap, telemDir, key, telemOffset, maxDeviceTemperature)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for %s returning error:0x%x \n", __FUNCTION__, key.c_str(), ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for %s returning error:0x%x \n", __FUNCTION__, key.c_str(), ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } maxDeviceTemperatureList.push_back(maxDeviceTemperature); diff --git a/level_zero/sysman/source/shared/linux/product_helper/xe_hpg_core/dg2/sysman_product_helper_dg2.cpp b/level_zero/sysman/source/shared/linux/product_helper/xe_hpg_core/dg2/sysman_product_helper_dg2.cpp index 200035d48f..45caf55f4c 100644 --- a/level_zero/sysman/source/shared/linux/product_helper/xe_hpg_core/dg2/sysman_product_helper_dg2.cpp +++ b/level_zero/sysman/source/shared/linux/product_helper/xe_hpg_core/dg2/sysman_product_helper_dg2.cpp @@ -146,7 +146,7 @@ ze_result_t readMcChannelCounters(std::map keyOffsetMap, uint64_t val = 0; std::string readCounterKey = nameOfCounters[counterIndex] + "[" + std::to_string(mcChannelIndex) + "]"; if (!PlatformMonitoringTech::readValue(keyOffsetMap, telemDir, readCounterKey, telemOffset, val)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for readCounterKey returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for readCounterKey returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } counterValues[counterIndex] += val; @@ -186,7 +186,7 @@ ze_result_t SysmanProductHelperHw::getMemoryBandwidth(zes_mem_bandwi result = readMcChannelCounters(std::move(keyOffsetMap), pBandwidth->readCounter, pBandwidth->writeCounter, std::move(telemDir), telemOffset); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readMcChannelCounters returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readMcChannelCounters returning error:0x%x \n", __FUNCTION__, result); return result; } pBandwidth->maxBandwidth = 0u; @@ -194,7 +194,7 @@ ze_result_t SysmanProductHelperHw::getMemoryBandwidth(zes_mem_bandwi uint64_t maxBw = 0; result = pSysFsAccess->read(std::move(maxBwFile), maxBw); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():Sysfsread for maxBw returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():Sysfsread for maxBw returning error:0x%x \n", __FUNCTION__, result); return result; } pBandwidth->maxBandwidth = maxBw * mbpsToBytesPerSecond; @@ -256,7 +256,7 @@ ze_result_t SysmanProductHelperHw::getVfLocalMemoryQuota(SysFsAccess auto result = pSysfsAccess->read(std::move(pathForDeviceMemQuota), lMemQuota); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Local Memory Quota with error 0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Local Memory Quota with error 0x%x \n", __FUNCTION__, result); return result; } return ZE_RESULT_SUCCESS; diff --git a/level_zero/sysman/source/shared/linux/zes_os_sysman_imp.cpp b/level_zero/sysman/source/shared/linux/zes_os_sysman_imp.cpp index aed96fc45e..93259bde3a 100644 --- a/level_zero/sysman/source/shared/linux/zes_os_sysman_imp.cpp +++ b/level_zero/sysman/source/shared/linux/zes_os_sysman_imp.cpp @@ -51,8 +51,8 @@ ze_result_t LinuxSysmanImp::init() { if (pSysmanProductHelper->isZesInitSupported()) { sysmanInitFromCore = false; } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "%s", "Sysman Initialization already happened via zeInit\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "%s", "Sysman Initialization already happened via zeInit\n"); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } } @@ -251,8 +251,8 @@ ze_result_t LinuxSysmanImp::gpuProcessCleanup(ze_bool_t force) { std::vector myPidFds; ze_result_t result = pProcfsAccess->listProcesses(processes); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "gpuProcessCleanup: listProcesses() failed with error code: %ld\n", result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "gpuProcessCleanup: listProcesses() failed with error code: %ld\n", result); return result; } @@ -269,7 +269,7 @@ ze_result_t LinuxSysmanImp::gpuProcessCleanup(ze_bool_t force) { if (force) { pProcfsAccess->kill(pid); } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Device in use by another process, returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Device in use by another process, returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE); return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } } @@ -398,8 +398,8 @@ ze_result_t LinuxSysmanImp::osWarmReset() { if (NEO::debugManager.flags.DebugSetMemoryDiagnosticsDelay.get() != -1) { delayDurationForPPR = NEO::debugManager.flags.DebugSetMemoryDiagnosticsDelay.get(); } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, - "Delay of %d mins introduced to allow HBM IFR to complete\n", delayDurationForPPR); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, + "Delay of %d mins introduced to allow HBM IFR to complete\n", delayDurationForPPR); NEO::sleep(std::chrono::seconds(delayDurationForPPR * 60)); } else { NEO::sleep(std::chrono::seconds(10)); // Sleep for 10 seconds to make sure writing to bridge control offset is propagated. @@ -487,7 +487,7 @@ bool LinuxSysmanImp::getTelemData(uint32_t subDeviceId, std::string &telemDir, s uint32_t deviceCount = getSubDeviceCount() + 1; if (telemNodesInPciPath.size() < deviceCount) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Number of telemetry nodes:%d is less than device count: %d \n", __FUNCTION__, telemNodesInPciPath.size(), deviceCount); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Number of telemetry nodes:%d is less than device count: %d \n", __FUNCTION__, telemNodesInPciPath.size(), deviceCount); return false; } diff --git a/level_zero/sysman/source/shared/windows/pmt/sysman_pmt.cpp b/level_zero/sysman/source/shared/windows/pmt/sysman_pmt.cpp index ef0b73cffe..41140dc022 100644 --- a/level_zero/sysman/source/shared/windows/pmt/sysman_pmt.cpp +++ b/level_zero/sysman/source/shared/windows/pmt/sysman_pmt.cpp @@ -19,8 +19,8 @@ ze_result_t PlatformMonitoringTech::readValue(const std::string &key, uint32_t & auto offset = keyOffsetMap.find(key); if (offset == keyOffsetMap.end()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Key %s has not been defined in key offset map.\n", key.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Key %s has not been defined in key offset map.\n", key.c_str()); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_UNKNOWN; } @@ -39,8 +39,8 @@ ze_result_t PlatformMonitoringTech::readValue(const std::string &key, uint32_t & return ZE_RESULT_SUCCESS; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Ioctl call could not return a valid value for register key %s\n", key.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Ioctl call could not return a valid value for register key %s\n", key.c_str()); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_UNKNOWN; } @@ -48,8 +48,8 @@ ze_result_t PlatformMonitoringTech::readValue(const std::string &key, uint32_t & ze_result_t PlatformMonitoringTech::readValue(const std::string &key, uint64_t &value) { auto offset = keyOffsetMap.find(key); if (offset == keyOffsetMap.end()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Key %s has not been defined in key offset map.\n", key.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Key %s has not been defined in key offset map.\n", key.c_str()); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_UNKNOWN; } @@ -68,8 +68,8 @@ ze_result_t PlatformMonitoringTech::readValue(const std::string &key, uint64_t & return ZE_RESULT_SUCCESS; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Ioctl call could not return a valid value for register key %s\n", key.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Ioctl call could not return a valid value for register key %s\n", key.c_str()); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_UNKNOWN; } @@ -85,8 +85,8 @@ ze_result_t PlatformMonitoringTech::getGuid() { // Get Telmetry Discovery size status = ioctlReadWriteData(deviceInterface, PmtSysman::IoctlPmtGetTelemetryDiscoverySize, NULL, 0, (void *)&sizeNeeded, sizeof(sizeNeeded), NULL); if (status != ZE_RESULT_SUCCESS || sizeNeeded == 0 || sizeNeeded > sizeNeededMax) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Ioctl call could not return a valid value for the PMT interface telemetry size needed\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Ioctl call could not return a valid value for the PMT interface telemetry size needed\n"); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_UNKNOWN; } @@ -99,8 +99,8 @@ ze_result_t PlatformMonitoringTech::getGuid() { // Get Telmetry Discovery Structure status = ioctlReadWriteData(deviceInterface, PmtSysman::IoctlPmtGetTelemetryDiscovery, NULL, 0, (void *)telemetryDiscovery, sizeNeeded, NULL); if (status != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Ioctl call could not return a valid value for the PMT telemetry structure which provides the guids supported.\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Ioctl call could not return a valid value for the PMT telemetry structure which provides the guids supported.\n"); heapFreeFunction(GetProcessHeap(), 0, telemetryDiscovery); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_UNKNOWN; @@ -108,7 +108,7 @@ ze_result_t PlatformMonitoringTech::getGuid() { auto maxEntriesCount = (sizeNeeded - offsetof(PmtSysman::PmtTelemetryDiscovery, telemetry)) / sizeof(PmtSysman::PmtTelemetryEntry); if (telemetryDiscovery->count > maxEntriesCount) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Incorrect telemetry entries count.\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Incorrect telemetry entries count.\n"); heapFreeFunction(GetProcessHeap(), 0, telemetryDiscovery); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_UNKNOWN; @@ -118,8 +118,8 @@ ze_result_t PlatformMonitoringTech::getGuid() { if (telemetryDiscovery->telemetry[i].index < PmtSysman::PmtMaxInterfaces) { guidToIndexList[telemetryDiscovery->telemetry[i].index] = telemetryDiscovery->telemetry[i].guid; } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Telemetry index is out of range.\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Telemetry index is out of range.\n"); heapFreeFunction(GetProcessHeap(), 0, telemetryDiscovery); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_UNKNOWN; @@ -339,8 +339,8 @@ ze_result_t PlatformMonitoringTech::getDeviceInterface() { deviceInterfaceList.resize(cmListCharCount); if (deviceInterfaceList.empty()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Could not allocate memory to store the PMT device interface path.\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Could not allocate memory to store the PMT device interface path.\n"); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_UNKNOWN; } @@ -349,8 +349,8 @@ ze_result_t PlatformMonitoringTech::getDeviceInterface() { } while (status == CR_BUFFER_SMALL); if (status != CR_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Could not find and store the PMT device interface path.\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Could not find and store the PMT device interface path.\n"); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_UNKNOWN; } @@ -376,8 +376,8 @@ ze_result_t PlatformMonitoringTech::ioctlReadWriteData(std::wstring &path, uint3 BOOL status = FALSE; if (path.empty()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "PMT interface path is empty.\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "PMT interface path is empty.\n"); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_UNKNOWN; } @@ -385,8 +385,8 @@ ze_result_t PlatformMonitoringTech::ioctlReadWriteData(std::wstring &path, uint3 // Open handle to driver handle = this->pcreateFile(&path[0], GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); if (handle == INVALID_HANDLE_VALUE) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Could not open the pmt interface path %s.\n", &path[0]); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Could not open the pmt interface path %s.\n", &path[0]); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_UNKNOWN; } @@ -397,8 +397,8 @@ ze_result_t PlatformMonitoringTech::ioctlReadWriteData(std::wstring &path, uint3 this->pcloseHandle(handle); if (status == FALSE) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "deviceIoControl call failed\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "deviceIoControl call failed\n"); DEBUG_BREAK_IF(true); return ZE_RESULT_ERROR_UNKNOWN; } diff --git a/level_zero/sysman/source/shared/windows/product_helper/xe2_hpg_core/bmg/sysman_product_helper_bmg.cpp b/level_zero/sysman/source/shared/windows/product_helper/xe2_hpg_core/bmg/sysman_product_helper_bmg.cpp index e9b104469d..d4aeac16e0 100644 --- a/level_zero/sysman/source/shared/windows/product_helper/xe2_hpg_core/bmg/sysman_product_helper_bmg.cpp +++ b/level_zero/sysman/source/shared/windows/product_helper/xe2_hpg_core/bmg/sysman_product_helper_bmg.cpp @@ -1253,8 +1253,8 @@ ze_result_t getGpuMaxTemperature(PlatformMonitoringTech *pPmt, double *pTemperat std::string key("SOC_THERMAL_SENSORS_TEMPERATURE_0_2_0_GTTMMADR[1]"); auto result = pPmt->readValue(key, gpuMaxTemperature); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "readValue call failed for register key %s\n", key.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "readValue call failed for register key %s\n", key.c_str()); return result; } *pTemperature = static_cast(gpuMaxTemperature); @@ -1266,8 +1266,8 @@ ze_result_t getMemoryMaxTemperature(PlatformMonitoringTech *pPmt, double *pTempe std::string key("VRAM_TEMPERATURE_0_2_0_GTTMMADR"); auto result = pPmt->readValue(key, memoryMaxTemperature); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "readValue call failed for register key %s\n", key.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "readValue call failed for register key %s\n", key.c_str()); return result; } memoryMaxTemperature &= 0xFFu; // Extract least significant 8 bits @@ -1353,15 +1353,15 @@ ze_result_t SysmanProductHelperHw::getPciStats(zes_pci_stats_t *pSta uint32_t rxCounterH = 0; status = pPmt->readValue("rx_byte_count_lsb", rxCounterL); if (status != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "readValue call failed for register key rx_byte_count_lsb\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "readValue call failed for register key rx_byte_count_lsb\n"); return status; } status = pPmt->readValue("rx_byte_count_msb", rxCounterH); if (status != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "readValue call failed for register key rx_byte_count_msb\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "readValue call failed for register key rx_byte_count_msb\n"); return status; } pStats->rxCounter = packInto64Bit(rxCounterH, rxCounterL); @@ -1371,15 +1371,15 @@ ze_result_t SysmanProductHelperHw::getPciStats(zes_pci_stats_t *pSta uint32_t txCounterH = 0; status = pPmt->readValue("tx_byte_count_lsb", txCounterL); if (status != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "readValue call failed for register key tx_byte_count_lsb\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "readValue call failed for register key tx_byte_count_lsb\n"); return status; } status = pPmt->readValue("tx_byte_count_msb", txCounterH); if (status != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "readValue call failed for register key tx_byte_count_msb\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "readValue call failed for register key tx_byte_count_msb\n"); return status; } pStats->txCounter = packInto64Bit(txCounterH, txCounterL); @@ -1389,15 +1389,15 @@ ze_result_t SysmanProductHelperHw::getPciStats(zes_pci_stats_t *pSta uint32_t rxPacketCounterH = 0; status = pPmt->readValue("rx_pkt_count_lsb", rxPacketCounterL); if (status != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "readValue call failed for register key rx_pkt_count_lsb\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "readValue call failed for register key rx_pkt_count_lsb\n"); return status; } status = pPmt->readValue("rx_pkt_count_msb", rxPacketCounterH); if (status != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "readValue call failed for register key rx_pkt_count_msb\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "readValue call failed for register key rx_pkt_count_msb\n"); return status; } @@ -1405,15 +1405,15 @@ ze_result_t SysmanProductHelperHw::getPciStats(zes_pci_stats_t *pSta uint32_t txPacketCounterH = 0; status = pPmt->readValue("tx_pkt_count_lsb", txPacketCounterL); if (status != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "readValue call failed for register key tx_pkt_count_lsb\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "readValue call failed for register key tx_pkt_count_lsb\n"); return status; } status = pPmt->readValue("tx_pkt_count_msb", txPacketCounterH); if (status != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "readValue call failed for register key tx_pkt_count_msb\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "readValue call failed for register key tx_pkt_count_msb\n"); return status; } diff --git a/level_zero/sysman/source/shared/windows/zes_os_sysman_imp.cpp b/level_zero/sysman/source/shared/windows/zes_os_sysman_imp.cpp index 993a2f89a5..8054c714f2 100644 --- a/level_zero/sysman/source/shared/windows/zes_os_sysman_imp.cpp +++ b/level_zero/sysman/source/shared/windows/zes_os_sysman_imp.cpp @@ -48,8 +48,8 @@ ze_result_t WddmSysmanImp::init() { if (pSysmanProductHelper->isZesInitSupported()) { sysmanInitFromCore = false; } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "%s", "Sysman Initialization already happened via zeInit\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "%s", "Sysman Initialization already happened via zeInit\n"); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } } diff --git a/level_zero/tools/source/debug/debug_handlers.cpp b/level_zero/tools/source/debug/debug_handlers.cpp index 0a914e964f..eb2605a8d5 100644 --- a/level_zero/tools/source/debug/debug_handlers.cpp +++ b/level_zero/tools/source/debug/debug_handlers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -28,8 +28,8 @@ ze_result_t debugAttach(zet_device_handle_t hDevice, const zet_debug_config_t *c auto affinityMask = envReader.getSetting("ZE_AFFINITY_MASK", std::string("")); if (!affinityMask.empty()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, - "%s", "ZE_AFFINITY_MASK is not recommended while using program debug API\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, + "%s", "ZE_AFFINITY_MASK is not recommended while using program debug API\n"); } auto session = L0::Device::fromHandle(hDevice)->getDebugSession(*config); diff --git a/level_zero/tools/source/metrics/metric.h b/level_zero/tools/source/metrics/metric.h index f4f8438a2a..8024132369 100644 --- a/level_zero/tools/source/metrics/metric.h +++ b/level_zero/tools/source/metrics/metric.h @@ -50,7 +50,7 @@ struct METRICS_LOG_BITMASK { // NOLINT(readability-identifier }; #define METRICS_LOG(out, ...) \ - NEO::printDebugString(true, out, __VA_ARGS__); + PRINT_STRING(true, out, __VA_ARGS__); #define METRICS_LOG_ERR(str, ...) \ if (NEO::debugManager.flags.PrintL0MetricLogs.get() & METRICS_LOG_BITMASK::LOG_ERROR) { \ diff --git a/level_zero/tools/source/sysman/diagnostics/linux/os_diagnostics_imp.cpp b/level_zero/tools/source/sysman/diagnostics/linux/os_diagnostics_imp.cpp index d8fa8b9476..6de6ca2be9 100644 --- a/level_zero/tools/source/sysman/diagnostics/linux/os_diagnostics_imp.cpp +++ b/level_zero/tools/source/sysman/diagnostics/linux/os_diagnostics_imp.cpp @@ -56,7 +56,7 @@ ze_result_t LinuxDiagnosticsImp::waitForQuiescentCompletion() { } while (count < 10); // limiting to 10 retries as we can endup going into a infinite loop if the cleanup and a process start are out of sync result = pSysfsAccess->write(invalidateLmemFile, intVal); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s and returning error:0x%x \n", __FUNCTION__, invalidateLmemFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s and returning error:0x%x \n", __FUNCTION__, invalidateLmemFile.c_str(), result); return result; } return result; @@ -71,17 +71,17 @@ ze_result_t LinuxDiagnosticsImp::osRunDiagTestsinFW(zes_diag_result_t *pResult) pLinuxSysmanImp->releaseDeviceResources(); ze_result_t result = pLinuxSysmanImp->gpuProcessCleanup(true); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): gpuProcessCleanup() failed and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): gpuProcessCleanup() failed and returning error:0x%x \n", __FUNCTION__, result); return result; } result = waitForQuiescentCompletion(); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): waitForQuiescentCompletion() failed and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): waitForQuiescentCompletion() failed and returning error:0x%x \n", __FUNCTION__, result); return result; } result = pFwInterface->fwRunDiagTests(osDiagType, pResult); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): fwRunDiagTests() failed and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): fwRunDiagTests() failed and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -92,13 +92,13 @@ ze_result_t LinuxDiagnosticsImp::osRunDiagTestsinFW(zes_diag_result_t *pResult) if (*pResult == ZES_DIAG_RESULT_REBOOT_FOR_REPAIR) { result = pLinuxSysmanImp->osColdReset(); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): osColdReset() failed and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): osColdReset() failed and returning error:0x%x \n", __FUNCTION__, result); return result; } } else { result = pLinuxSysmanImp->osWarmReset(); // we need to at least do a Warm reset to bring the machine out of wedged state if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): osWarmReset() failed and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): osWarmReset() failed and returning error:0x%x \n", __FUNCTION__, result); return result; } } @@ -114,7 +114,7 @@ void LinuxDiagnosticsImp::osGetDiagProperties(zes_diag_properties_t *pProperties } ze_result_t LinuxDiagnosticsImp::osGetDiagTests(uint32_t *pCount, zes_diag_test_t *pTests) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/level_zero/tools/source/sysman/ecc/ecc_imp.cpp b/level_zero/tools/source/sysman/ecc/ecc_imp.cpp index 324b46c2ad..cee6fca9d1 100644 --- a/level_zero/tools/source/sysman/ecc/ecc_imp.cpp +++ b/level_zero/tools/source/sysman/ecc/ecc_imp.cpp @@ -27,7 +27,7 @@ zes_device_ecc_state_t EccImp::getEccState(uint8_t state) { ze_result_t EccImp::getEccFwUtilInterface(FirmwareUtil *&pFwUtil) { pFwUtil = getFirmwareUtilInterface(pOsSysman); if (pFwUtil == nullptr) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting FirmwareUtilInterface() and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting FirmwareUtilInterface() and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return ZE_RESULT_SUCCESS; @@ -37,7 +37,7 @@ ze_result_t EccImp::deviceEccAvailable(ze_bool_t *pAvailable) { if (pFwInterface == nullptr) { ze_result_t result = getEccFwUtilInterface(pFwInterface); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting EccFwUtilInterface() and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting EccFwUtilInterface() and returning error:0x%x \n", __FUNCTION__, result); return result; } UNRECOVERABLE_IF(pFwInterface == nullptr); @@ -64,7 +64,7 @@ ze_result_t EccImp::getEccState(zes_device_ecc_properties_t *pState) { if (pFwInterface == nullptr) { ze_result_t result = getEccFwUtilInterface(pFwInterface); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting EccFwUtilInterface() and returning error \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting EccFwUtilInterface() and returning error \n", __FUNCTION__, result); return result; } UNRECOVERABLE_IF(pFwInterface == nullptr); @@ -74,7 +74,7 @@ ze_result_t EccImp::getEccState(zes_device_ecc_properties_t *pState) { uint8_t pendingState = 0; ze_result_t result = pFwInterface->fwGetEccConfig(¤tState, &pendingState); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get ecc configuration and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get ecc configuration and returning error:0x%x \n", __FUNCTION__, result); return result; } pState->currentState = getEccState(currentState); @@ -92,7 +92,7 @@ ze_result_t EccImp::setEccState(const zes_device_ecc_desc_t *newState, zes_devic if (pFwInterface == nullptr) { ze_result_t result = getEccFwUtilInterface(pFwInterface); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting EccFwUtilInterface() and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting EccFwUtilInterface() and returning error:0x%x \n", __FUNCTION__, result); return result; } UNRECOVERABLE_IF(pFwInterface == nullptr); @@ -106,13 +106,13 @@ ze_result_t EccImp::setEccState(const zes_device_ecc_desc_t *newState, zes_devic } else if (newState->state == ZES_DEVICE_ECC_STATE_DISABLED) { state = eccStateDisable; } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Invalid ecc enumeration and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INVALID_ENUMERATION); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Invalid ecc enumeration and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INVALID_ENUMERATION); return ZE_RESULT_ERROR_INVALID_ENUMERATION; } ze_result_t result = pFwInterface->fwSetEccConfig(state, ¤tState, &pendingState); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set ecc configuration and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set ecc configuration and returning error:0x%x \n", __FUNCTION__, result); return result; } diff --git a/level_zero/tools/source/sysman/engine/linux/os_engine_common.cpp b/level_zero/tools/source/sysman/engine/linux/os_engine_common.cpp index 808ce385d3..b4f25cc517 100644 --- a/level_zero/tools/source/sysman/engine/linux/os_engine_common.cpp +++ b/level_zero/tools/source/sysman/engine/linux/os_engine_common.cpp @@ -27,7 +27,7 @@ ze_result_t OsEngine::getNumEngineTypeAndInstances(std::setgetDrm(); if (pDrm->sysmanQueryEngineInfo() == false) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():sysmanQueryEngineInfo is returning false and error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():sysmanQueryEngineInfo is returning false and error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } auto engineInfo = pDrm->getEngineInfo(); diff --git a/level_zero/tools/source/sysman/engine/linux/os_engine_imp.cpp b/level_zero/tools/source/sysman/engine/linux/os_engine_imp.cpp index 2807475c08..7d5f17f558 100644 --- a/level_zero/tools/source/sysman/engine/linux/os_engine_imp.cpp +++ b/level_zero/tools/source/sysman/engine/linux/os_engine_imp.cpp @@ -60,10 +60,10 @@ ze_result_t LinuxEngineImp::getProperties(zes_engine_properties_t &properties) { void LinuxEngineImp::checkErrorNumberAndUpdateStatus() { if (errno == EMFILE || errno == ENFILE) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Engine Handles could not be created because system has run out of file handles. Suggested action is to increase the file handle limit. \n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Engine Handles could not be created because system has run out of file handles. Suggested action is to increase the file handle limit. \n"); initStatus = ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():No valid Filedescriptors: Engine Module is not supported \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():No valid Filedescriptors: Engine Module is not supported \n", __FUNCTION__); initStatus = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } } diff --git a/level_zero/tools/source/sysman/engine/linux/os_engine_imp_prelim.cpp b/level_zero/tools/source/sysman/engine/linux/os_engine_imp_prelim.cpp index f558de91cb..907f753afd 100644 --- a/level_zero/tools/source/sysman/engine/linux/os_engine_imp_prelim.cpp +++ b/level_zero/tools/source/sysman/engine/linux/os_engine_imp_prelim.cpp @@ -59,7 +59,7 @@ static ze_result_t readBusynessFromGroupFd(PmuInterface *pPmuInterface, std::pai auto ret = pPmuInterface->pmuRead(static_cast(fdPair.first), data, sizeof(data)); if (ret < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pmuRead is returning value:%d and error:0x%x \n", __FUNCTION__, ret, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pmuRead is returning value:%d and error:0x%x \n", __FUNCTION__, ret, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } // In data[], First u64 is "active time", And second u64 is "timestamp". Both in ticks @@ -82,7 +82,7 @@ static ze_result_t openPmuHandlesForVfs(uint32_t numberOfVfs, fd[1] = pPmuInterface->pmuInterfaceOpen(vfConfigs[i].second, static_cast(fd[0]), PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP); if (fd[1] < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not open Total Active Ticks PMU Handle \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not open Total Active Ticks PMU Handle \n", __FUNCTION__); NEO::SysCalls::close(static_cast(fd[0])); fd[0] = -1; } @@ -90,7 +90,7 @@ static ze_result_t openPmuHandlesForVfs(uint32_t numberOfVfs, if (fd[1] < 0) { if (errno == EMFILE || errno == ENFILE) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Engine Handles could not be created because system has run out of file handles. Suggested action is to increase the file handle limit. \n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Engine Handles could not be created because system has run out of file handles. Suggested action is to increase the file handle limit. \n"); return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; } } @@ -144,7 +144,7 @@ ze_result_t LinuxEngineImpPrelim::getActivityExt(uint32_t *pCount, zes_engine_st if (fdList.size() == 0) { DEBUG_BREAK_IF(true); - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): unexpected fdlist\n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): unexpected fdlist\n", __FUNCTION__); return ZE_RESULT_ERROR_UNKNOWN; } @@ -193,10 +193,10 @@ ze_result_t LinuxEngineImpPrelim::getProperties(zes_engine_properties_t &propert void LinuxEngineImpPrelim::checkErrorNumberAndUpdateStatus() { if (errno == EMFILE || errno == ENFILE) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Engine Handles could not be created because system has run out of file handles. Suggested action is to increase the file handle limit. \n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Engine Handles could not be created because system has run out of file handles. Suggested action is to increase the file handle limit. \n"); initStatus = ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():No valid Filedescriptors: Engine Module is not supported \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():No valid Filedescriptors: Engine Module is not supported \n", __FUNCTION__); initStatus = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } } @@ -227,7 +227,7 @@ void LinuxEngineImpPrelim::init() { // Fds for global busyness fd[0] = pPmuInterface->pmuInterfaceOpen(config, -1, PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP); if (fd[0] < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not open Busy Ticks Handle \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not open Busy Ticks Handle \n", __FUNCTION__); checkErrorNumberAndUpdateStatus(); return; } @@ -243,7 +243,7 @@ void LinuxEngineImpPrelim::init() { fd[1] = pPmuInterface->pmuInterfaceOpen(totalTickConfig, static_cast(fd[0]), PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP); if (fd[1] < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not open Total Active Ticks Handle \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not open Total Active Ticks Handle \n", __FUNCTION__); checkErrorNumberAndUpdateStatus(); NEO::SysCalls::close(static_cast(fd[0])); return; @@ -256,7 +256,7 @@ void LinuxEngineImpPrelim::init() { auto status = pSysfsAccess->read(pathForNumberOfVfs.data(), numberOfVfs); if (status != ZE_RESULT_SUCCESS) { numberOfVfs = 0; - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():Reading Number Of Vfs Failed or number of Vfs == 0 \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():Reading Number Of Vfs Failed or number of Vfs == 0 \n", __FUNCTION__); return; } diff --git a/level_zero/tools/source/sysman/events/linux/os_events_imp.cpp b/level_zero/tools/source/sysman/events/linux/os_events_imp.cpp index 79793b9aad..cd701c2f1b 100644 --- a/level_zero/tools/source/sysman/events/linux/os_events_imp.cpp +++ b/level_zero/tools/source/sysman/events/linux/os_events_imp.cpp @@ -37,8 +37,8 @@ ze_result_t LinuxEventsImp::eventRegister(zes_event_type_flags_t events) { } if (globalOsSysmanDriver == nullptr) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "%s", "Os Sysman driver not initialized\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "%s", "Os Sysman driver not initialized\n"); return ZE_RESULT_ERROR_UNINITIALIZED; } static_cast(globalOsSysmanDriver)->eventRegister(events, pLinuxSysmanImp->getSysmanDeviceImp()); @@ -129,8 +129,8 @@ void LinuxEventsUtil::eventRegister(zes_event_type_flags_t events, SysmanDeviceI if ((pipeFd[1] != -1) && (prevRegisteredEvents != deviceEventsMap[pSysmanDevice])) { uint8_t value = 0x00; if (NEO::SysCalls::write(pipeFd[1], &value, 1) < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "%s", "Write to Pipe failed\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "%s", "Write to Pipe failed\n"); } } eventsMutex.unlock(); @@ -263,16 +263,16 @@ void LinuxEventsUtil::getDevIndexToDevPathMap(std::vector mapOfDevIndexToDevPath = {}; if (pUdevLib == nullptr) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "%s", "libudev library instantiation failed\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "%s", "libudev library instantiation failed\n"); return retval; } @@ -341,8 +341,8 @@ bool LinuxEventsUtil::listenSystemEvents(zes_event_type_flags_t *pEvents, uint32 eventsMutex.lock(); if (NEO::SysCalls::pipe(pipeFd) < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "%s", "Creation of pipe failed\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "%s", "Creation of pipe failed\n"); } pfd[1].fd = pipeFd[0]; diff --git a/level_zero/tools/source/sysman/fabric_port/fabric_port.cpp b/level_zero/tools/source/sysman/fabric_port/fabric_port.cpp index a0cff152d8..90afbd3e99 100644 --- a/level_zero/tools/source/sysman/fabric_port/fabric_port.cpp +++ b/level_zero/tools/source/sysman/fabric_port/fabric_port.cpp @@ -59,7 +59,7 @@ ze_result_t FabricPortHandleContext::fabricPortGet(uint32_t *pCount, zes_fabric_ ze_result_t FabricPortHandleContext::fabricPortGetMultiPortThroughput(uint32_t numPorts, zes_fabric_port_handle_t *phPort, zes_fabric_port_throughput_t **pThroughput) { if (!numPorts) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Invalid number of ports \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Invalid number of ports \n", __FUNCTION__); return ZE_RESULT_ERROR_INVALID_ARGUMENT; } std::vector portIds = {}; diff --git a/level_zero/tools/source/sysman/fabric_port/linux/fabric_device_access_imp.cpp b/level_zero/tools/source/sysman/fabric_port/linux/fabric_device_access_imp.cpp index 449fa9beb5..ccbbd24a22 100644 --- a/level_zero/tools/source/sysman/fabric_port/linux/fabric_device_access_imp.cpp +++ b/level_zero/tools/source/sysman/fabric_port/linux/fabric_device_access_imp.cpp @@ -58,7 +58,7 @@ ze_result_t FabricDeviceAccessNl::getState(const zes_fabric_port_id_t portId, ze const IafPortId iafPortId(portId.fabricId, portId.attachId, portId.portNumber); ze_result_t result = pIafNlApi->fPortStatusQuery(iafPortId, iafPortState); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): IafNlApi->fPortStatusQuery() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, iafPortId.portNumber, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): IafNlApi->fPortStatusQuery() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, iafPortId.portNumber, result); return result; } readIafPortStatus(state, iafPortState); @@ -72,7 +72,7 @@ ze_result_t FabricDeviceAccessNl::getState(const zes_fabric_port_id_t portId, ze result = pIafNlApi->fportProperties(iafPortId, guid, portNumber, maxRxSpeed, maxTxSpeed, rxSpeed, txSpeed); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): IafNlApi->fportProperties() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, iafPortId.portNumber, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): IafNlApi->fportProperties() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, iafPortId.portNumber, result); return result; } readIafPortSpeed(state.rxSpeed, rxSpeed); @@ -117,7 +117,7 @@ ze_result_t FabricDeviceAccessNl::getMultiPortThroughput(std::vectorgetMultiPortThroughPut(iafPortIdList, iafThroughPutList); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to retrieve throughput, Returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to retrieve throughput, Returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -191,7 +191,7 @@ ze_result_t FabricDeviceAccessNl::getPorts(std::vector &po pLinuxSysmanImp->getSysfsAccess().getRealPath(iafPath, iafRealPath); ze_result_t result = pIafNlApi->getPorts(iafRealPath, iafPorts); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): IafNlApi->getPorts() failed to retrieve prots from %s and returning error:0x%x \n", __FUNCTION__, iafRealPath.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): IafNlApi->getPorts() failed to retrieve prots from %s and returning error:0x%x \n", __FUNCTION__, iafRealPath.c_str(), result); return result; } diff --git a/level_zero/tools/source/sysman/fabric_port/linux/os_fabric_port_imp_prelim.cpp b/level_zero/tools/source/sysman/fabric_port/linux/os_fabric_port_imp_prelim.cpp index 76aeb292e0..a84c3ce7f3 100644 --- a/level_zero/tools/source/sysman/fabric_port/linux/os_fabric_port_imp_prelim.cpp +++ b/level_zero/tools/source/sysman/fabric_port/linux/os_fabric_port_imp_prelim.cpp @@ -50,15 +50,15 @@ ze_result_t LinuxFabricDeviceImp::getFabricDevicePath(std::string &fabricDeviceP std::string devicePciPath(""); ze_result_t result = pSysfsAccess->getRealPath("device/", devicePciPath); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } std::vector list; result = pFsAccess->listDirectory(devicePciPath, list); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } @@ -73,8 +73,8 @@ ze_result_t LinuxFabricDeviceImp::getFabricDevicePath(std::string &fabricDeviceP } if (fabricDevicePath.empty()) { // This device does not have a fabric - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__); return ZE_RESULT_ERROR_NOT_AVAILABLE; } return result; @@ -87,16 +87,16 @@ void LinuxFabricDeviceImp::getLinkErrorCount(zes_fabric_port_error_counters_t *p std::string linkFailureFile = fabricLinkErrorPath + "/link_failures"; ze_result_t result = pFsAccess->read(linkFailureFile, linkErrorCount); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, linkFailureFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, linkFailureFile.c_str(), result); linkErrorCount = 0; } uint64_t linkDegradeCount = 0; std::string linkDegradeFile = fabricLinkErrorPath + "/link_degrades"; result = pFsAccess->read(linkDegradeFile, linkDegradeCount); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, linkDegradeFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, linkDegradeFile.c_str(), result); linkDegradeCount = 0; } pErrors->linkFailureCount = linkErrorCount; @@ -110,16 +110,16 @@ void LinuxFabricDeviceImp::getFwErrorCount(zes_fabric_port_error_counters_t *pEr std::string fwErrorFile = fabricFwErrorPath + "/fw_error"; ze_result_t result = pFsAccess->read(fwErrorFile, fwErrorCount); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, fwErrorFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, fwErrorFile.c_str(), result); fwErrorCount = 0; } uint64_t fwCommErrorCount = 0; std::string fwCommErrorFile = fabricFwErrorPath + "/fw_comm_errors"; result = pFsAccess->read(fwCommErrorFile, fwCommErrorCount); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, fwCommErrorFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, fwCommErrorFile.c_str(), result); fwCommErrorCount = 0; } pErrors->fwErrorCount = fwErrorCount; @@ -151,19 +151,19 @@ ze_result_t LinuxFabricDeviceImp::performSweep() { result = forceSweep(); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): forceSweep() failed and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): forceSweep() failed and returning error:0x%x \n", __FUNCTION__, result); return result; } result = routingQuery(start, end); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): routingQuery() failed from %d to %d and returning error:0x%x \n", __FUNCTION__, start, end, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): routingQuery() failed from %d to %d and returning error:0x%x \n", __FUNCTION__, start, end, result); return result; } while (end < start) { uint32_t newStart; result = routingQuery(newStart, end); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): routingQuery() failed from %d to %d and returning error:0x%x \n", __FUNCTION__, newStart, end, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): routingQuery() failed from %d to %d and returning error:0x%x \n", __FUNCTION__, newStart, end, result); return result; } } @@ -211,7 +211,7 @@ ze_result_t LinuxFabricDeviceImp::enable(const zes_fabric_port_id_t portId) { ze_result_t result = ZE_RESULT_SUCCESS; result = pFabricDeviceAccess->enable(portId); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FabricDeviceAccess->enable() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FabricDeviceAccess->enable() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); return result; } return performSweep(); @@ -221,7 +221,7 @@ ze_result_t LinuxFabricDeviceImp::disable(const zes_fabric_port_id_t portId) { ze_result_t result = ZE_RESULT_SUCCESS; result = pFabricDeviceAccess->disable(portId); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FabricDeviceAccess->disable() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FabricDeviceAccess->disable() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); return result; } return performSweep(); @@ -231,7 +231,7 @@ ze_result_t LinuxFabricDeviceImp::enableUsage(const zes_fabric_port_id_t portId) ze_result_t result = ZE_RESULT_SUCCESS; result = pFabricDeviceAccess->enableUsage(portId); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FabricDeviceAccess->enableUsage() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FabricDeviceAccess->enableUsage() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); return result; } return performSweep(); @@ -241,7 +241,7 @@ ze_result_t LinuxFabricDeviceImp::disableUsage(const zes_fabric_port_id_t portId ze_result_t result = ZE_RESULT_SUCCESS; result = pFabricDeviceAccess->disableUsage(portId); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FabricDeviceAccess->disableUsage() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FabricDeviceAccess->disableUsage() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); return result; } return performSweep(); @@ -275,13 +275,13 @@ ze_result_t LinuxFabricPortImp::getConfig(zes_fabric_port_config_t *pConfig) { bool enabled = false; result = pLinuxFabricDeviceImp->getPortEnabledState(portId, enabled); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): LinuxFabricDeviceImp->getPortEnabledState() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): LinuxFabricDeviceImp->getPortEnabledState() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); return result; } pConfig->enabled = enabled == true; result = pLinuxFabricDeviceImp->getPortBeaconState(portId, enabled); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): LinuxFabricDeviceImp->getPortBeaconState() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): LinuxFabricDeviceImp->getPortBeaconState() failed for portnumber : %d and returning error:0x%x \n", __FUNCTION__, portId.portNumber, result); return result; } pConfig->beaconing = enabled == true; diff --git a/level_zero/tools/source/sysman/firmware/linux/os_firmware_imp.cpp b/level_zero/tools/source/sysman/firmware/linux/os_firmware_imp.cpp index fff1d92142..fa395fb98d 100644 --- a/level_zero/tools/source/sysman/firmware/linux/os_firmware_imp.cpp +++ b/level_zero/tools/source/sysman/firmware/linux/os_firmware_imp.cpp @@ -32,7 +32,7 @@ ze_result_t OsFirmware::getSupportedFwTypes(std::vector &supportedF std::vector mtdDescriptorStrings = {}; ze_result_t result = pFsAccess->read(mtdDescriptor, mtdDescriptorStrings); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, mtdDescriptor.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, mtdDescriptor.c_str(), result); return result; } for (const auto &readByteLine : mtdDescriptorStrings) { diff --git a/level_zero/tools/source/sysman/firmware/linux/os_firmware_imp_helper_prelim.cpp b/level_zero/tools/source/sysman/firmware/linux/os_firmware_imp_helper_prelim.cpp index c8e08b195a..8c4e6bf80a 100644 --- a/level_zero/tools/source/sysman/firmware/linux/os_firmware_imp_helper_prelim.cpp +++ b/level_zero/tools/source/sysman/firmware/linux/os_firmware_imp_helper_prelim.cpp @@ -28,7 +28,7 @@ ze_result_t LinuxFirmwareImp::getFirmwareVersion(std::string fwType, zes_firmwar ze_result_t result = pSysfsAccess->scanDirEntries(iafPath, list); if (ZE_RESULT_SUCCESS != result) { // There should be a device directory - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAcess->scanDirEntries() failed to locate device directory at %s and returning error:0x%x \n", __FUNCTION__, iafPath.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAcess->scanDirEntries() failed to locate device directory at %s and returning error:0x%x \n", __FUNCTION__, iafPath.c_str(), result); return result; } for (const auto &entry : list) { @@ -39,7 +39,7 @@ ze_result_t LinuxFirmwareImp::getFirmwareVersion(std::string fwType, zes_firmwar } if (path.empty()) { // This device does not have a PSC Version - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): device does not have a PSC version and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): device does not have a PSC version and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } std::string pscVersion; @@ -47,7 +47,7 @@ ze_result_t LinuxFirmwareImp::getFirmwareVersion(std::string fwType, zes_firmwar result = pSysfsAccess->read(path, pscVersion); if (ZE_RESULT_SUCCESS != result) { // not able to read PSC version from iaf.x - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); return result; } strncpy_s(static_cast(pProperties->version), ZES_STRING_PROPERTY_SIZE, pscVersion.c_str(), ZES_STRING_PROPERTY_SIZE - 1); diff --git a/level_zero/tools/source/sysman/firmware_util/firmware_util_imp.cpp b/level_zero/tools/source/sysman/firmware_util/firmware_util_imp.cpp index ad9b790517..4cba801b21 100644 --- a/level_zero/tools/source/sysman/firmware_util/firmware_util_imp.cpp +++ b/level_zero/tools/source/sysman/firmware_util/firmware_util_imp.cpp @@ -57,7 +57,7 @@ bool FirmwareUtilImp::loadEntryPoints() { static void progressFunc(uint32_t done, uint32_t total, void *ctx) { uint32_t percent = (done * 100) / total; - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, "Progress: %d/%d:%d/%\n", done, total, percent); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, "Progress: %d/%d:%d/%\n", done, total, percent); } ze_result_t FirmwareUtilImp::getFirstDevice(IgscDeviceInfo *info) { diff --git a/level_zero/tools/source/sysman/firmware_util/firmware_util_imp_helper.cpp b/level_zero/tools/source/sysman/firmware_util/firmware_util_imp_helper.cpp index b0e24975c2..1e539320d4 100644 --- a/level_zero/tools/source/sysman/firmware_util/firmware_util_imp_helper.cpp +++ b/level_zero/tools/source/sysman/firmware_util/firmware_util_imp_helper.cpp @@ -72,8 +72,8 @@ ze_result_t FirmwareUtilImp::fwGetMemoryErrorCount(zes_ras_error_type_t type, ui } if (ret != IGSC_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Error@ %s(): Could not retrieve tile count from igsc\n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Error@ %s(): Could not retrieve tile count from igsc\n", __FUNCTION__); // igsc_gfsp_count_tiles returns max tile info rather than actual count, igsc behaves in such a way that // it expects buffer (igsc_gfsp_mem_err) to be allocated for max tile count and not actual tile count. // This is fallback path when igsc_gfsp_count_tiles fails, where buffer for actual tile count is used to @@ -89,14 +89,14 @@ ze_result_t FirmwareUtilImp::fwGetMemoryErrorCount(zes_ras_error_type_t type, ui tiles->num_of_tiles = numOfTiles; // set the number of tiles in the structure that will be passed as a buffer ret = gfspMemoryErrors(&fwDeviceHandle, tiles); if (ret != IGSC_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Error@ %s(): Could not retrieve memory errors from igsc (error:0x%x) \n", __FUNCTION__, ret); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Error@ %s(): Could not retrieve memory errors from igsc (error:0x%x) \n", __FUNCTION__, ret); return ZE_RESULT_ERROR_UNINITIALIZED; } if (tiles->num_of_tiles < subDeviceCount) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Error@ %s(): Inappropriate tile count \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Error@ %s(): Inappropriate tile count \n", __FUNCTION__); return ZE_RESULT_ERROR_UNKNOWN; } if (type == ZES_RAS_ERROR_TYPE_CORRECTABLE) { @@ -137,7 +137,7 @@ void FirmwareUtilImp::fwGetMemoryHealthIndicator(zes_mem_health_t *health) { } } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(); Could not get memory health indicator from igsc\n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(); Could not get memory health indicator from igsc\n", __FUNCTION__); } ze_result_t FirmwareUtilImp::fwGetEccConfig(uint8_t *currentState, uint8_t *pendingState) { @@ -204,7 +204,7 @@ ze_result_t FirmwareUtilImp::fwRunDiagTests(std::string &osDiagType, zes_diag_re static void progressFunc(uint32_t done, uint32_t total, void *ctx) { uint32_t percent = (done * 100) / total; - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, "Progress: %d/%d:%d/%\n", done, total, percent); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, "Progress: %d/%d:%d/%\n", done, total, percent); } ze_result_t FirmwareUtilImp::pscGetVersion(std::string &fwVersion) { diff --git a/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp.cpp b/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp.cpp index ca474c81e4..d1283b2933 100644 --- a/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp.cpp +++ b/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2023 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -25,8 +25,8 @@ ze_result_t LinuxFrequencyImp::osFrequencyGetProperties(zes_freq_properties_t &p ze_result_t result2 = getMaxVal(properties.max); // If can't figure out the valid range, then can't control it. if (ZE_RESULT_SUCCESS != result1 || ZE_RESULT_SUCCESS != result2) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result1, result2); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result1, result2); properties.canControl = false; properties.min = 0.0; properties.max = 0.0; @@ -44,15 +44,15 @@ double LinuxFrequencyImp::osFrequencyGetStepSize() { ze_result_t LinuxFrequencyImp::osFrequencyGetRange(zes_freq_range_t *pLimits) { ze_result_t result = getMax(pLimits->max); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pLimits->max = -1; } result = getMin(pLimits->min); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pLimits->min = -1; } return ZE_RESULT_SUCCESS; @@ -69,8 +69,8 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi if (result1 == ZE_RESULT_SUCCESS && result2 == ZE_RESULT_SUCCESS) { result = setMax(maxDefault); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } return setMin(minDefault); @@ -79,16 +79,16 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi double currentMax = 0.0; ze_result_t result = getMax(currentMax); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } if (newMin > currentMax) { // set the max first ze_result_t result = setMax(newMax); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } return setMin(newMin); @@ -97,8 +97,8 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi // set the min first result = setMin(newMin); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } return setMax(newMax); @@ -110,8 +110,8 @@ bool LinuxFrequencyImp::getThrottleReasonStatus(void) { if (ZE_RESULT_SUCCESS == result) { return (val == 0 ? false : true); } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, throttleReasonStatusFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, throttleReasonStatusFile.c_str(), result); return false; } } @@ -121,29 +121,29 @@ ze_result_t LinuxFrequencyImp::osFrequencyGetState(zes_freq_state_t *pState) { result = getRequest(pState->request); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->request = -1; } result = getTdp(pState->tdp); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->tdp = -1; } result = getEfficient(pState->efficient); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->efficient = -1; } result = getActual(pState->actual); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->actual = -1; } @@ -229,8 +229,8 @@ ze_result_t LinuxFrequencyImp::getMin(double &min) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, minFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, minFreqFile.c_str(), result); return result; } min = intval; @@ -243,8 +243,8 @@ ze_result_t LinuxFrequencyImp::setMin(double min) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, minFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, minFreqFile.c_str(), result); return result; } return ZE_RESULT_SUCCESS; @@ -258,8 +258,8 @@ ze_result_t LinuxFrequencyImp::getMax(double &max) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, maxFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, maxFreqFile.c_str(), result); return result; } max = intval; @@ -272,8 +272,8 @@ ze_result_t LinuxFrequencyImp::setMax(double max) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, maxFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, maxFreqFile.c_str(), result); return result; } return pSysfsAccess->write(boostFreqFile, max); @@ -287,8 +287,8 @@ ze_result_t LinuxFrequencyImp::getRequest(double &request) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, requestFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, requestFreqFile.c_str(), result); return result; } request = intval; @@ -303,8 +303,8 @@ ze_result_t LinuxFrequencyImp::getTdp(double &tdp) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, tdpFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, tdpFreqFile.c_str(), result); return result; } tdp = intval; @@ -319,8 +319,8 @@ ze_result_t LinuxFrequencyImp::getActual(double &actual) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, actualFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, actualFreqFile.c_str(), result); return result; } actual = intval; @@ -335,8 +335,8 @@ ze_result_t LinuxFrequencyImp::getEfficient(double &efficient) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, efficientFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, efficientFreqFile.c_str(), result); return result; } efficient = intval; @@ -351,8 +351,8 @@ ze_result_t LinuxFrequencyImp::getMaxVal(double &maxVal) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, maxValFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, maxValFreqFile.c_str(), result); return result; } maxVal = intval; @@ -367,8 +367,8 @@ ze_result_t LinuxFrequencyImp::getMinVal(double &minVal) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, minValFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, minValFreqFile.c_str(), result); return result; } minVal = intval; diff --git a/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp_prelim.cpp b/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp_prelim.cpp index 803224bca9..c8d5ba7e32 100644 --- a/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp_prelim.cpp +++ b/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp_prelim.cpp @@ -29,8 +29,8 @@ ze_result_t LinuxFrequencyImp::osFrequencyGetProperties(zes_freq_properties_t &p ze_result_t result2 = getMaxVal(properties.max); // If can't figure out the valid range, then can't control it. if (ZE_RESULT_SUCCESS != result1 || ZE_RESULT_SUCCESS != result2) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result1, result2); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result1, result2); properties.canControl = false; properties.min = 0.0; properties.max = 0.0; @@ -55,15 +55,15 @@ double LinuxFrequencyImp::osFrequencyGetStepSize() { ze_result_t LinuxFrequencyImp::osFrequencyGetRange(zes_freq_range_t *pLimits) { ze_result_t result = getMax(pLimits->max); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pLimits->max = -1; } result = getMin(pLimits->min); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pLimits->min = -1; } return ZE_RESULT_SUCCESS; @@ -80,8 +80,8 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi if (result1 == ZE_RESULT_SUCCESS && result2 == ZE_RESULT_SUCCESS) { result = setMax(maxDefault); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } return setMin(minDefault); @@ -90,16 +90,16 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi double currentMax = 0.0; ze_result_t result = getMax(currentMax); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } if (newMin > currentMax) { // set the max first ze_result_t result = setMax(newMax); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } return setMin(newMin); @@ -108,8 +108,8 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi // set the min first result = setMin(newMin); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); return result; } return setMax(newMax); @@ -120,8 +120,8 @@ bool LinuxFrequencyImp::getThrottleReasonStatus(void) { if (ZE_RESULT_SUCCESS == result) { return (val == 0 ? false : true); } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, throttleReasonStatusFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, throttleReasonStatusFile.c_str(), result); return false; } } @@ -131,29 +131,29 @@ ze_result_t LinuxFrequencyImp::osFrequencyGetState(zes_freq_state_t *pState) { result = getRequest(pState->request); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->request = -1; } result = getTdp(pState->tdp); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->tdp = -1; } result = getEfficient(pState->efficient); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->efficient = -1; } result = getActual(pState->actual); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); pState->actual = -1; } @@ -238,8 +238,8 @@ ze_result_t LinuxFrequencyImp::getMin(double &min) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, minFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, minFreqFile.c_str(), result); return result; } min = intval; @@ -252,8 +252,8 @@ ze_result_t LinuxFrequencyImp::setMin(double min) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, minFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, minFreqFile.c_str(), result); return result; } return ZE_RESULT_SUCCESS; @@ -266,8 +266,8 @@ ze_result_t LinuxFrequencyImp::getMax(double &max) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, maxFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, maxFreqFile.c_str(), result); return result; } max = intval; @@ -280,8 +280,8 @@ ze_result_t LinuxFrequencyImp::setMax(double max) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, maxFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, maxFreqFile.c_str(), result); return result; } return pSysfsAccess->write(boostFreqFile, max); @@ -295,8 +295,8 @@ ze_result_t LinuxFrequencyImp::getRequest(double &request) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, requestFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, requestFreqFile.c_str(), result); return result; } request = intval; @@ -311,8 +311,8 @@ ze_result_t LinuxFrequencyImp::getTdp(double &tdp) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, tdpFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, tdpFreqFile.c_str(), result); return result; } tdp = intval; @@ -327,8 +327,8 @@ ze_result_t LinuxFrequencyImp::getActual(double &actual) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, actualFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, actualFreqFile.c_str(), result); return result; } actual = intval; @@ -343,8 +343,8 @@ ze_result_t LinuxFrequencyImp::getEfficient(double &efficient) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, efficientFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, efficientFreqFile.c_str(), result); return result; } efficient = intval; @@ -359,8 +359,8 @@ ze_result_t LinuxFrequencyImp::getMaxVal(double &maxVal) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, maxValFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, maxValFreqFile.c_str(), result); return result; } maxVal = intval; @@ -375,8 +375,8 @@ ze_result_t LinuxFrequencyImp::getMinVal(double &minVal) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, minValFreqFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, minValFreqFile.c_str(), result); return result; } minVal = intval; diff --git a/level_zero/tools/source/sysman/global_operations/linux/os_global_operations_imp.cpp b/level_zero/tools/source/sysman/global_operations/linux/os_global_operations_imp.cpp index 2695a0b4fc..1351b0122f 100644 --- a/level_zero/tools/source/sysman/global_operations/linux/os_global_operations_imp.cpp +++ b/level_zero/tools/source/sysman/global_operations/linux/os_global_operations_imp.cpp @@ -50,14 +50,14 @@ bool LinuxGlobalOperationsImp::getTelemOffsetAndTelemDir(uint64_t &telemOffset, auto pDrm = &pLinuxSysmanImp->getDrm(); std::optional rootPath = NEO::getPciRootPath(pDrm->getFileDescriptor()); if (!rootPath.has_value()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Root path has no value \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Root path has no value \n", __FUNCTION__); return false; } std::map telemPciPath; NEO::PmtUtil::getTelemNodesInPciPath(rootPath.value(), telemPciPath); if (telemPciPath.size() < pDevice->getNEODevice()->getNumSubDevices() + 1) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): telemPciPath size is less than expected \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): telemPciPath size is less than expected \n", __FUNCTION__); return false; } @@ -66,13 +66,13 @@ bool LinuxGlobalOperationsImp::getTelemOffsetAndTelemDir(uint64_t &telemOffset, std::array guidString = {}; if (!NEO::PmtUtil::readGuid(telemDir, guidString)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read GUID from %s \n", __FUNCTION__, telemDir.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read GUID from %s \n", __FUNCTION__, telemDir.c_str()); return false; } uint64_t offset = ULONG_MAX; if (!NEO::PmtUtil::readOffset(telemDir, offset)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read offset from %s\n", __FUNCTION__, telemDir.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read offset from %s\n", __FUNCTION__, telemDir.c_str()); return false; } @@ -84,7 +84,7 @@ bool LinuxGlobalOperationsImp::getTelemOffsetAndTelemDir(uint64_t &telemOffset, return true; } } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to find keyOffset in keyOffsetMap \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to find keyOffset in keyOffsetMap \n", __FUNCTION__); return false; } @@ -92,7 +92,7 @@ bool LinuxGlobalOperationsImp::getSerialNumber(char (&serialNumber)[ZES_STRING_P uint64_t offset = 0; std::string telemDir = {}; if (!LinuxGlobalOperationsImp::getTelemOffsetAndTelemDir(offset, "PPIN", telemDir)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get telemetry offset and directory for PPIN \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get telemetry offset and directory for PPIN \n", __FUNCTION__); return false; } @@ -104,7 +104,7 @@ bool LinuxGlobalOperationsImp::getSerialNumber(char (&serialNumber)[ZES_STRING_P memcpy_s(serialNumber, ZES_STRING_PROPERTY_SIZE, telemDataString.str().c_str(), telemDataString.str().size()); return true; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read serial number \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read serial number \n", __FUNCTION__); return false; } @@ -117,7 +117,7 @@ bool LinuxGlobalOperationsImp::getBoardNumber(char (&boardNumber)[ZES_STRING_PRO std::string telemDir = {}; constexpr uint32_t boardNumberSize = 32; if (!LinuxGlobalOperationsImp::getTelemOffsetAndTelemDir(offset, "BoardNumber", telemDir)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get telemetry offset and directory for BoardNumber \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get telemetry offset and directory for BoardNumber \n", __FUNCTION__); return false; } std::array value; @@ -136,7 +136,7 @@ bool LinuxGlobalOperationsImp::getBoardNumber(char (&boardNumber)[ZES_STRING_PRO memcpy_s(boardNumber, ZES_STRING_PROPERTY_SIZE, value.data(), bytesRead); return true; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read board number \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read board number \n", __FUNCTION__); return false; } @@ -178,12 +178,12 @@ void LinuxGlobalOperationsImp::getDriverVersion(char (&driverVersion)[ZES_STRING ze_result_t result = pFsAccess->read(agamaVersionFile, strVal); if (ZE_RESULT_SUCCESS != result) { if (ZE_RESULT_ERROR_NOT_AVAILABLE != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Driver version not available \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Driver version not available \n", __FUNCTION__); return; } result = pFsAccess->read(srcVersionFile, strVal); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FsAccess->read() failed to read driver version and returning error:0x%x\n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): FsAccess->read() failed to read driver version and returning error:0x%x\n", __FUNCTION__, result); return; } } @@ -205,7 +205,7 @@ ze_result_t LinuxGlobalOperationsImp::resetExt(zes_reset_properties_t *pProperti ze_result_t LinuxGlobalOperationsImp::resetImpl(ze_bool_t force, zes_reset_type_t resetType) { if (!pSysfsAccess->isRootUser()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Not running as root user and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Not running as root user and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS); return ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS; } @@ -216,14 +216,14 @@ ze_result_t LinuxGlobalOperationsImp::resetImpl(ze_bool_t force, zes_reset_type_ ze_result_t result = pLinuxSysmanImp->gpuProcessCleanup(force); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): gpuProcessCleanup() failed and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): gpuProcessCleanup() failed and returning error:0x%x \n", __FUNCTION__, result); return result; } std::string resetName; result = pSysfsAccess->getRealPath(deviceDir, resetName); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get reset sysfs path and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get reset sysfs path and returning error:0x%x \n", __FUNCTION__, result); return result; } std::string flrPath = resetName + functionLevelReset; @@ -232,7 +232,7 @@ ze_result_t LinuxGlobalOperationsImp::resetImpl(ze_bool_t force, zes_reset_type_ if (resetType == ZES_RESET_TYPE_FLR || resetType == ZES_RESET_TYPE_COLD) { result = pSysfsAccess->unbindDevice(resetName); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to unbind device:%s and returning error:0x%x \n", __FUNCTION__, resetName.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to unbind device:%s and returning error:0x%x \n", __FUNCTION__, resetName.c_str(), result); return result; } } @@ -240,7 +240,7 @@ ze_result_t LinuxGlobalOperationsImp::resetImpl(ze_bool_t force, zes_reset_type_ std::vector<::pid_t> processes; result = pProcfsAccess->listProcesses(processes); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to list processes and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to list processes and returning error:0x%x \n", __FUNCTION__, result); return result; } std::vector<::pid_t> deviceUsingPids; @@ -267,18 +267,18 @@ ze_result_t LinuxGlobalOperationsImp::resetImpl(ze_bool_t force, zes_reset_type_ if (resetType == ZES_RESET_TYPE_FLR || resetType == ZES_RESET_TYPE_COLD) { result = pSysfsAccess->bindDevice(resetName); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to bind the device to the kernel driver and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to bind the device to the kernel driver and returning error:0x%x \n", __FUNCTION__, result); return result; } } result = pLinuxSysmanImp->initDevice(); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to init the device and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to init the device and returning error:0x%x \n", __FUNCTION__, result); return result; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Timeout reached, device still in use and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Timeout reached, device still in use and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE); return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } @@ -303,14 +303,14 @@ ze_result_t LinuxGlobalOperationsImp::resetImpl(ze_bool_t force, zes_reset_type_ } if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to reset the device and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to reset the device and returning error:0x%x \n", __FUNCTION__, result); return result; } if (resetType == ZES_RESET_TYPE_FLR || resetType == ZES_RESET_TYPE_COLD) { result = pSysfsAccess->bindDevice(std::move(resetName)); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to bind the device to the kernel driver and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to bind the device to the kernel driver and returning error:0x%x \n", __FUNCTION__, result); return result; } } @@ -348,7 +348,7 @@ ze_result_t LinuxGlobalOperationsImp::scanProcessesState(std::vectorscanDirEntries(clientsDir, clientIds); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to scan directory entries and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to scan directory entries and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -429,7 +429,7 @@ ze_result_t LinuxGlobalOperationsImp::scanProcessesState(std::vectorread(realClientTotalMemoryPath, memSize); if (ZE_RESULT_SUCCESS != result) { if (ZE_RESULT_ERROR_NOT_AVAILABLE != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read memory size from:%s and returning error:0x%x \n", __FUNCTION__, realClientTotalMemoryPath.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read memory size from:%s and returning error:0x%x \n", __FUNCTION__, realClientTotalMemoryPath.c_str(), result); return result; } } @@ -439,7 +439,7 @@ ze_result_t LinuxGlobalOperationsImp::scanProcessesState(std::vectorread(realClientTotalSharedMemoryPath, sharedMemSize); if (ZE_RESULT_SUCCESS != result) { if (ZE_RESULT_ERROR_NOT_AVAILABLE != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read shared memory size from:%s and returning error:0x%x \n", __FUNCTION__, realClientTotalSharedMemoryPath.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read shared memory size from:%s and returning error:0x%x \n", __FUNCTION__, realClientTotalSharedMemoryPath.c_str(), result); return result; } } diff --git a/level_zero/tools/source/sysman/linux/nl_api/iaf_nl_api.cpp b/level_zero/tools/source/sysman/linux/nl_api/iaf_nl_api.cpp index 348d40a417..6cc10f8b89 100644 --- a/level_zero/tools/source/sysman/linux/nl_api/iaf_nl_api.cpp +++ b/level_zero/tools/source/sysman/linux/nl_api/iaf_nl_api.cpp @@ -729,7 +729,7 @@ ze_result_t IafNlApi::init() { int retval = pNlApi->genlRegisterFamily(&ops); if (-NLE_EXIST == retval) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to register netlink family and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to register netlink family and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE); return ZE_RESULT_ERROR_NOT_AVAILABLE; } else if (!retval) { nlSock = pNlApi->nlSocketAlloc(); diff --git a/level_zero/tools/source/sysman/linux/os_sysman_imp.cpp b/level_zero/tools/source/sysman/linux/os_sysman_imp.cpp index e68eb65ed4..ac7313c7c1 100644 --- a/level_zero/tools/source/sysman/linux/os_sysman_imp.cpp +++ b/level_zero/tools/source/sysman/linux/os_sysman_imp.cpp @@ -278,8 +278,8 @@ ze_result_t LinuxSysmanImp::gpuProcessCleanup(ze_bool_t force) { std::vector myPidFds; ze_result_t result = pProcfsAccess->listProcesses(processes); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "gpuProcessCleanup: listProcesses() failed with error code: %ld\n", result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "gpuProcessCleanup: listProcesses() failed with error code: %ld\n", result); return result; } @@ -296,7 +296,7 @@ ze_result_t LinuxSysmanImp::gpuProcessCleanup(ze_bool_t force) { if (force) { pProcfsAccess->kill(pid); } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Device in use by another process, returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Device in use by another process, returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE); return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } } @@ -429,28 +429,28 @@ ze_result_t LinuxSysmanImp::resizeVfBar(uint8_t size) { auto fdConfig = NEO::FileDescriptor(pciConfigNode.c_str(), O_RDWR); if (fdConfig < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, - "Config node open failed\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, + "Config node open failed\n"); return ZE_RESULT_ERROR_UNKNOWN; } std::unique_ptr configMemory = std::make_unique(PCI_CFG_SPACE_EXP_SIZE); memset(configMemory.get(), 0, PCI_CFG_SPACE_EXP_SIZE); if (this->preadFunction(fdConfig, configMemory.get(), PCI_CFG_SPACE_EXP_SIZE, 0) < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, - "Read to get config space failed\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, + "Read to get config space failed\n"); return ZE_RESULT_ERROR_UNKNOWN; } auto reBarCapPos = L0::LinuxPciImp::getRebarCapabilityPos(configMemory.get(), true); if (!reBarCapPos) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, - "VF BAR capability not found\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, + "VF BAR capability not found\n"); return ZE_RESULT_ERROR_UNKNOWN; } auto barSizePos = reBarCapPos + PCI_REBAR_CTRL + 1; // position of VF(0) BAR SIZE. if (this->pwriteFunction(fdConfig, &size, 0x01, barSizePos) < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, - "Write to change VF bar size failed\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, + "Write to change VF bar size failed\n"); return ZE_RESULT_ERROR_UNKNOWN; } return ZE_RESULT_SUCCESS; @@ -495,8 +495,8 @@ ze_result_t LinuxSysmanImp::osWarmReset() { if (NEO::debugManager.flags.DebugSetMemoryDiagnosticsDelay.get() != -1) { delayDurationForPPR = NEO::debugManager.flags.DebugSetMemoryDiagnosticsDelay.get(); } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, - "Delay of %d mins introduced to allow HBM IFR to complete\n", delayDurationForPPR); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, + "Delay of %d mins introduced to allow HBM IFR to complete\n", delayDurationForPPR); NEO::sleep(std::chrono::seconds(delayDurationForPPR * 60)); } else { NEO::sleep(std::chrono::seconds(10)); // Sleep for 10 seconds to make sure writing to bridge control offset is propagated. @@ -521,16 +521,16 @@ ze_result_t LinuxSysmanImp::osWarmReset() { result = pFsAccess->write(cardBusPath + '/' + "remove", "1"); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, - "Card Bus remove after resizing VF bar failed\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, + "Card Bus remove after resizing VF bar failed\n"); return result; } NEO::sleep(std::chrono::seconds(10)); // Sleep for 10seconds to make sure that the config spaces of all devices are saved correctly. result = pFsAccess->write(rootPortPath + '/' + "rescan", "1"); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, - "Rescanning root port failed after resizing VF bar failed\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, + "Rescanning root port failed after resizing VF bar failed\n"); return result; } NEO::sleep(std::chrono::seconds(10)); // Sleep for 10seconds, allows the rescan to complete on all devices attached to the root port. diff --git a/level_zero/tools/source/sysman/linux/pmt/pmt.cpp b/level_zero/tools/source/sysman/linux/pmt/pmt.cpp index 6daf340b33..cd540eba55 100644 --- a/level_zero/tools/source/sysman/linux/pmt/pmt.cpp +++ b/level_zero/tools/source/sysman/linux/pmt/pmt.cpp @@ -138,8 +138,8 @@ ze_result_t PlatformMonitoringTech::init(FsAccess *pFsAccess, const std::string telemetryDeviceEntry = baseTelemSysFSNode + "/" + telem; if (!pFsAccess->fileExists(telemetryDeviceEntry)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Telemetry support not available. No file %s\n", telemetryDeviceEntry.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Telemetry support not available. No file %s\n", telemetryDeviceEntry.c_str()); return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; } @@ -147,8 +147,8 @@ ze_result_t PlatformMonitoringTech::init(FsAccess *pFsAccess, const std::string std::string guidPath = baseTelemSysFSNode + std::string("/guid"); ze_result_t result = pFsAccess->read(guidPath, guid); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Telemetry sysfs entry not available %s\n", guidPath.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Telemetry sysfs entry not available %s\n", guidPath.c_str()); return result; } result = PlatformMonitoringTech::getKeyOffsetMap(std::move(guid), keyOffsetMap); @@ -160,8 +160,8 @@ ze_result_t PlatformMonitoringTech::init(FsAccess *pFsAccess, const std::string std::string offsetPath = baseTelemSysFSNode + std::string("/offset"); result = pFsAccess->read(offsetPath, baseOffset); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Telemetry sysfs entry not available %s\n", offsetPath.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Telemetry sysfs entry not available %s\n", offsetPath.c_str()); return result; } diff --git a/level_zero/tools/source/sysman/memory/linux/os_memory_imp.cpp b/level_zero/tools/source/sysman/memory/linux/os_memory_imp.cpp index 7e69ae12b4..adc67810aa 100644 --- a/level_zero/tools/source/sysman/memory/linux/os_memory_imp.cpp +++ b/level_zero/tools/source/sysman/memory/linux/os_memory_imp.cpp @@ -153,7 +153,7 @@ ze_result_t LinuxMemoryImp::getVFIDString(std::string &vfID) { std::string key = "VF0_VFID"; auto result = pPmt->readValue(key, vf0VfIdVal); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for VF0_VFID is returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for VF0_VFID is returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -161,7 +161,7 @@ ze_result_t LinuxMemoryImp::getVFIDString(std::string &vfID) { key = "VF1_VFID"; result = pPmt->readValue(std::move(key), vf1VfIdVal); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for VF1_VFID is returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for VF1_VFID is returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -171,7 +171,7 @@ ze_result_t LinuxMemoryImp::getVFIDString(std::string &vfID) { // Lets assume and report this as a error condition if (((vf0VfIdVal == 0) && (vf1VfIdVal == 0)) || ((vf0VfIdVal > 0) && (vf1VfIdVal > 0))) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() VF0 returning 0x%x and VF1 returning 0x%x as both should not be the same \n", __FUNCTION__, vf0VfIdVal, vf1VfIdVal); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() VF0 returning 0x%x and VF1 returning 0x%x as both should not be the same \n", __FUNCTION__, vf0VfIdVal, vf1VfIdVal); return ZE_RESULT_ERROR_UNKNOWN; } @@ -196,7 +196,7 @@ ze_result_t LinuxMemoryImp::readMcChannelCounters(uint64_t &readCounters, uint64 std::string readCounterKey = nameOfCounters[counterIndex] + "[" + std::to_string(mcChannelIndex) + "]"; result = pPmt->readValue(std::move(readCounterKey), val); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for readCounterKey returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for readCounterKey returning error:0x%x \n", __FUNCTION__, result); return result; } counterValues[counterIndex] += val; @@ -237,7 +237,7 @@ ze_result_t LinuxMemoryImp::getBandwidthForDg2(zes_mem_bandwidth_t *pBandwidth) pBandwidth->maxBandwidth = 0; ze_result_t result = readMcChannelCounters(pBandwidth->readCounter, pBandwidth->writeCounter); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readMcChannelCounters returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readMcChannelCounters returning error:0x%x \n", __FUNCTION__, result); return result; } pBandwidth->maxBandwidth = 0u; @@ -245,7 +245,7 @@ ze_result_t LinuxMemoryImp::getBandwidthForDg2(zes_mem_bandwidth_t *pBandwidth) uint64_t maxBw = 0; result = pSysfsAccess->read(std::move(maxBwFile), maxBw); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pSysfsAccess->read returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pSysfsAccess->read returning error:0x%x \n", __FUNCTION__, result); } pBandwidth->maxBandwidth = maxBw * mbpsToBytesPerSecond; pBandwidth->timestamp = SysmanDevice::getSysmanTimestamp(); @@ -261,7 +261,7 @@ ze_result_t LinuxMemoryImp::getHbmBandwidth(uint32_t numHbmModules, zes_mem_band std::string vfId = ""; result = getVFIDString(vfId); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():getVFIDString returning error:0x%x while retrieving VFID string \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():getVFIDString returning error:0x%x while retrieving VFID string \n", __FUNCTION__, result); return result; } auto &hwInfo = pDevice->getNEODevice()->getHardwareInfo(); @@ -274,7 +274,7 @@ ze_result_t LinuxMemoryImp::getHbmBandwidth(uint32_t numHbmModules, zes_mem_band std::string readCounterKey = vfId + "_HBM" + std::to_string(hbmModuleIndex) + "_READ"; result = pPmt->readValue(std::move(readCounterKey), counterValue); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for readCounterKey returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for readCounterKey returning error:0x%x \n", __FUNCTION__, result); return result; } pBandwidth->readCounter += counterValue; @@ -284,7 +284,7 @@ ze_result_t LinuxMemoryImp::getHbmBandwidth(uint32_t numHbmModules, zes_mem_band std::string writeCounterKey = vfId + "_HBM" + std::to_string(hbmModuleIndex) + "_WRITE"; result = pPmt->readValue(std::move(writeCounterKey), counterValue); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for writeCounterKey returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for writeCounterKey returning error:0x%x \n", __FUNCTION__, result); return result; } pBandwidth->writeCounter += counterValue; @@ -314,7 +314,7 @@ ze_result_t LinuxMemoryImp::getHbmBandwidthPVC(uint32_t numHbmModules, zes_mem_b std::string vfId = ""; result = getVFIDString(vfId); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():getVFIDString returning error:0x%x while retrieving VFID string \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():getVFIDString returning error:0x%x while retrieving VFID string \n", __FUNCTION__, result); return result; } auto &hwInfo = pDevice->getNEODevice()->getHardwareInfo(); @@ -326,7 +326,7 @@ ze_result_t LinuxMemoryImp::getHbmBandwidthPVC(uint32_t numHbmModules, zes_mem_b std::string readCounterKey = vfId + "_HBM_READ_L"; result = pPmt->readValue(readCounterKey, readCounterL); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for readCounterL returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for readCounterL returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -334,7 +334,7 @@ ze_result_t LinuxMemoryImp::getHbmBandwidthPVC(uint32_t numHbmModules, zes_mem_b readCounterKey = vfId + "_HBM_READ_H"; result = pPmt->readValue(std::move(readCounterKey), readCounterH); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for readCounterH returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for readCounterH returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -347,7 +347,7 @@ ze_result_t LinuxMemoryImp::getHbmBandwidthPVC(uint32_t numHbmModules, zes_mem_b std::string writeCounterKey = vfId + "_HBM_WRITE_L"; result = pPmt->readValue(writeCounterKey, writeCounterL); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for writeCounterL returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for writeCounterL returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -355,7 +355,7 @@ ze_result_t LinuxMemoryImp::getHbmBandwidthPVC(uint32_t numHbmModules, zes_mem_b writeCounterKey = vfId + "_HBM_WRITE_H"; result = pPmt->readValue(std::move(writeCounterKey), writeCounterH); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for writeCounterH returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for writeCounterH returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -433,8 +433,8 @@ ze_result_t LinuxMemoryImp::getState(zes_mem_state_t *pState) { if (errno == ENODEV) { status = ZE_RESULT_ERROR_DEVICE_LOST; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "Error@ %s():createMemoryInfo failed errno:%d \n", __FUNCTION__, errno); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Error@ %s():createMemoryInfo failed errno:%d \n", __FUNCTION__, errno); } return status; } diff --git a/level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp b/level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp index 81f39b96a8..26bf07dd5b 100644 --- a/level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp +++ b/level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp @@ -34,7 +34,7 @@ ze_result_t LinuxPciImp::getPciBdf(zes_pci_properties_t &pciProperties) { std::string bdfDir; ze_result_t result = pSysfsAccess->readSymLink(deviceDir, bdfDir); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): readSymLink() failed to retrieve BDF from %s and returning error:0x%x \n", __FUNCTION__, deviceDir.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): readSymLink() failed to retrieve BDF from %s and returning error:0x%x \n", __FUNCTION__, deviceDir.c_str(), result); return result; } const auto loc = bdfDir.find_last_of('/'); @@ -97,7 +97,7 @@ ze_result_t LinuxPciImp::initializeBarProperties(std::vector readBytes; ze_result_t result = pSysfsAccess->read(resourceFile, readBytes); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): read() failed to read %s and returning error:0x%x \n", __FUNCTION__, resourceFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): read() failed to read %s and returning error:0x%x \n", __FUNCTION__, resourceFile.c_str(), result); return result; } for (uint32_t i = 0; i <= maxPciBars; i++) { @@ -125,7 +125,7 @@ ze_result_t LinuxPciImp::initializeBarProperties(std::vectorgetRealPath("device/config", pciConfigNode); std::vector configMemory(PCI_CFG_SPACE_EXP_SIZE); if (!getPciConfigMemory(std::move(pciConfigNode), configMemory)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Unable to get pci config space \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Unable to get pci config space \n", __FUNCTION__); return false; } return (L0::LinuxPciImp::getRebarCapabilityPos(configMemory.data(), false) > 0); @@ -220,7 +220,7 @@ bool LinuxPciImp::resizableBarEnabled(uint32_t barIndex) { pSysfsAccess->getRealPath("device/config", pciConfigNode); std::vector configMemory(PCI_CFG_SPACE_EXP_SIZE); if (!getPciConfigMemory(std::move(pciConfigNode), configMemory)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Unable to get pci config space \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Unable to get pci config space \n", __FUNCTION__); return false; } @@ -285,23 +285,23 @@ bool LinuxPciImp::resizableBarEnabled(uint32_t barIndex) { } ze_result_t LinuxPciImp::getState(zes_pci_state_t *state) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } bool LinuxPciImp::getPciConfigMemory(std::string pciPath, std::vector &configMem) { if (!pSysfsAccess->isRootUser()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Need to be root to read config space \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Need to be root to read config space \n", __FUNCTION__); return false; } auto fd = NEO::FileDescriptor(pciPath.c_str(), O_RDONLY); if (fd < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() Config File Open Failed \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() Config File Open Failed \n", __FUNCTION__); return false; } if (this->preadFunction(fd, configMem.data(), configMem.size(), 0) < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() Config Mem Read Failed \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() Config Mem Read Failed \n", __FUNCTION__); return false; } return true; diff --git a/level_zero/tools/source/sysman/performance/linux/os_performance_imp.cpp b/level_zero/tools/source/sysman/performance/linux/os_performance_imp.cpp index 9f340ccd83..ab092f7b6b 100644 --- a/level_zero/tools/source/sysman/performance/linux/os_performance_imp.cpp +++ b/level_zero/tools/source/sysman/performance/linux/os_performance_imp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -12,22 +12,22 @@ namespace L0 { ze_result_t LinuxPerformanceImp::osPerformanceGetProperties(zes_perf_properties_t &pProperties) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } ze_result_t LinuxPerformanceImp::osPerformanceGetConfig(double *pFactor) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } ze_result_t LinuxPerformanceImp::osPerformanceSetConfig(double pFactor) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } bool LinuxPerformanceImp::isPerformanceSupported(void) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return false; } diff --git a/level_zero/tools/source/sysman/performance/linux/os_performance_imp_prelim.cpp b/level_zero/tools/source/sysman/performance/linux/os_performance_imp_prelim.cpp index 0fd8170e6b..82043064ce 100644 --- a/level_zero/tools/source/sysman/performance/linux/os_performance_imp_prelim.cpp +++ b/level_zero/tools/source/sysman/performance/linux/os_performance_imp_prelim.cpp @@ -32,7 +32,7 @@ ze_result_t LinuxPerformanceImp::osPerformanceGetProperties(zes_perf_properties_ ze_result_t LinuxPerformanceImp::getBaseScaleFactor() { auto result = pSysfsAccess->read(baseScale, baseScaleReading); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, baseScale.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, baseScale.c_str(), getErrorCode(result)); return getErrorCode(result); } return ZE_RESULT_SUCCESS; @@ -41,7 +41,7 @@ ze_result_t LinuxPerformanceImp::getBaseScaleFactor() { ze_result_t LinuxPerformanceImp::getMediaScaleFactor() { auto result = pSysfsAccess->read(mediaScale, mediaScaleReading); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, mediaScale.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, mediaScale.c_str(), getErrorCode(result)); return getErrorCode(result); } return ZE_RESULT_SUCCESS; @@ -57,7 +57,7 @@ ze_result_t LinuxPerformanceImp::osPerformanceGetConfig(double *pFactor) { case ZES_ENGINE_TYPE_FLAG_OTHER: result = pSysfsAccess->read(sysPwrBalance, sysPwrBalanceReading); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, sysPwrBalance.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, sysPwrBalance.c_str(), getErrorCode(result)); return getErrorCode(result); } if (sysPwrBalanceReading >= 0 && sysPwrBalanceReading <= 16.0) { @@ -71,7 +71,7 @@ ze_result_t LinuxPerformanceImp::osPerformanceGetConfig(double *pFactor) { case ZES_ENGINE_TYPE_FLAG_MEDIA: result = pSysfsAccess->read(mediaFreqFactor, mediaFactorReading); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, mediaFreqFactor.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, mediaFreqFactor.c_str(), getErrorCode(result)); return getErrorCode(result); } multiplier = (mediaFactorReading * mediaScaleReading); // Value retrieved from media_freq_factor file is in U(fixed point decimal) format convert it into decimal by multiplication with scale factor @@ -82,14 +82,14 @@ ze_result_t LinuxPerformanceImp::osPerformanceGetConfig(double *pFactor) { } else if (multiplier == 0) { *pFactor = minPerformanceFactor; } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): multiper:%d for MEDIA is not matching with given presets and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNKNOWN); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): multiper:%d for MEDIA is not matching with given presets and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNKNOWN); result = ZE_RESULT_ERROR_UNKNOWN; } break; case ZES_ENGINE_TYPE_FLAG_COMPUTE: result = pSysfsAccess->read(baseFreqFactor, baseFactorReading); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, baseFreqFactor.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s and returning error:0x%x \n", __FUNCTION__, baseFreqFactor.c_str(), getErrorCode(result)); return getErrorCode(result); } multiplier = (baseFactorReading * baseScaleReading); // Value retrieved from base_freq_factor file is in U(fixed point decimal) format convert it into decimal by multiplication with scale factor @@ -98,12 +98,12 @@ ze_result_t LinuxPerformanceImp::osPerformanceGetConfig(double *pFactor) { } else if (multiplier > 1 && multiplier <= 2) { *pFactor = (2 - multiplier) * 50; } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): multiper:%d for COMPUTE is not matching with given presets and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNKNOWN); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): multiper:%d for COMPUTE is not matching with given presets and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNKNOWN); result = ZE_RESULT_ERROR_UNKNOWN; } break; default: - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; break; } @@ -158,7 +158,7 @@ ze_result_t LinuxPerformanceImp::osPerformanceSetConfig(double pFactor) { result = pSysfsAccess->write(baseFreqFactor, multiplier); break; default: - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; break; } @@ -170,13 +170,13 @@ bool LinuxPerformanceImp::isPerformanceSupported(void) { switch (domain) { case ZES_ENGINE_TYPE_FLAG_OTHER: if (pSysfsAccess->canRead(sysPwrBalance) != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_OTHER returns false \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_OTHER returns false \n", __FUNCTION__); return false; } break; case ZES_ENGINE_TYPE_FLAG_MEDIA: if (pSysfsAccess->canRead(mediaFreqFactor) != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_MEDIA returns false \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_MEDIA returns false \n", __FUNCTION__); return false; } if (getMediaScaleFactor() != ZE_RESULT_SUCCESS) { @@ -185,7 +185,7 @@ bool LinuxPerformanceImp::isPerformanceSupported(void) { break; case ZES_ENGINE_TYPE_FLAG_COMPUTE: if (pSysfsAccess->canRead(baseFreqFactor) != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_COMPUTE returns false \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): ZES_ENGINE_TYPE_FLAG_COMPUTE returns false \n", __FUNCTION__); return false; } if (getBaseScaleFactor() != ZE_RESULT_SUCCESS) { diff --git a/level_zero/tools/source/sysman/power/linux/os_power_imp.cpp b/level_zero/tools/source/sysman/power/linux/os_power_imp.cpp index dbda7bb9b3..f6ca3f2059 100644 --- a/level_zero/tools/source/sysman/power/linux/os_power_imp.cpp +++ b/level_zero/tools/source/sysman/power/linux/os_power_imp.cpp @@ -57,7 +57,7 @@ ze_result_t LinuxPowerImp::getProperties(zes_power_properties_t *pProperties) { } ze_result_t LinuxPowerImp::getPropertiesExt(zes_power_ext_properties_t *pExtPoperties) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -79,7 +79,7 @@ ze_result_t LinuxPowerImp::getEnergyCounter(zes_power_energy_counter_t *pEnergy) } } if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), energyCounterNode.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), energyCounterNode.c_str(), getErrorCode(result)); return getErrorCode(result); } return result; @@ -91,7 +91,7 @@ ze_result_t LinuxPowerImp::getLimits(zes_power_sustained_limit_t *pSustained, ze if (pSustained != nullptr) { result = pSysfsAccess->read(i915HwmonDir + "/" + sustainedPowerLimitEnabled, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimitEnabled.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimitEnabled.c_str(), getErrorCode(result)); return getErrorCode(result); } pSustained->enabled = static_cast(val); @@ -100,7 +100,7 @@ ze_result_t LinuxPowerImp::getLimits(zes_power_sustained_limit_t *pSustained, ze val = 0; result = pSysfsAccess->read(i915HwmonDir + "/" + sustainedPowerLimit, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimit.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimit.c_str(), getErrorCode(result)); return getErrorCode(result); } val /= milliFactor; // Convert microWatts to milliwatts @@ -109,7 +109,7 @@ ze_result_t LinuxPowerImp::getLimits(zes_power_sustained_limit_t *pSustained, ze val = 0; result = pSysfsAccess->read(i915HwmonDir + "/" + sustainedPowerLimitInterval, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimitInterval.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimitInterval.c_str(), getErrorCode(result)); return getErrorCode(result); } pSustained->interval = static_cast(val); @@ -118,7 +118,7 @@ ze_result_t LinuxPowerImp::getLimits(zes_power_sustained_limit_t *pSustained, ze if (pBurst != nullptr) { result = pSysfsAccess->read(i915HwmonDir + "/" + burstPowerLimitEnabled, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), burstPowerLimitEnabled.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), burstPowerLimitEnabled.c_str(), getErrorCode(result)); return getErrorCode(result); } pBurst->enabled = static_cast(val); @@ -126,7 +126,7 @@ ze_result_t LinuxPowerImp::getLimits(zes_power_sustained_limit_t *pSustained, ze if (pBurst->enabled) { result = pSysfsAccess->read(i915HwmonDir + "/" + burstPowerLimit, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), burstPowerLimit.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), burstPowerLimit.c_str(), getErrorCode(result)); return getErrorCode(result); } val /= milliFactor; // Convert microWatts to milliwatts @@ -148,13 +148,13 @@ ze_result_t LinuxPowerImp::setLimits(const zes_power_sustained_limit_t *pSustain uint64_t isSustainedPowerLimitEnabled = 0; result = pSysfsAccess->read(i915HwmonDir + "/" + sustainedPowerLimitEnabled, isSustainedPowerLimitEnabled); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimitEnabled.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimitEnabled.c_str(), getErrorCode(result)); return getErrorCode(result); } if (isSustainedPowerLimitEnabled != static_cast(pSustained->enabled)) { result = pSysfsAccess->write(i915HwmonDir + "/" + sustainedPowerLimitEnabled, static_cast(pSustained->enabled)); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimitEnabled.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimitEnabled.c_str(), getErrorCode(result)); return getErrorCode(result); } isSustainedPowerLimitEnabled = static_cast(pSustained->enabled); @@ -164,13 +164,13 @@ ze_result_t LinuxPowerImp::setLimits(const zes_power_sustained_limit_t *pSustain val = static_cast(pSustained->power) * milliFactor; // Convert milliWatts to microwatts result = pSysfsAccess->write(i915HwmonDir + "/" + sustainedPowerLimit, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimit.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimit.c_str(), getErrorCode(result)); return getErrorCode(result); } result = pSysfsAccess->write(i915HwmonDir + "/" + sustainedPowerLimitInterval, pSustained->interval); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimitInterval.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimitInterval.c_str(), getErrorCode(result)); return getErrorCode(result); } } @@ -179,7 +179,7 @@ ze_result_t LinuxPowerImp::setLimits(const zes_power_sustained_limit_t *pSustain if (pBurst != nullptr) { result = pSysfsAccess->write(i915HwmonDir + "/" + burstPowerLimitEnabled, static_cast(pBurst->enabled)); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), burstPowerLimitEnabled.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), burstPowerLimitEnabled.c_str(), getErrorCode(result)); return getErrorCode(result); } @@ -187,7 +187,7 @@ ze_result_t LinuxPowerImp::setLimits(const zes_power_sustained_limit_t *pSustain val = static_cast(pBurst->power) * milliFactor; // Convert milliWatts to microwatts result = pSysfsAccess->write(i915HwmonDir + "/" + burstPowerLimit, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), burstPowerLimit.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), burstPowerLimit.c_str(), getErrorCode(result)); return getErrorCode(result); } } @@ -196,22 +196,22 @@ ze_result_t LinuxPowerImp::setLimits(const zes_power_sustained_limit_t *pSustain } ze_result_t LinuxPowerImp::getEnergyThreshold(zes_energy_threshold_t *pThreshold) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } ze_result_t LinuxPowerImp::setEnergyThreshold(double threshold) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } ze_result_t LinuxPowerImp::getLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } ze_result_t LinuxPowerImp::setLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/level_zero/tools/source/sysman/power/linux/os_power_imp_prelim.cpp b/level_zero/tools/source/sysman/power/linux/os_power_imp_prelim.cpp index 6b0e43c71a..e9d6582905 100644 --- a/level_zero/tools/source/sysman/power/linux/os_power_imp_prelim.cpp +++ b/level_zero/tools/source/sysman/power/linux/os_power_imp_prelim.cpp @@ -51,7 +51,7 @@ ze_result_t LinuxPowerImp::getDefaultLimit(int32_t &defaultLimit) { uint64_t powerLimit = 0; auto result = pSysfsAccess->read(i915HwmonDir + "/" + defaultPowerLimit, powerLimit); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), defaultPowerLimit.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), defaultPowerLimit.c_str(), getErrorCode(result)); return getErrorCode(result); } @@ -69,7 +69,7 @@ ze_result_t LinuxPowerImp::getPropertiesExt(zes_power_ext_properties_t *pExtPope if (result == ZE_RESULT_SUCCESS) { pExtPoperties->defaultLimit->limit = static_cast(val / milliFactor); // need to convert from microwatt to milliwatt } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), defaultPowerLimit.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), defaultPowerLimit.c_str(), getErrorCode(result)); return getErrorCode(result); } } else { @@ -103,7 +103,7 @@ ze_result_t LinuxPowerImp::getEnergyCounter(zes_power_energy_counter_t *pEnergy) } } if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), energyCounterNode.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), energyCounterNode.c_str(), getErrorCode(result)); return getErrorCode(result); } return result; @@ -117,7 +117,7 @@ ze_result_t LinuxPowerImp::getLimits(zes_power_sustained_limit_t *pSustained, ze val = 0; result = pSysfsAccess->read(i915HwmonDir + "/" + sustainedPowerLimit, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimit.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimit.c_str(), getErrorCode(result)); return getErrorCode(result); } val /= milliFactor; // Convert microwatts to milliwatts @@ -132,7 +132,7 @@ ze_result_t LinuxPowerImp::getLimits(zes_power_sustained_limit_t *pSustained, ze if (pPeak != nullptr) { result = pSysfsAccess->read(i915HwmonDir + "/" + criticalPowerLimit, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), criticalPowerLimit.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), criticalPowerLimit.c_str(), getErrorCode(result)); return getErrorCode(result); } val /= milliFactor; // Convert microwatts to milliwatts @@ -152,7 +152,7 @@ ze_result_t LinuxPowerImp::setLimits(const zes_power_sustained_limit_t *pSustain val = static_cast(pSustained->power) * milliFactor; // Convert milliwatts to microwatts result = pSysfsAccess->write(i915HwmonDir + "/" + sustainedPowerLimit, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimit.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimit.c_str(), getErrorCode(result)); return getErrorCode(result); } } @@ -160,7 +160,7 @@ ze_result_t LinuxPowerImp::setLimits(const zes_power_sustained_limit_t *pSustain val = static_cast(pPeak->powerAC) * milliFactor; // Convert milliwatts to microwatts result = pSysfsAccess->write(i915HwmonDir + "/" + criticalPowerLimit, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), criticalPowerLimit.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), criticalPowerLimit.c_str(), getErrorCode(result)); return getErrorCode(result); } } @@ -181,14 +181,14 @@ ze_result_t LinuxPowerImp::getLimitsExt(uint32_t *pCount, zes_power_limit_ext_de if (count < *pCount) { result = pSysfsAccess->read(i915HwmonDir + "/" + sustainedPowerLimit, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimit.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimit.c_str(), getErrorCode(result)); return getErrorCode(result); } int32_t interval = 0; result = pSysfsAccess->read(i915HwmonDir + "/" + sustainedPowerLimitInterval, interval); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimitInterval.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimitInterval.c_str(), getErrorCode(result)); return getErrorCode(result); } @@ -207,7 +207,7 @@ ze_result_t LinuxPowerImp::getLimitsExt(uint32_t *pCount, zes_power_limit_ext_de if (count < *pCount) { result = pSysfsAccess->read(i915HwmonDir + "/" + criticalPowerLimit, val); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), criticalPowerLimit.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->read() failed to read %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), criticalPowerLimit.c_str(), getErrorCode(result)); return getErrorCode(result); } pSustained[count].enabledStateLocked = true; @@ -238,13 +238,13 @@ ze_result_t LinuxPowerImp::setLimitsExt(uint32_t *pCount, zes_power_limit_ext_de val = static_cast(pSustained[i].limit) * milliFactor; // Convert milliwatts to microwatts result = pSysfsAccess->write(i915HwmonDir + "/" + sustainedPowerLimit, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimit.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimit.c_str(), getErrorCode(result)); return getErrorCode(result); } result = pSysfsAccess->write(i915HwmonDir + "/" + sustainedPowerLimitInterval, pSustained[i].interval); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimitInterval.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), sustainedPowerLimitInterval.c_str(), getErrorCode(result)); return getErrorCode(result); } } else if (pSustained[i].level == ZES_POWER_LEVEL_PEAK) { @@ -255,11 +255,11 @@ ze_result_t LinuxPowerImp::setLimitsExt(uint32_t *pCount, zes_power_limit_ext_de } result = pSysfsAccess->write(i915HwmonDir + "/" + criticalPowerLimit, val); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), criticalPowerLimit.c_str(), getErrorCode(result)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): SysfsAccess->write() failed to write into %s/%s and returning error:0x%x \n", __FUNCTION__, i915HwmonDir.c_str(), criticalPowerLimit.c_str(), getErrorCode(result)); return getErrorCode(result); } } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } } @@ -269,12 +269,12 @@ ze_result_t LinuxPowerImp::setLimitsExt(uint32_t *pCount, zes_power_limit_ext_de } ze_result_t LinuxPowerImp::getEnergyThreshold(zes_energy_threshold_t *pThreshold) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } ze_result_t LinuxPowerImp::setEnergyThreshold(double threshold) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/level_zero/tools/source/sysman/ras/linux/os_ras_imp.cpp b/level_zero/tools/source/sysman/ras/linux/os_ras_imp.cpp index c88e495912..082d6eb33e 100644 --- a/level_zero/tools/source/sysman/ras/linux/os_ras_imp.cpp +++ b/level_zero/tools/source/sysman/ras/linux/os_ras_imp.cpp @@ -50,7 +50,7 @@ ze_result_t LinuxRasImp::osRasSetConfig(const zes_ras_config_t *config) { memcpy_s(categoryThreshold, maxRasErrorCategoryCount * sizeof(uint64_t), config->detailedThresholds.category, maxRasErrorCategoryCount * sizeof(uint64_t)); return ZE_RESULT_SUCCESS; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Insufficient permissions and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Insufficient permissions and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS); return ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS; } @@ -65,7 +65,7 @@ ze_result_t LinuxRasImp::osRasGetProperties(zes_ras_properties_t &properties) { ze_result_t LinuxRasImp::osRasGetState(zes_ras_state_t &state, ze_bool_t clear) { if (clear == true) { if (pFsAccess->isRootUser() == false) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Insufficient permissions and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Insufficient permissions and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS); return ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS; } } @@ -120,7 +120,7 @@ ze_result_t LinuxRasImp::osRasGetStateExp(uint32_t *pCount, zes_ras_state_exp_t ze_result_t LinuxRasImp::osRasClearStateExp(zes_ras_error_category_exp_t category) { if (pFsAccess->isRootUser() == false) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Insufficient permissions and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Insufficient permissions and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS); return ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS; } diff --git a/level_zero/tools/source/sysman/ras/linux/os_ras_imp_gt.cpp b/level_zero/tools/source/sysman/ras/linux/os_ras_imp_gt.cpp index 33e5b8d31f..21041f40bd 100644 --- a/level_zero/tools/source/sysman/ras/linux/os_ras_imp_gt.cpp +++ b/level_zero/tools/source/sysman/ras/linux/os_ras_imp_gt.cpp @@ -82,7 +82,7 @@ static ze_result_t readI915EventsDirectory(LinuxSysmanImp *pLinuxSysmanImp, std: std::string bdfDir; ze_result_t result = pSysfsAccess->readSymLink(deviceDir, bdfDir); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Symlink from %s and returning error:0x%x \n", __FUNCTION__, deviceDir.c_str(), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Symlink from %s and returning error:0x%x \n", __FUNCTION__, deviceDir.c_str(), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } const auto loc = bdfDir.find_last_of('/'); @@ -96,7 +96,7 @@ static ze_result_t readI915EventsDirectory(LinuxSysmanImp *pLinuxSysmanImp, std: FsAccess *pFsAccess = &pLinuxSysmanImp->getFsAccess(); result = pFsAccess->listDirectory(sysfsNode, listOfEvents); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to list directories from %s and returning error:0x%x \n", __FUNCTION__, sysfsNode.c_str(), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to list directories from %s and returning error:0x%x \n", __FUNCTION__, sysfsNode.c_str(), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return ZE_RESULT_SUCCESS; @@ -260,7 +260,7 @@ ze_result_t LinuxRasSourceGt::getPmuConfig( std::string &pmuConfig) { auto findErrorInList = std::find(listOfEvents.begin(), listOfEvents.end(), errorFileToGetConfig); if (findErrorInList == listOfEvents.end()) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to find %s from list of events and returning error:0x%x \n", __FUNCTION__, errorFileToGetConfig.c_str(), ZE_RESULT_ERROR_UNKNOWN); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to find %s from list of events and returning error:0x%x \n", __FUNCTION__, errorFileToGetConfig.c_str(), ZE_RESULT_ERROR_UNKNOWN); return ZE_RESULT_ERROR_UNKNOWN; } return pFsAccess->read(eventDirectory + "/" + errorFileToGetConfig, pmuConfig); diff --git a/level_zero/tools/source/sysman/ras/linux/os_ras_imp_hbm.cpp b/level_zero/tools/source/sysman/ras/linux/os_ras_imp_hbm.cpp index 0068de0d99..437befe74d 100644 --- a/level_zero/tools/source/sysman/ras/linux/os_ras_imp_hbm.cpp +++ b/level_zero/tools/source/sysman/ras/linux/os_ras_imp_hbm.cpp @@ -35,7 +35,7 @@ ze_result_t LinuxRasSourceHbm::osRasGetState(zes_ras_state_t &state, ze_bool_t c uint64_t errorCount = 0; ze_result_t result = getMemoryErrorCountFromFw(osRasErrorType, this->subDeviceCount, errorCount); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting fwGetMemoryErrorCount() for RasErrorType:%d, SubDeviceCount:%d, SubdeviceId:%d, errorBaseline update:%d and returning error:0x%x \n", __FUNCTION__, osRasErrorType, subDeviceCount, subdeviceId, clear, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting fwGetMemoryErrorCount() for RasErrorType:%d, SubDeviceCount:%d, SubdeviceId:%d, errorBaseline update:%d and returning error:0x%x \n", __FUNCTION__, osRasErrorType, subDeviceCount, subdeviceId, clear, result); return result; } errorBaseline = errorCount; // during clear update the error baseline value @@ -43,7 +43,7 @@ ze_result_t LinuxRasSourceHbm::osRasGetState(zes_ras_state_t &state, ze_bool_t c uint64_t errorCount = 0; ze_result_t result = getMemoryErrorCountFromFw(osRasErrorType, this->subDeviceCount, errorCount); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting fwGetMemoryErrorCount() for RasErrorType:%d, SubDeviceCount:%d, SubdeviceId:%d, errorBaseline update:%d and returning error:0x%x \n", __FUNCTION__, osRasErrorType, subDeviceCount, subdeviceId, clear, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed while getting fwGetMemoryErrorCount() for RasErrorType:%d, SubDeviceCount:%d, SubdeviceId:%d, errorBaseline update:%d and returning error:0x%x \n", __FUNCTION__, osRasErrorType, subDeviceCount, subdeviceId, clear, result); return result; } state.category[ZES_RAS_ERROR_CAT_NON_COMPUTE_ERRORS] = errorCount - errorBaseline; diff --git a/level_zero/tools/source/sysman/scheduler/linux/os_scheduler_imp.cpp b/level_zero/tools/source/sysman/scheduler/linux/os_scheduler_imp.cpp index 3ef3433381..a7d6c08944 100644 --- a/level_zero/tools/source/sysman/scheduler/linux/os_scheduler_imp.cpp +++ b/level_zero/tools/source/sysman/scheduler/linux/os_scheduler_imp.cpp @@ -44,17 +44,17 @@ ze_result_t LinuxSchedulerImp::getCurrentMode(zes_sched_mode_t *pMode) { uint64_t heartbeat = 0; ze_result_t result = getPreemptTimeout(timeout, false); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get preempt timeout and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } result = getTimesliceDuration(timeslice, false); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get timeslice duration and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get timeslice duration and returning error:0x%x \n", __FUNCTION__, result); return result; } result = getHeartbeatInterval(heartbeat, false); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get heartbeat interval and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get heartbeat interval and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -86,12 +86,12 @@ ze_result_t LinuxSchedulerImp::setExclusiveModeImp() { uint64_t timeslice = 0, timeout = 0, heartbeat = 0; ze_result_t result = setPreemptTimeout(timeout); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } result = setTimesliceDuration(timeslice); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set timeslice duration and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set timeslice duration and returning error:0x%x \n", __FUNCTION__, result); return result; } result = setHeartbeatInterval(heartbeat); @@ -104,7 +104,7 @@ ze_result_t LinuxSchedulerImp::setExclusiveMode(ze_bool_t *pNeedReload) { zes_sched_mode_t currMode; ze_result_t result = getCurrentMode(&currMode); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -112,7 +112,7 @@ ze_result_t LinuxSchedulerImp::setExclusiveMode(ze_bool_t *pNeedReload) { // Unset this mode result = disableComputeUnitDebugMode(pNeedReload); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to disable COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to disable COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); return result; } } @@ -124,7 +124,7 @@ ze_result_t LinuxSchedulerImp::getTimeoutModeProperties(ze_bool_t getDefaults, z uint64_t heartbeat = 0; ze_result_t result = getHeartbeatInterval(heartbeat, getDefaults); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get heart beat interval and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get heart beat interval and returning error:0x%x \n", __FUNCTION__, result); return result; } pConfig->watchdogTimeout = heartbeat; @@ -136,12 +136,12 @@ ze_result_t LinuxSchedulerImp::getTimesliceModeProperties(ze_bool_t getDefaults, uint64_t timeout = 0, timeslice = 0; ze_result_t result = getPreemptTimeout(timeout, getDefaults); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get preempt timeout and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } result = getTimesliceDuration(timeslice, getDefaults); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get timeslice duration and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get timeslice duration and returning error:0x%x \n", __FUNCTION__, result); return result; } pConfig->interval = timeslice; @@ -154,7 +154,7 @@ ze_result_t LinuxSchedulerImp::setTimeoutMode(zes_sched_timeout_properties_t *pP zes_sched_mode_t currMode; ze_result_t result = getCurrentMode(&currMode); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -169,28 +169,28 @@ ze_result_t LinuxSchedulerImp::setTimeoutMode(zes_sched_timeout_properties_t *pP // Unset this mode result = disableComputeUnitDebugMode(pNeedReload); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to disable COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to disable COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); return result; } } result = setHeartbeatInterval(pProperties->watchdogTimeout); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set heartbeat interval and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set heartbeat interval and returning error:0x%x \n", __FUNCTION__, result); return result; } uint64_t timeout = (pProperties->watchdogTimeout) / 5; result = setPreemptTimeout(timeout); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } uint64_t timeslice = 0; result = setTimesliceDuration(timeslice); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set timeslice duration and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set timeslice duration and returning error:0x%x \n", __FUNCTION__, result); return result; } return result; @@ -207,7 +207,7 @@ ze_result_t LinuxSchedulerImp::setTimesliceMode(zes_sched_timeslice_properties_t zes_sched_mode_t currMode; ze_result_t result = getCurrentMode(&currMode); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -215,19 +215,19 @@ ze_result_t LinuxSchedulerImp::setTimesliceMode(zes_sched_timeslice_properties_t // Unset this mode result = disableComputeUnitDebugMode(pNeedReload); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to disable COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to disable COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); return result; } } result = setPreemptTimeout(pProperties->yieldTimeout); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } result = setTimesliceDuration(pProperties->interval); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set timeslice duration and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set timeslice duration and returning error:0x%x \n", __FUNCTION__, result); return result; } uint64_t heartbeat = 2500 * (pProperties->interval); @@ -256,7 +256,7 @@ ze_result_t LinuxSchedulerImp::getPreemptTimeout(uint64_t &timeout, ze_bool_t ge if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read preempt timeout from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read preempt timeout from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); return result; } } @@ -291,7 +291,7 @@ ze_result_t LinuxSchedulerImp::getTimesliceDuration(uint64_t ×lice, ze_bool if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read timeslice duration from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read timeslice duration from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); return result; } } @@ -326,7 +326,7 @@ ze_result_t LinuxSchedulerImp::getHeartbeatInterval(uint64_t &heartbeat, ze_bool if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read heartbeat interval from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read heartbeat interval from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); return result; } } @@ -348,7 +348,7 @@ ze_result_t LinuxSchedulerImp::setPreemptTimeout(uint64_t timeout) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write Preempt timeout into engineDir/%s/preemptTimeoutMilliSecs and returning error:0x%x \n", __FUNCTION__, engineName.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write Preempt timeout into engineDir/%s/preemptTimeoutMilliSecs and returning error:0x%x \n", __FUNCTION__, engineName.c_str(), result); return result; } } @@ -364,7 +364,7 @@ ze_result_t LinuxSchedulerImp::setTimesliceDuration(uint64_t timeslice) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write Timeslice duration into engineDir/%s/timesliceDurationMilliSecs and returning error:0x%x \n", __FUNCTION__, engineName.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write Timeslice duration into engineDir/%s/timesliceDurationMilliSecs and returning error:0x%x \n", __FUNCTION__, engineName.c_str(), result); return result; } } @@ -380,7 +380,7 @@ ze_result_t LinuxSchedulerImp::setHeartbeatInterval(uint64_t heartbeat) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write Heartbeat interval into engineDir/%s/heartbeatIntervalMilliSecs and returning error:0x%x \n", __FUNCTION__, engineName.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write Heartbeat interval into engineDir/%s/heartbeatIntervalMilliSecs and returning error:0x%x \n", __FUNCTION__, engineName.c_str(), result); return result; } } @@ -412,7 +412,7 @@ static ze_result_t getNumEngineTypeAndInstancesForDevice(std::mapwatchdogTimeout = heartbeat; @@ -154,12 +154,12 @@ ze_result_t LinuxSchedulerImp::getTimesliceModeProperties(ze_bool_t getDefaults, uint64_t timeout = 0, timeslice = 0; ze_result_t result = getPreemptTimeout(timeout, getDefaults); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get preempt timeout and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } result = getTimesliceDuration(timeslice, getDefaults); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get timeslice duration and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get timeslice duration and returning error:0x%x \n", __FUNCTION__, result); return result; } pConfig->interval = timeslice; @@ -172,7 +172,7 @@ ze_result_t LinuxSchedulerImp::setTimeoutMode(zes_sched_timeout_properties_t *pP zes_sched_mode_t currMode; ze_result_t result = getCurrentMode(&currMode); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -188,28 +188,28 @@ ze_result_t LinuxSchedulerImp::setTimeoutMode(zes_sched_timeout_properties_t *pP result = disableComputeUnitDebugMode(pNeedReload); if (result != ZE_RESULT_SUCCESS) { // failed to disable compute unit debug mode - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to disable COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to disable COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); return result; } } result = setHeartbeatInterval(pProperties->watchdogTimeout); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set heartbeat interval and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set heartbeat interval and returning error:0x%x \n", __FUNCTION__, result); return result; } uint64_t timeout = (pProperties->watchdogTimeout) / 5; result = setPreemptTimeout(timeout); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } uint64_t timeslice = 0; result = setTimesliceDuration(timeslice); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set timeslice duration and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set timeslice duration and returning error:0x%x \n", __FUNCTION__, result); return result; } return result; @@ -226,7 +226,7 @@ ze_result_t LinuxSchedulerImp::setTimesliceMode(zes_sched_timeslice_properties_t zes_sched_mode_t currMode; ze_result_t result = getCurrentMode(&currMode); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get current mode and returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -234,19 +234,19 @@ ze_result_t LinuxSchedulerImp::setTimesliceMode(zes_sched_timeslice_properties_t // Unset this mode result = disableComputeUnitDebugMode(pNeedReload); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to disable COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to disable COMPUTE_UNIT_DEBUG mode and returning error:0x%x \n", __FUNCTION__, result); return result; } } result = setPreemptTimeout(pProperties->yieldTimeout); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set preempt timeout and returning error:0x%x \n", __FUNCTION__, result); return result; } result = setTimesliceDuration(pProperties->interval); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set timeslice duration and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to set timeslice duration and returning error:0x%x \n", __FUNCTION__, result); return result; } uint64_t heartbeat = 2500 * (pProperties->interval); @@ -284,7 +284,7 @@ ze_result_t LinuxSchedulerImp::getPreemptTimeout(uint64_t &timeout, ze_bool_t ge if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read preempt timeout from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read preempt timeout from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); return result; } } @@ -325,7 +325,7 @@ ze_result_t LinuxSchedulerImp::getTimesliceDuration(uint64_t ×lice, ze_bool if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read timeslice duration from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read timeslice duration from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); return result; } } @@ -360,7 +360,7 @@ ze_result_t LinuxSchedulerImp::getHeartbeatInterval(uint64_t &heartbeat, ze_bool if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read heartbeat interval from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read heartbeat interval from %s and returning error:0x%x \n", __FUNCTION__, path.c_str(), result); return result; } } @@ -382,7 +382,7 @@ ze_result_t LinuxSchedulerImp::setPreemptTimeout(uint64_t timeout) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write Preempt timeout into engineDir/%s/preemptTimeoutMilliSecs and returning error:0x%x \n", __FUNCTION__, engineName.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write Preempt timeout into engineDir/%s/preemptTimeoutMilliSecs and returning error:0x%x \n", __FUNCTION__, engineName.c_str(), result); return result; } } @@ -398,7 +398,7 @@ ze_result_t LinuxSchedulerImp::setTimesliceDuration(uint64_t timeslice) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write Timeslice duration into engineDir/%s/timesliceDurationMilliSecs and returning error:0x%x \n", __FUNCTION__, engineName.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write Timeslice duration into engineDir/%s/timesliceDurationMilliSecs and returning error:0x%x \n", __FUNCTION__, engineName.c_str(), result); return result; } } @@ -414,7 +414,7 @@ ze_result_t LinuxSchedulerImp::setHeartbeatInterval(uint64_t heartbeat) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write Heartbeat interval into engineDir/%s/heartbeatIntervalMilliSecs and returning error:0x%x \n", __FUNCTION__, engineName.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to write Heartbeat interval into engineDir/%s/heartbeatIntervalMilliSecs and returning error:0x%x \n", __FUNCTION__, engineName.c_str(), result); return result; } } @@ -435,14 +435,14 @@ ze_result_t LinuxSchedulerImp::updateComputeUnitDebugNode(uint64_t val) { pLinuxSysmanImp->releaseDeviceResources(); ze_result_t result = pLinuxSysmanImp->gpuProcessCleanup(true); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "updateComputeUnitDebugNode: gpuProcessCleanup() failed with error code: %ld\n", result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "updateComputeUnitDebugNode: gpuProcessCleanup() failed with error code: %ld\n", result); return result; } result = pSysfsAccess->write(enableEuDebug, val); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "updateComputeUnitDebugNode: Write to sysfs node %s failed with error code: %ld\n", enableEuDebug.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "updateComputeUnitDebugNode: Write to sysfs node %s failed with error code: %ld\n", enableEuDebug.c_str(), result); } pLinuxSysmanImp->initDevice(); return result; @@ -451,8 +451,8 @@ ze_result_t LinuxSchedulerImp::updateComputeUnitDebugNode(uint64_t val) { ze_result_t LinuxSchedulerImp::setComputeUnitDebugMode(ze_bool_t *pNeedReload) { auto result = setExclusiveModeImp(); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "setComputeUnitDebugMode: Exclusive mode set(precontiion to set Debug mode) failed. Error code: %ld\n", result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "setComputeUnitDebugMode: Exclusive mode set(precontiion to set Debug mode) failed. Error code: %ld\n", result); return result; } @@ -460,8 +460,8 @@ ze_result_t LinuxSchedulerImp::setComputeUnitDebugMode(ze_bool_t *pNeedReload) { uint64_t val = 1; auto ret = pSysfsAccess->canWrite(enableEuDebug); if (ret != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "setComputeUnitDebugMode: sysfs node %s not writable. Error code: %ld\n", enableEuDebug.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "setComputeUnitDebugMode: sysfs node %s not writable. Error code: %ld\n", enableEuDebug.c_str(), result); return ret; } return updateComputeUnitDebugNode(val); @@ -471,8 +471,8 @@ bool LinuxSchedulerImp::isComputeUnitDebugModeEnabled() { uint64_t val = 0; auto result = pSysfsAccess->read(enableEuDebug, val); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "isComputeUnitDebugModeEnabled: Read from sysfs node %s failed with error code: %ld\n", enableEuDebug.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "isComputeUnitDebugModeEnabled: Read from sysfs node %s failed with error code: %ld\n", enableEuDebug.c_str(), result); return false; } return (val == 0) ? false : true; @@ -520,7 +520,7 @@ static ze_result_t getNumEngineTypeAndInstancesForDevice(std::map \n", __func__, standbyModeFile.c_str(), rel); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, standbyModeFile.c_str(), rel); return false; } } @@ -39,8 +39,8 @@ ze_result_t LinuxStandbyImp::getMode(zes_standby_promo_mode_t &mode) { if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, standbyModeFile.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, standbyModeFile.c_str(), result); return result; } if (standbyModeDefault == currentMode) { @@ -49,8 +49,8 @@ ze_result_t LinuxStandbyImp::getMode(zes_standby_promo_mode_t &mode) { mode = ZES_STANDBY_PROMO_MODE_NEVER; } else { result = ZE_RESULT_ERROR_UNKNOWN; - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, currentMode, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, currentMode, result); } return result; } @@ -65,8 +65,8 @@ ze_result_t LinuxStandbyImp::setMode(zes_standby_promo_mode_t mode) { if (ZE_RESULT_ERROR_NOT_AVAILABLE == result) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "error@<%s> \n", __func__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "error@<%s> \n", __func__, result); } return result; } diff --git a/level_zero/tools/source/sysman/sysman.cpp b/level_zero/tools/source/sysman/sysman.cpp index a19b74cf0e..11195d6f42 100644 --- a/level_zero/tools/source/sysman/sysman.cpp +++ b/level_zero/tools/source/sysman/sysman.cpp @@ -32,8 +32,8 @@ void DeviceImp::createSysmanHandle(bool isSubDevice) { SysmanDevice *SysmanDeviceHandleContext::init(ze_device_handle_t coreDevice) { if (L0::Sysman::sysmanOnlyInit) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "%s", "Sysman Initialization already happened via zesInit\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "%s", "Sysman Initialization already happened via zesInit\n"); return nullptr; } @@ -74,8 +74,8 @@ ze_result_t DriverHandleImp::sysmanEventsListen( zes_event_type_flags_t *pEvents) { if (globalOsSysmanDriver == nullptr) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "%s", "Os Sysman Driver Not initialized\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "%s", "Os Sysman Driver Not initialized\n"); return ZE_RESULT_ERROR_UNINITIALIZED; } @@ -90,8 +90,8 @@ ze_result_t DriverHandleImp::sysmanEventsListenEx( zes_event_type_flags_t *pEvents) { if (globalOsSysmanDriver == nullptr) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, - "%s", "Os Sysman Driver Not initialized\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "%s", "Os Sysman Driver Not initialized\n"); return ZE_RESULT_ERROR_UNINITIALIZED; } return globalOsSysmanDriver->eventsListen(timeout, count, phDevices, pNumDeviceEvents, pEvents); diff --git a/level_zero/tools/source/sysman/temperature/linux/os_temperature_imp.cpp b/level_zero/tools/source/sysman/temperature/linux/os_temperature_imp.cpp index 62da21811a..53f2b71910 100644 --- a/level_zero/tools/source/sysman/temperature/linux/os_temperature_imp.cpp +++ b/level_zero/tools/source/sysman/temperature/linux/os_temperature_imp.cpp @@ -35,7 +35,7 @@ ze_result_t LinuxTemperatureImp::getProperties(zes_temp_properties_t *pPropertie ze_result_t LinuxTemperatureImp::getGlobalMaxTemperatureNoSubDevice(double *pTemperature) { auto isValidTemperature = [](auto temperature) { if ((temperature > invalidMaxTemperature) || (temperature < invalidMinTemperature)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): temperature:%f is not in valid limits \n", __FUNCTION__, temperature); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): temperature:%f is not in valid limits \n", __FUNCTION__, temperature); return false; } return true; @@ -63,7 +63,7 @@ ze_result_t LinuxTemperatureImp::getGlobalMaxTemperatureNoSubDevice(double *pTem key = "COMPUTE_TEMPERATURES"; result = pPmt->readValue(key, computeTemperature); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Pmt->readvalue() for COMPUTE_TEMPERATURES is returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Pmt->readvalue() for COMPUTE_TEMPERATURES is returning error:0x%x \n", __FUNCTION__, result); return result; } // Check max temperature among IA, GT and LLC sensors across COMPUTE_TEMPERATURES @@ -73,7 +73,7 @@ ze_result_t LinuxTemperatureImp::getGlobalMaxTemperatureNoSubDevice(double *pTem key = "CORE_TEMPERATURES"; result = pPmt->readValue(key, coreTemperature); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Pmt->readvalue() for CORE_TEMPERATURES is returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Pmt->readvalue() for CORE_TEMPERATURES is returning error:0x%x \n", __FUNCTION__, result); return result; } // Check max temperature among CORE0, CORE1, CORE2, CORE3 sensors across CORE_TEMPERATURES @@ -85,7 +85,7 @@ ze_result_t LinuxTemperatureImp::getGlobalMaxTemperatureNoSubDevice(double *pTem key = "SOC_TEMPERATURES"; result = pPmt->readValue(std::move(key), socTemperature); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Pmt->readvalue() for SOC_TEMPERATURES is returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Pmt->readvalue() for SOC_TEMPERATURES is returning error:0x%x \n", __FUNCTION__, result); return result; } // Check max temperature among possible sensors like PCH or GT_TEMP, DRAM, SA, PSF, DE, PCIE, TYPEC across SOC_TEMPERATURES @@ -106,7 +106,7 @@ ze_result_t LinuxTemperatureImp::getGlobalMaxTemperature(double *pTemperature) { std::string key("TileMaxTemperature"); ze_result_t result = pPmt->readValue(std::move(key), globalMaxTemperature); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Pmt->readvalue() for TileMaxTemperature is returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Pmt->readvalue() for TileMaxTemperature is returning error:0x%x \n", __FUNCTION__, result); return result; } *pTemperature = static_cast(globalMaxTemperature); @@ -120,7 +120,7 @@ ze_result_t LinuxTemperatureImp::getGpuMaxTemperatureNoSubDevice(double *pTemper std::string key = "SOC_TEMPERATURES"; auto result = pPmt->readValue(key, socTemperature); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Pmt->readvalue() for SOC_TEMPERATURES is returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Pmt->readvalue() for SOC_TEMPERATURES is returning error:0x%x \n", __FUNCTION__, result); return result; } gpuMaxTemperature = static_cast(socTemperature & 0xff); @@ -131,7 +131,7 @@ ze_result_t LinuxTemperatureImp::getGpuMaxTemperatureNoSubDevice(double *pTemper std::string key("COMPUTE_TEMPERATURES"); ze_result_t result = pPmt->readValue(std::move(key), computeTemperature); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Pmt->readvalue() for COMPUTE_TEMPERATURES is returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Pmt->readvalue() for COMPUTE_TEMPERATURES is returning error:0x%x \n", __FUNCTION__, result); return result; } @@ -151,7 +151,7 @@ ze_result_t LinuxTemperatureImp::getGpuMaxTemperature(double *pTemperature) { std::string key("GTMaxTemperature"); ze_result_t result = pPmt->readValue(std::move(key), gpuMaxTemperature); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Pmt->readvalue() for GTMaxTemperature is returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Pmt->readvalue() for GTMaxTemperature is returning error:0x%x \n", __FUNCTION__, result); return result; } *pTemperature = static_cast(gpuMaxTemperature); @@ -164,7 +164,7 @@ ze_result_t LinuxTemperatureImp::getMemoryMaxTemperature(double *pTemperature) { if (productFamily == IGFX_PVC) { numHbmModules = 4u; } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s() returning UNSUPPORTED_FEATURE \n", __FUNCTION__); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -175,7 +175,7 @@ ze_result_t LinuxTemperatureImp::getMemoryMaxTemperature(double *pTemperature) { std::string key = "HBM" + std::to_string(hbmModuleIndex) + "MaxDeviceTemperature"; result = pPmt->readValue(key, maxDeviceTemperature); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Pmt->readvalue() for %s is returning error:0x%x \n", __FUNCTION__, key.c_str(), result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Pmt->readvalue() for %s is returning error:0x%x \n", __FUNCTION__, key.c_str(), result); return result; } maxDeviceTemperatureList.push_back(maxDeviceTemperature); diff --git a/level_zero/tools/source/sysman/vf_management/linux/os_vf_imp.cpp b/level_zero/tools/source/sysman/vf_management/linux/os_vf_imp.cpp index bf00bf22ae..3fb486d165 100644 --- a/level_zero/tools/source/sysman/vf_management/linux/os_vf_imp.cpp +++ b/level_zero/tools/source/sysman/vf_management/linux/os_vf_imp.cpp @@ -22,12 +22,12 @@ ze_result_t LinuxVfImp::getVfBDFAddress(uint32_t vfIdMinusOne, zes_pci_address_t std::string vfPath = pathForVfBdf + std::to_string(vfIdMinusOne); ze_result_t result = pSysfsAccess->getRealPath(std::move(vfPath), vfRealPath); if (ZE_RESULT_SUCCESS != result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get the real path and returning error:0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get the real path and returning error:0x%x \n", __FUNCTION__, result); return result; } std::size_t loc = vfRealPath.find_last_of("/"); if (loc == std::string::npos) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get the last occurrence of '/' and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get the last occurrence of '/' and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE); return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; } std::string vfBdfString = vfRealPath.substr(loc + 1); @@ -36,7 +36,7 @@ ze_result_t LinuxVfImp::getVfBDFAddress(uint32_t vfIdMinusOne, zes_pci_address_t uint16_t domain = -1; uint8_t bus = -1, device = -1, function = -1; if (NEO::parseBdfString(vfBdfString, domain, bus, device, function) != vfBdfTokensNum) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get the correct token sum and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to get the correct token sum and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE); return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; } address->domain = domain; @@ -96,7 +96,7 @@ bool LinuxVfImp::vfOsGetLocalMemoryUsed(uint64_t &lMemUsed) { auto result = pSysfsAccess->read(pathForDeviceMemUsed.data(), lMemUsed); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Local Memory Used with error 0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Local Memory Used with error 0x%x \n", __FUNCTION__, result); return false; } return true; @@ -108,7 +108,7 @@ bool LinuxVfImp::vfOsGetLocalMemoryQuota(uint64_t &lMemQuota) { auto result = pSysfsAccess->read(pathForDeviceMemQuota.data(), lMemQuota); if (result != ZE_RESULT_SUCCESS) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Local Memory Quota with error 0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Local Memory Quota with error 0x%x \n", __FUNCTION__, result); return false; } return true; @@ -157,7 +157,7 @@ uint32_t OsVf::getNumEnabledVfs(OsSysman *pOsSysman) { auto result = pSysfsAccess->read(pathForNumberOfVfs.data(), numberOfVfs); if (result != ZE_RESULT_SUCCESS) { numberOfVfs = 0; - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Number Of Vfs with error 0x%x \n", __FUNCTION__, result); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Number Of Vfs with error 0x%x \n", __FUNCTION__, result); } return numberOfVfs; } diff --git a/level_zero/tools/source/sysman/vf_management/linux/os_vf_imp_prelim.cpp b/level_zero/tools/source/sysman/vf_management/linux/os_vf_imp_prelim.cpp index 33b857bae9..9ca6a2509e 100644 --- a/level_zero/tools/source/sysman/vf_management/linux/os_vf_imp_prelim.cpp +++ b/level_zero/tools/source/sysman/vf_management/linux/os_vf_imp_prelim.cpp @@ -52,7 +52,7 @@ ze_result_t LinuxVfImp::vfEngineDataInit() { PmuInterface *pPmuInterface = pLinuxSysmanImp->getPmuInterface(); if (pDrm->sysmanQueryEngineInfo() == false) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():sysmanQueryEngineInfo is returning false and error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():sysmanQueryEngineInfo is returning false and error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } auto engineInfo = pDrm->getEngineInfo(); @@ -63,7 +63,7 @@ ze_result_t LinuxVfImp::vfEngineDataInit() { uint64_t busyTicksConfig = ___PRELIM_I915_PMU_FN_EVENT(PRELIM_I915_PMU_ENGINE_BUSY_TICKS(engineClass->second, itr->second), static_cast(vfId)); int64_t busyTicksFd = pPmuInterface->pmuInterfaceOpen(busyTicksConfig, -1, PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP); if (busyTicksFd < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not open Busy Ticks Handle and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not open Busy Ticks Handle and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); cleanup(); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -71,7 +71,7 @@ ze_result_t LinuxVfImp::vfEngineDataInit() { uint64_t totalTicksConfig = ___PRELIM_I915_PMU_FN_EVENT(PRELIM_I915_PMU_ENGINE_TOTAL_TICKS(engineClass->second, itr->second), static_cast(vfId)); int64_t totalTicksFd = pPmuInterface->pmuInterfaceOpen(totalTicksConfig, static_cast(busyTicksFd), PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP); if (totalTicksFd < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not open Total Ticks Handle and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Could not open Total Ticks Handle and returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); NEO::SysCalls::close(static_cast(busyTicksFd)); cleanup(); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; @@ -99,7 +99,7 @@ ze_result_t LinuxVfImp::getEngineUtilization(uint32_t *pCount, zes_vf_util_engin uint32_t engineCount = static_cast(pEngineUtils.size()); if (engineCount == 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): The Total Engine Count Is Zero and hence returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): The Total Engine Count Is Zero and hence returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -118,7 +118,7 @@ ze_result_t LinuxVfImp::getEngineUtilization(uint32_t *pCount, zes_vf_util_engin uint64_t pmuData[4] = {}; auto ret = pPmuInterface->pmuRead(static_cast(pEngineUtils[i].busyTicksFd), pmuData, sizeof(pmuData)); if (ret < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pmuRead is returning value:%d and error:0x%x \n", __FUNCTION__, ret, ZE_RESULT_ERROR_UNKNOWN); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pmuRead is returning value:%d and error:0x%x \n", __FUNCTION__, ret, ZE_RESULT_ERROR_UNKNOWN); *pCount = 0; return ZE_RESULT_ERROR_UNKNOWN; } diff --git a/opencl/source/api/api.cpp b/opencl/source/api/api.cpp index 5e8d4846b4..1d0127dd5c 100644 --- a/opencl/source/api/api.cpp +++ b/opencl/source/api/api.cpp @@ -3602,7 +3602,7 @@ cl_int CL_API_CALL clEnqueueNDRangeKernel(cl_command_queue commandQueue, auto slmTotalSize = pKernel->getSlmTotalSize(); if (slmTotalSize > 0 && localMemSize < slmTotalSize) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize); retVal = CL_OUT_OF_RESOURCES; TRACING_EXIT(ClEnqueueNdRangeKernel, &retVal); return retVal; diff --git a/opencl/source/cl_device/cl_device_caps.cpp b/opencl/source/cl_device/cl_device_caps.cpp index a3afacd9aa..d21352fe02 100644 --- a/opencl/source/cl_device/cl_device_caps.cpp +++ b/opencl/source/cl_device/cl_device_caps.cpp @@ -248,14 +248,14 @@ void ClDevice::initializeCaps() { deviceInfo.halfFpConfig = defaultFpFlags; - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "computeUnitsUsedForScratch: %d\n", sharedDeviceInfo.computeUnitsUsedForScratch); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "computeUnitsUsedForScratch: %d\n", sharedDeviceInfo.computeUnitsUsedForScratch); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "hwInfo: {%d, %d}: (%d, %d, %d)\n", - systemInfo.EUCount, - systemInfo.ThreadCount, - systemInfo.MaxEuPerSubSlice, - systemInfo.MaxSlicesSupported, - systemInfo.MaxSubSlicesSupported); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "hwInfo: {%d, %d}: (%d, %d, %d)\n", + systemInfo.EUCount, + systemInfo.ThreadCount, + systemInfo.MaxEuPerSubSlice, + systemInfo.MaxSlicesSupported, + systemInfo.MaxSubSlicesSupported); deviceInfo.localMemType = CL_LOCAL; diff --git a/opencl/source/command_queue/command_queue_hw_base.inl b/opencl/source/command_queue/command_queue_hw_base.inl index 870b77bd17..b019f2856f 100644 --- a/opencl/source/command_queue/command_queue_hw_base.inl +++ b/opencl/source/command_queue/command_queue_hw_base.inl @@ -153,9 +153,9 @@ inline bool waitForTimestampsWithinContainer(TimestampPacketContainer *container auto waitStartTime = lastHangCheckTime; for (const auto ×tamp : container->peekNodes()) { for (uint32_t i = 0; i < timestamp->getPacketsUsed(); i++) { - if (printWaitForCompletion) { - printf("\nWaiting for TS 0x%" PRIx64, timestamp->getGpuAddress() + (i * timestamp->getSinglePacketSize())); - } + PRINT_STRING(printWaitForCompletion, stdout, + "\nWaiting for TS 0x%" PRIx64, timestamp->getGpuAddress() + (i * timestamp->getSinglePacketSize())); + while (timestamp->getContextEndValue(i) == 1) { csr.downloadAllocation(*timestamp->getBaseGraphicsAllocation()->getGraphicsAllocation(csr.getRootDeviceIndex())); @@ -164,15 +164,11 @@ inline bool waitForTimestampsWithinContainer(TimestampPacketContainer *container if (csr.checkGpuHangDetected(currentTime, lastHangCheckTime)) { status = WaitStatus::gpuHang; - if (printWaitForCompletion) { - printf("\nWaiting for TS failed"); - } + PRINT_STRING(printWaitForCompletion, stdout, "\nWaiting for TS failed"); return false; } } - if (printWaitForCompletion) { - printf("\nWaiting for TS completed"); - } + PRINT_STRING(printWaitForCompletion, stdout, "\nWaiting for TS completed"); status = WaitStatus::ready; waited = true; } diff --git a/opencl/source/command_queue/enqueue_common.h b/opencl/source/command_queue/enqueue_common.h index 95c9079ac6..1cce713369 100644 --- a/opencl/source/command_queue/enqueue_common.h +++ b/opencl/source/command_queue/enqueue_common.h @@ -980,7 +980,7 @@ CompletionStamp CommandQueueHw::enqueueNonBlocked( dispatchFlags.implicitFlush = true; } - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stdout, "preemption = %d.\n", static_cast(dispatchFlags.preemptionMode)); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stdout, "preemption = %d.\n", static_cast(dispatchFlags.preemptionMode)); CompletionStamp completionStamp = csr.flushTask( commandStream, diff --git a/opencl/source/command_queue/hardware_interface_xehp_and_later.inl b/opencl/source/command_queue/hardware_interface_xehp_and_later.inl index 8c092ada9c..2c70a24663 100644 --- a/opencl/source/command_queue/hardware_interface_xehp_and_later.inl +++ b/opencl/source/command_queue/hardware_interface_xehp_and_later.inl @@ -182,10 +182,11 @@ inline void HardwareInterface::programWalker( auto devices = queueCsr.getOsContext().getDeviceBitfield(); auto partitionWalker = ImplicitScalingHelper::isImplicitScalingEnabled(devices, true); - if (timestampPacketNode && debugManager.flags.PrintTimestampPacketUsage.get() == 1) { - auto gpuVa = walkerArgs.currentTimestampPacketNodes->peekNodes()[walkerArgs.currentDispatchIndex]->getGpuAddress(); - printf("\nPID:%u, TSP used for Walker: 0x%" PRIX64 ", cmdBuffer pos: 0x%" PRIX64, SysCalls::getProcessId(), gpuVa, commandStream.getCurrentGpuAddressPosition()); - } + PRINT_STRING((timestampPacketNode && debugManager.flags.PrintTimestampPacketUsage.get() == 1), stdout, + "\nPID:%u, TSP used for Walker: 0x%" PRIX64 ", cmdBuffer pos: 0x%" PRIX64, + SysCalls::getProcessId(), + walkerArgs.currentTimestampPacketNodes->peekNodes()[walkerArgs.currentDispatchIndex]->getGpuAddress(), + commandStream.getCurrentGpuAddressPosition()); uint32_t workgroupSize = static_cast(walkerArgs.localWorkSizes[0] * walkerArgs.localWorkSizes[1] * walkerArgs.localWorkSizes[2]); diff --git a/opencl/source/context/context.h b/opencl/source/context/context.h index 4ae8014580..8f73e5a729 100644 --- a/opencl/source/context/context.h +++ b/opencl/source/context/context.h @@ -195,9 +195,7 @@ class Context : public BaseObject<_cl_context> { if (contextCallback) { contextCallback(hint, &flags, sizeof(flags), userData); } - if (debugManager.flags.PrintDriverDiagnostics.get() != -1) { - printf("\n%s\n", hint); - } + PRINT_STRING(debugManager.flags.PrintDriverDiagnostics.get() != -1, stdout, "\n%s\n", hint); } } diff --git a/opencl/source/event/event.cpp b/opencl/source/event/event.cpp index d6252d8fbb..a16124d2ce 100644 --- a/opencl/source/event/event.cpp +++ b/opencl/source/event/event.cpp @@ -836,21 +836,18 @@ bool Event::areTimestampsCompleted() { for (const auto ×tamp : this->timestampPacketContainer->peekNodes()) { for (uint32_t i = 0; i < timestamp->getPacketsUsed(); i++) { - if (printWaitForCompletion) { - printf("\nChecking TS 0x%" PRIx64, timestamp->getGpuAddress() + (i * timestamp->getSinglePacketSize())); - } + PRINT_STRING(printWaitForCompletion, stdout, + "\nChecking TS 0x%" PRIx64, timestamp->getGpuAddress() + (i * timestamp->getSinglePacketSize())); + this->cmdQueue->getGpgpuCommandStreamReceiver().downloadAllocation(*timestamp->getBaseGraphicsAllocation()->getGraphicsAllocation(this->cmdQueue->getGpgpuCommandStreamReceiver().getRootDeviceIndex())); if (timestamp->getContextEndValue(i) == 1) { - if (printWaitForCompletion) { - printf("\nTS not ready"); - } + PRINT_STRING(printWaitForCompletion, stdout, "\nTS not ready"); return false; } } } - if (printWaitForCompletion) { - printf("\nTS ready"); - } + PRINT_STRING(printWaitForCompletion, stdout, "\nTS ready"); + this->cmdQueue->getGpgpuCommandStreamReceiver().downloadAllocations(true); const auto &bcsStates = this->cmdQueue->peekActiveBcsStates(); for (auto currentBcsIndex = 0u; currentBcsIndex < bcsStates.size(); currentBcsIndex++) { diff --git a/opencl/source/helpers/cl_preemption_helper.cpp b/opencl/source/helpers/cl_preemption_helper.cpp index 6c144606a0..c7a3a2e24f 100644 --- a/opencl/source/helpers/cl_preemption_helper.cpp +++ b/opencl/source/helpers/cl_preemption_helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2024 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -31,8 +31,8 @@ PreemptionMode ClPreemptionHelper::taskPreemptionMode(Device &device, const Mult if (devMode > taskMode) { devMode = taskMode; } - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stdout, "devMode = %d, taskMode = %d.\n", - static_cast(device.getPreemptionMode()), static_cast(taskMode)); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stdout, "devMode = %d, taskMode = %d.\n", + static_cast(device.getPreemptionMode()), static_cast(taskMode)); } return devMode; } diff --git a/opencl/source/helpers/dispatch_info_builder.h b/opencl/source/helpers/dispatch_info_builder.h index 8140b9283b..ed5f47fa24 100644 --- a/opencl/source/helpers/dispatch_info_builder.h +++ b/opencl/source/helpers/dispatch_info_builder.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -278,17 +278,17 @@ class DispatchInfoBuilder { pushSplit(dispatchInfo, target); } else { target.push(dispatchInfo); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stdout, - "DIM:%u\tGWS:(%zu, %zu, %zu)\tELWS:(%zu, %zu, %zu)\tOffset:(%zu, %zu, %zu)\tAGWS:(%zu, %zu, %zu)\tLWS:(%zu, %zu, %zu)\tTWGS:(%zu, %zu, %zu)\tNWGS:(%zu, %zu, %zu)\tSWGS:(%zu, %zu, %zu)\n", - dispatchInfo.getDim(), - dispatchInfo.getGWS().x, dispatchInfo.getGWS().y, dispatchInfo.getGWS().z, - dispatchInfo.getEnqueuedWorkgroupSize().x, dispatchInfo.getEnqueuedWorkgroupSize().y, dispatchInfo.getEnqueuedWorkgroupSize().z, - dispatchInfo.getOffset().x, dispatchInfo.getOffset().y, dispatchInfo.getOffset().z, - dispatchInfo.getActualWorkgroupSize().x, dispatchInfo.getActualWorkgroupSize().y, dispatchInfo.getActualWorkgroupSize().z, - dispatchInfo.getLocalWorkgroupSize().x, dispatchInfo.getLocalWorkgroupSize().y, dispatchInfo.getLocalWorkgroupSize().z, - dispatchInfo.getTotalNumberOfWorkgroups().x, dispatchInfo.getTotalNumberOfWorkgroups().y, dispatchInfo.getTotalNumberOfWorkgroups().z, - dispatchInfo.getNumberOfWorkgroups().x, dispatchInfo.getNumberOfWorkgroups().y, dispatchInfo.getNumberOfWorkgroups().z, - dispatchInfo.getStartOfWorkgroups().x, dispatchInfo.getStartOfWorkgroups().y, dispatchInfo.getStartOfWorkgroups().z); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stdout, + "DIM:%u\tGWS:(%zu, %zu, %zu)\tELWS:(%zu, %zu, %zu)\tOffset:(%zu, %zu, %zu)\tAGWS:(%zu, %zu, %zu)\tLWS:(%zu, %zu, %zu)\tTWGS:(%zu, %zu, %zu)\tNWGS:(%zu, %zu, %zu)\tSWGS:(%zu, %zu, %zu)\n", + dispatchInfo.getDim(), + dispatchInfo.getGWS().x, dispatchInfo.getGWS().y, dispatchInfo.getGWS().z, + dispatchInfo.getEnqueuedWorkgroupSize().x, dispatchInfo.getEnqueuedWorkgroupSize().y, dispatchInfo.getEnqueuedWorkgroupSize().z, + dispatchInfo.getOffset().x, dispatchInfo.getOffset().y, dispatchInfo.getOffset().z, + dispatchInfo.getActualWorkgroupSize().x, dispatchInfo.getActualWorkgroupSize().y, dispatchInfo.getActualWorkgroupSize().z, + dispatchInfo.getLocalWorkgroupSize().x, dispatchInfo.getLocalWorkgroupSize().y, dispatchInfo.getLocalWorkgroupSize().z, + dispatchInfo.getTotalNumberOfWorkgroups().x, dispatchInfo.getTotalNumberOfWorkgroups().y, dispatchInfo.getTotalNumberOfWorkgroups().z, + dispatchInfo.getNumberOfWorkgroups().x, dispatchInfo.getNumberOfWorkgroups().y, dispatchInfo.getNumberOfWorkgroups().z, + dispatchInfo.getStartOfWorkgroups().x, dispatchInfo.getStartOfWorkgroups().y, dispatchInfo.getStartOfWorkgroups().z); } } } diff --git a/opencl/source/kernel/kernel.cpp b/opencl/source/kernel/kernel.cpp index f63353e4a7..ab3adcb70c 100644 --- a/opencl/source/kernel/kernel.cpp +++ b/opencl/source/kernel/kernel.cpp @@ -190,7 +190,7 @@ cl_int Kernel::initialize() { auto localMemSize = static_cast(clDevice.getDevice().getDeviceInfo().localMemSize); auto slmTotalSize = this->getSlmTotalSize(); if (slmTotalSize > 0 && localMemSize < slmTotalSize) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize); return CL_OUT_OF_RESOURCES; } diff --git a/opencl/source/program/process_device_binary.cpp b/opencl/source/program/process_device_binary.cpp index 543863e095..2f3da529c7 100644 --- a/opencl/source/program/process_device_binary.cpp +++ b/opencl/source/program/process_device_binary.cpp @@ -256,11 +256,11 @@ cl_int Program::processGenBinary(const ClDevice &clDevice) { } if (decodedSingleDeviceBinary.decodeWarnings.empty() == false) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodedSingleDeviceBinary.decodeWarnings.c_str()); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodedSingleDeviceBinary.decodeWarnings.c_str()); } if (DecodeError::success != decodedSingleDeviceBinary.decodeError) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodedSingleDeviceBinary.decodeErrors.c_str()); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodedSingleDeviceBinary.decodeErrors.c_str()); return CL_INVALID_BINARY; } @@ -285,8 +285,8 @@ cl_int Program::processProgramInfo(ProgramInfo &src, const ClDevice &clDevice) { setLinkerInput(rootDeviceIndex, std::move(src.linkerInput)); if (slmNeeded > slmAvailable) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", - static_cast(slmNeeded), static_cast(slmAvailable)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", + static_cast(slmNeeded), static_cast(slmAvailable)); return CL_OUT_OF_RESOURCES; } diff --git a/opencl/source/program/program.cpp b/opencl/source/program/program.cpp index 5332fd1206..1aad79b050 100644 --- a/opencl/source/program/program.cpp +++ b/opencl/source/program/program.cpp @@ -218,13 +218,13 @@ cl_int Program::createProgramFromBinary( auto singleDeviceBinary = unpackSingleDeviceBinary(archive, ConstStringRef(productAbbreviation, strlen(productAbbreviation)), targetDevice, decodeErrors, decodeWarnings); if (decodeWarnings.empty() == false) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeWarnings.c_str()); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeWarnings.c_str()); } bool singleDeviceBinaryEmpty = singleDeviceBinary.intermediateRepresentation.empty() && singleDeviceBinary.deviceBinary.empty(); if (singleDeviceBinaryEmpty || (singleDeviceBinary.deviceBinary.empty() && debugManager.flags.DisableKernelRecompilation.get())) { retVal = CL_INVALID_BINARY; - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeErrors.c_str()); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeErrors.c_str()); } else { retVal = CL_SUCCESS; this->irBinary = makeCopy(reinterpret_cast(singleDeviceBinary.intermediateRepresentation.begin()), singleDeviceBinary.intermediateRepresentation.size()); @@ -260,7 +260,7 @@ cl_int Program::createProgramFromBinary( if (0u == this->irBinarySize) { if (flagRebuild) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "Skip rebuild binary. Lack of IR, rebuild impossible.\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "Skip rebuild binary. Lack of IR, rebuild impossible.\n"); } if (rebuild) { return CL_INVALID_BINARY; diff --git a/opencl/source/sharings/gl/linux/gl_texture_linux.cpp b/opencl/source/sharings/gl/linux/gl_texture_linux.cpp index 1d750323e5..b2bb7d6125 100644 --- a/opencl/source/sharings/gl/linux/gl_texture_linux.cpp +++ b/opencl/source/sharings/gl/linux/gl_texture_linux.cpp @@ -64,7 +64,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl } if (texIn.target != GL_TEXTURE_2D) { - printf("target %x not supported\n", target); + PRINT_STRING(true, stdout, "target %x not supported\n", target); errorCode.set(CL_INVALID_GL_OBJECT); return nullptr; } @@ -151,8 +151,8 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl imgInfo.forceTiling = ImageTilingMode::tiled4; break; default: - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, - "Unexpected format in CL-GL sharing"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, + "Unexpected format in CL-GL sharing"); return nullptr; } diff --git a/shared/source/command_container/command_encoder_xehp_and_later.inl b/shared/source/command_container/command_encoder_xehp_and_later.inl index d50af20ac9..cd01ea2342 100644 --- a/shared/source/command_container/command_encoder_xehp_and_later.inl +++ b/shared/source/command_container/command_encoder_xehp_and_later.inl @@ -388,20 +388,19 @@ void EncodeDispatchKernel::encode(CommandContainer &container, EncodeDis auto threadGroupCount = walkerCmd.getThreadGroupIdXDimension() * walkerCmd.getThreadGroupIdYDimension() * walkerCmd.getThreadGroupIdZDimension(); EncodeDispatchKernel::encodeThreadGroupDispatch(idd, *args.device, hwInfo, threadDimsVec, threadGroupCount, kernelDescriptor.kernelMetadata.requiredThreadGroupDispatchSize, kernelDescriptor.kernelAttributes.numGrfRequired, threadsPerThreadGroup, walkerCmd); - if (debugManager.flags.PrintKernelDispatchParameters.get()) { - fprintf(stdout, "kernel, %s, grfCount, %d, simdSize, %d, tilesCount, %d, implicitScaling, %s, threadGroupCount, %d, numberOfThreadsInGpgpuThreadGroup, %d, threadGroupDimensions, %d, %d, %d, threadGroupDispatchSize enum, %d\n", - kernelDescriptor.kernelMetadata.kernelName.c_str(), - kernelDescriptor.kernelAttributes.numGrfRequired, - kernelDescriptor.kernelAttributes.simdSize, - args.device->getNumSubDevices(), - ImplicitScalingHelper::isImplicitScalingEnabled(args.device->getDeviceBitfield(), true) ? "Yes" : "no", - threadGroupCount, - idd.getNumberOfThreadsInGpgpuThreadGroup(), - walkerCmd.getThreadGroupIdXDimension(), - walkerCmd.getThreadGroupIdYDimension(), - walkerCmd.getThreadGroupIdZDimension(), - idd.getThreadGroupDispatchSize()); - } + PRINT_STRING(debugManager.flags.PrintKernelDispatchParameters.get(), stdout, + "kernel, %s, grfCount, %d, simdSize, %d, tilesCount, %d, implicitScaling, %s, threadGroupCount, %d, numberOfThreadsInGpgpuThreadGroup, %d, threadGroupDimensions, %d, %d, %d, threadGroupDispatchSize enum, %d\n", + kernelDescriptor.kernelMetadata.kernelName.c_str(), + kernelDescriptor.kernelAttributes.numGrfRequired, + kernelDescriptor.kernelAttributes.simdSize, + args.device->getNumSubDevices(), + ImplicitScalingHelper::isImplicitScalingEnabled(args.device->getDeviceBitfield(), true) ? "Yes" : "no", + threadGroupCount, + idd.getNumberOfThreadsInGpgpuThreadGroup(), + walkerCmd.getThreadGroupIdXDimension(), + walkerCmd.getThreadGroupIdYDimension(), + walkerCmd.getThreadGroupIdZDimension(), + idd.getThreadGroupDispatchSize()); EncodeDispatchKernel::setupPreferredSlmSize(&idd, rootDeviceEnvironment, threadsPerThreadGroup, args.dispatchInterface->getSlmTotalSize(), diff --git a/shared/source/command_stream/command_stream_receiver.cpp b/shared/source/command_stream/command_stream_receiver.cpp index 5b11635718..a0ddf6402c 100644 --- a/shared/source/command_stream/command_stream_receiver.cpp +++ b/shared/source/command_stream/command_stream_receiver.cpp @@ -928,9 +928,9 @@ bool CommandStreamReceiver::initializeTagAllocation() { } *this->debugPauseStateAddress = debugManager.flags.EnableNullHardware.get() ? DebugPauseState::disabled : DebugPauseState::waitingForFirstSemaphore; - PRINT_DEBUG_STRING(debugManager.flags.PrintTagAllocationAddress.get(), stdout, - "\nCreated tag allocation %p for engine %u\n", - this->tagAddress, static_cast(osContext->getEngineType())); + PRINT_STRING(debugManager.flags.PrintTagAllocationAddress.get(), stdout, + "\nCreated tag allocation %p for engine %u\n", + this->tagAddress, static_cast(osContext->getEngineType())); if (debugManager.flags.PauseOnEnqueue.get() != -1 || debugManager.flags.PauseOnBlitCopy.get() != -1) { userPauseConfirmation = Thread::createFunc(CommandStreamReceiver::asyncDebugBreakConfirmation, reinterpret_cast(this)); @@ -1100,24 +1100,22 @@ bool CommandStreamReceiver::needsPageTableManager() const { } void CommandStreamReceiver::printDeviceIndex() { - if (debugManager.flags.PrintDeviceAndEngineIdOnSubmission.get()) { - printf("%u: Submission to RootDevice Index: %u, Sub-Devices Mask: %lu, EngineId: %u (%s, %s)\n", - SysCalls::getProcessId(), - this->getRootDeviceIndex(), - this->osContext->getDeviceBitfield().to_ulong(), - this->osContext->getEngineType(), - EngineHelpers::engineTypeToString(this->osContext->getEngineType()).c_str(), - EngineHelpers::engineUsageToString(this->osContext->getEngineUsage()).c_str()); - } + PRINT_STRING(debugManager.flags.PrintDeviceAndEngineIdOnSubmission.get(), stdout, + "%u: Submission to RootDevice Index: %u, Sub-Devices Mask: %lu, EngineId: %u (%s, %s)\n", + SysCalls::getProcessId(), + this->getRootDeviceIndex(), + this->osContext->getDeviceBitfield().to_ulong(), + this->osContext->getEngineType(), + EngineHelpers::engineTypeToString(this->osContext->getEngineType()).c_str(), + EngineHelpers::engineUsageToString(this->osContext->getEngineUsage()).c_str()); } void CommandStreamReceiver::checkForNewResources(TaskCountType submittedTaskCount, TaskCountType allocationTaskCount, GraphicsAllocation &gfxAllocation) { if (useNewResourceImplicitFlush) { if (allocationTaskCount == GraphicsAllocation::objectNotUsed && !GraphicsAllocation::isIsaAllocationType(gfxAllocation.getAllocationType())) { newResources = true; - if (debugManager.flags.ProvideVerboseImplicitFlush.get()) { - printf("New resource detected of type %llu\n", static_cast(gfxAllocation.getAllocationType())); - } + PRINT_STRING(debugManager.flags.ProvideVerboseImplicitFlush.get(), stdout, + "New resource detected of type %llu\n", static_cast(gfxAllocation.getAllocationType())); } } } @@ -1200,27 +1198,27 @@ bool CommandStreamReceiver::createPerDssBackedBuffer(Device &device) { void CommandStreamReceiver::printTagAddressContent(TaskCountType taskCountToWait, int64_t waitTimeout, bool start) { if (getType() == NEO::CommandStreamReceiverType::aub) { if (start) { - PRINT_DEBUG_STRING(true, stdout, "\nAub dump wait for task count %llu", taskCountToWait); + PRINT_STRING(true, stdout, "\nAub dump wait for task count %llu", taskCountToWait); } else { - PRINT_DEBUG_STRING(true, stdout, "\nAub dump wait completed."); + PRINT_STRING(true, stdout, "\nAub dump wait completed."); } return; } auto postSyncAddress = getTagAddress(); if (start) { - PRINT_DEBUG_STRING(true, stdout, - "\nWaiting for task count %llu at location %p with timeout %llx. Current value:", - taskCountToWait, postSyncAddress, waitTimeout); + PRINT_STRING(true, stdout, + "\nWaiting for task count %llu at location %p with timeout %llx. Current value:", + taskCountToWait, postSyncAddress, waitTimeout); } else { - PRINT_DEBUG_STRING(true, stdout, - "%s", "\nWaiting completed. Current value:"); + PRINT_STRING(true, stdout, + "%s", "\nWaiting completed. Current value:"); } for (uint32_t i = 0; i < activePartitions; i++) { - PRINT_DEBUG_STRING(true, stdout, " %u", *postSyncAddress); + PRINT_STRING(true, stdout, " %u", *postSyncAddress); postSyncAddress = ptrOffset(postSyncAddress, this->immWritePostSyncWriteOffset); } - PRINT_DEBUG_STRING(true, stdout, "%s", "\n"); + PRINT_STRING(true, stdout, "%s", "\n"); } bool CommandStreamReceiver::isTbxMode() const { diff --git a/shared/source/compiler_interface/compiler_interface.inl b/shared/source/compiler_interface/compiler_interface.inl index bb6f89aafb..fd9fc5359c 100644 --- a/shared/source/compiler_interface/compiler_interface.inl +++ b/shared/source/compiler_interface/compiler_interface.inl @@ -93,7 +93,7 @@ inline bool loadCompiler(const char *libName, std::unique_ptr &outLib libraryProperties.errorValue = &loadLibraryError; auto lib = std::unique_ptr(OsLibrary::loadFunc(libraryProperties)); if (lib == nullptr) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Compiler Library %s could not be loaded with error: %s\n", libName, loadLibraryError.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Compiler Library %s could not be loaded with error: %s\n", libName, loadLibraryError.c_str()); DEBUG_BREAK_IF(true); // could not load library return false; } @@ -109,7 +109,7 @@ inline bool loadCompiler(const char *libName, std::unique_ptr &outLib std::vector interfacesToIgnore{IGC::OclGenBinaryBase::GetInterfaceId()}; if (false == main->IsCompatible(&interfacesToIgnore)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Installed Compiler Library %s is incompatible\n", libName); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Installed Compiler Library %s is incompatible\n", libName); DEBUG_BREAK_IF(true); // given compiler library is not compatible return false; } diff --git a/shared/source/compiler_interface/default_cache_config.cpp b/shared/source/compiler_interface/default_cache_config.cpp index 4bf843996d..8197cddd87 100644 --- a/shared/source/compiler_interface/default_cache_config.cpp +++ b/shared/source/compiler_interface/default_cache_config.cpp @@ -34,7 +34,7 @@ CompilerCacheConfig getDefaultCompilerCacheConfig() { if (isAnyIgcEnvVarSet()) { ret.enabled = false; - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, "WARNING: Detected IGC_* environment variable(s). Compiler cache is disabled.\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, "WARNING: Detected IGC_* environment variable(s). Compiler cache is disabled.\n"); return ret; } @@ -61,8 +61,8 @@ CompilerCacheConfig getDefaultCompilerCacheConfig() { ret.cacheSize = std::numeric_limits::max(); } - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, "NEO_CACHE_PERSISTENT is enabled. Cache is located in: %s\n\n", - ret.cacheDir.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stdout, "NEO_CACHE_PERSISTENT is enabled. Cache is located in: %s\n\n", + ret.cacheDir.c_str()); return ret; } diff --git a/shared/source/compiler_interface/linux/compiler_cache_linux.cpp b/shared/source/compiler_interface/linux/compiler_cache_linux.cpp index ad233d04b8..e86df51c8b 100644 --- a/shared/source/compiler_interface/linux/compiler_cache_linux.cpp +++ b/shared/source/compiler_interface/linux/compiler_cache_linux.cpp @@ -55,7 +55,7 @@ bool CompilerCache::evictCache(uint64_t &bytesEvicted) { const int filesCount = NEO::SysCalls::scandir(config.cacheDir.c_str(), &files, filterFunction, NULL); if (filesCount == -1) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Scandir failed! errno: %d\n", NEO::SysCalls::getProcessId(), errno); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Scandir failed! errno: %d\n", NEO::SysCalls::getProcessId(), errno); return false; } @@ -95,11 +95,11 @@ bool CompilerCache::evictCache(uint64_t &bytesEvicted) { bool CompilerCache::createUniqueTempFileAndWriteData(char *tmpFilePathTemplate, const char *pBinary, size_t binarySize) { int fd = NEO::SysCalls::mkstemp(tmpFilePathTemplate); if (fd == -1) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Creating temporary file failed! errno: %d\n", NEO::SysCalls::getProcessId(), errno); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Creating temporary file failed! errno: %d\n", NEO::SysCalls::getProcessId(), errno); return false; } if (NEO::SysCalls::pwrite(fd, pBinary, binarySize, 0) == -1) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Writing to temporary file failed! errno: %d\n", NEO::SysCalls::getProcessId(), errno); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Writing to temporary file failed! errno: %d\n", NEO::SysCalls::getProcessId(), errno); NEO::SysCalls::close(fd); NEO::SysCalls::unlink(tmpFilePathTemplate); return false; @@ -112,7 +112,7 @@ bool CompilerCache::renameTempFileBinaryToProperName(const std::string &oldName, int err = NEO::SysCalls::rename(oldName.c_str(), kernelFileHash.c_str()); if (err < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Rename temp file failed! errno: %d\n", NEO::SysCalls::getProcessId(), errno); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Rename temp file failed! errno: %d\n", NEO::SysCalls::getProcessId(), errno); NEO::SysCalls::unlink(oldName); return false; } @@ -124,7 +124,7 @@ void unlockFileAndClose(int fd) { int lockErr = NEO::SysCalls::flock(fd, LOCK_UN); if (lockErr < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: unlock file failed! errno: %d\n", NEO::SysCalls::getProcessId(), errno); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: unlock file failed! errno: %d\n", NEO::SysCalls::getProcessId(), errno); } NEO::SysCalls::close(fd); @@ -144,7 +144,7 @@ void CompilerCache::lockConfigFileAndReadSize(const std::string &configFilePath, countDirectorySize = true; } } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Open config file failed! errno: %d\n", NEO::SysCalls::getProcessId(), errno); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Open config file failed! errno: %d\n", NEO::SysCalls::getProcessId(), errno); return; } } @@ -152,7 +152,7 @@ void CompilerCache::lockConfigFileAndReadSize(const std::string &configFilePath, const int lockErr = NEO::SysCalls::flock(std::get(fd), LOCK_EX); if (lockErr < 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Lock config file failed! errno: %d\n", NEO::SysCalls::getProcessId(), errno); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Lock config file failed! errno: %d\n", NEO::SysCalls::getProcessId(), errno); NEO::SysCalls::close(std::get(fd)); std::get(fd) = -1; @@ -166,7 +166,7 @@ void CompilerCache::lockConfigFileAndReadSize(const std::string &configFilePath, if (filesCount == -1) { unlockFileAndClose(std::get(fd)); - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Scandir failed! errno: %d\n", NEO::SysCalls::getProcessId(), errno); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Scandir failed! errno: %d\n", NEO::SysCalls::getProcessId(), errno); std::get(fd) = -1; return; } @@ -196,7 +196,7 @@ void CompilerCache::lockConfigFileAndReadSize(const std::string &configFilePath, if (readErr < 0) { directorySize = 0; - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Read config failed! errno: %d\n", NEO::SysCalls::getProcessId(), errno); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Read config failed! errno: %d\n", NEO::SysCalls::getProcessId(), errno); unlockFileAndClose(std::get(fd)); std::get(fd) = -1; } diff --git a/shared/source/compiler_interface/windows/compiler_cache_windows.cpp b/shared/source/compiler_interface/windows/compiler_cache_windows.cpp index 91f65be235..9e973824fa 100644 --- a/shared/source/compiler_interface/windows/compiler_cache_windows.cpp +++ b/shared/source/compiler_interface/windows/compiler_cache_windows.cpp @@ -37,7 +37,7 @@ std::vector getFiles(const std::string &path) { hFind = NEO::SysCalls::findFirstFileA(newPath.c_str(), &ffd); if (hFind == INVALID_HANDLE_VALUE) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: File search failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: File search failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); return files; } @@ -66,7 +66,7 @@ void unlockFileAndClose(UnifiedHandle handle) { auto result = NEO::SysCalls::unlockFileEx(std::get(handle), 0, MAXDWORD, MAXDWORD, &overlapped); if (!result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Unlock file failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Unlock file failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); } NEO::SysCalls::closeHandle(std::get(handle)); @@ -105,7 +105,7 @@ void CompilerCache::lockConfigFileAndReadSize(const std::string &configFilePath, if (std::get(handle) == INVALID_HANDLE_VALUE) { if (SysCalls::getLastError() != ERROR_FILE_NOT_FOUND) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Open config file failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Open config file failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); return; } std::get(handle) = NEO::SysCalls::createFileA(configFilePath.c_str(), @@ -117,7 +117,7 @@ void CompilerCache::lockConfigFileAndReadSize(const std::string &configFilePath, NULL); if (std::get(handle) == INVALID_HANDLE_VALUE) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Create config file failed! error code: %lu\n", GetCurrentProcessId(), GetLastError()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Create config file failed! error code: %lu\n", GetCurrentProcessId(), GetLastError()); std::get(handle) = NEO::SysCalls::createFileA(configFilePath.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, @@ -140,7 +140,7 @@ void CompilerCache::lockConfigFileAndReadSize(const std::string &configFilePath, if (!result) { std::get(handle) = INVALID_HANDLE_VALUE; - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Lock config file failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Lock config file failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); return; } @@ -159,7 +159,7 @@ void CompilerCache::lockConfigFileAndReadSize(const std::string &configFilePath, directorySize = 0; unlockFileAndClose(std::get(handle)); std::get(handle) = INVALID_HANDLE_VALUE; - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: File pointer move failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: File pointer move failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); return; } @@ -174,7 +174,7 @@ void CompilerCache::lockConfigFileAndReadSize(const std::string &configFilePath, directorySize = 0; unlockFileAndClose(std::get(handle)); std::get(handle) = INVALID_HANDLE_VALUE; - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Read config failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Read config failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); } } } @@ -183,7 +183,7 @@ bool CompilerCache::createUniqueTempFileAndWriteData(char *tmpFilePath, const ch auto result = NEO::SysCalls::getTempFileNameA(config.cacheDir.c_str(), "TMP", 0, tmpFilePath); if (result == 0) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Creating temporary file name failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Creating temporary file name failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); return false; } @@ -196,7 +196,7 @@ bool CompilerCache::createUniqueTempFileAndWriteData(char *tmpFilePath, const ch NULL); // no template if (hTempFile == INVALID_HANDLE_VALUE) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Creating temporary file failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Creating temporary file failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); return false; } @@ -208,9 +208,9 @@ bool CompilerCache::createUniqueTempFileAndWriteData(char *tmpFilePath, const ch NULL); if (!result2) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Writing to temporary file failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Writing to temporary file failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); } else if (dwBytesWritten != (DWORD)binarySize) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Writing to temporary file failed! Incorrect number of bytes written: %lu vs %lu\n", NEO::SysCalls::getProcessId(), dwBytesWritten, (DWORD)binarySize); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Writing to temporary file failed! Incorrect number of bytes written: %lu vs %lu\n", NEO::SysCalls::getProcessId(), dwBytesWritten, (DWORD)binarySize); } NEO::SysCalls::closeHandle(hTempFile); @@ -247,9 +247,9 @@ void writeDirSizeToConfigFile(void *hConfigFile, size_t directorySize) { &overlapped); if (!result) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Writing to config file failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Writing to config file failed! error code: %lu\n", NEO::SysCalls::getProcessId(), SysCalls::getLastError()); } else if (sizeWritten != (DWORD)sizeof(directorySize)) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Writing to config file failed! Incorrect number of bytes written: %lu vs %lu\n", NEO::SysCalls::getProcessId(), sizeWritten, (DWORD)sizeof(directorySize)); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "PID %d [Cache failure]: Writing to config file failed! Incorrect number of bytes written: %lu vs %lu\n", NEO::SysCalls::getProcessId(), sizeWritten, (DWORD)sizeof(directorySize)); } } diff --git a/shared/source/debug_settings/debug_settings_manager.cpp b/shared/source/debug_settings/debug_settings_manager.cpp index b4b7d6593a..2fd2ff768f 100644 --- a/shared/source/debug_settings/debug_settings_manager.cpp +++ b/shared/source/debug_settings/debug_settings_manager.cpp @@ -145,7 +145,7 @@ void DebugSettingsManager::dumpFlags() const { std::string changedFlags; getStringWithFlags(allFlags, changedFlags); - PRINT_DEBUG_STRING(true, stdout, "%s", changedFlags.c_str()); + PRINT_STRING(true, stdout, "%s", changedFlags.c_str()); settingsDumpFile << allFlags; } diff --git a/shared/source/debug_settings/debug_settings_manager.h b/shared/source/debug_settings/debug_settings_manager.h index 5791800175..17d120940f 100644 --- a/shared/source/debug_settings/debug_settings_manager.h +++ b/shared/source/debug_settings/debug_settings_manager.h @@ -37,12 +37,6 @@ constexpr DebugFunctionalityLevel globalDebugFunctionalityLevel = DebugFunctiona constexpr DebugFunctionalityLevel globalDebugFunctionalityLevel = DebugFunctionalityLevel::none; #endif -#define PRINT_DEBUG_STRING(flag, stream, ...) \ - if (flag) \ - NEO::printDebugString(flag, stream, __VA_ARGS__); - -#define EMIT_WARNING(flag, stream, ...) PRINT_DEBUG_STRING(flag, stream, __VA_ARGS__) - namespace NEO { template class FileLogger; @@ -255,19 +249,22 @@ class DurationLog { }; template -void printDebugString(bool showDebugLogs, FILE *stream, Args... args) { - if (showDebugLogs) { - if (NEO::debugManager.flags.DebugMessagesBitmask.get() & DebugMessagesBitmask::withPid) { - IoFunctions::fprintf(stream, "[PID: %d] ", getpid()); - } - if (NEO::debugManager.flags.DebugMessagesBitmask.get() & DebugMessagesBitmask::withTimestamp) { - IoFunctions::fprintf(stream, "%s", NEO::DurationLog::getTimestamp().c_str()); - } - IoFunctions::fprintf(stream, args...); - flushDebugStream(stream, args...); +void printDebugStringForMacroUseOnly(FILE *stream, Args... args) { + if (NEO::debugManager.flags.DebugMessagesBitmask.get() & DebugMessagesBitmask::withPid) { + IoFunctions::fprintf(stream, "[PID: %d] ", getpid()); } + if (NEO::debugManager.flags.DebugMessagesBitmask.get() & DebugMessagesBitmask::withTimestamp) { + IoFunctions::fprintf(stream, "%s", NEO::DurationLog::getTimestamp().c_str()); + } + IoFunctions::fprintf(stream, args...); + flushDebugStream(stream, args...); } +#define PRINT_STRING(flag, stream, ...) \ + if (flag) { \ + NEO::printDebugStringForMacroUseOnly(stream, __VA_ARGS__); \ + } + #define PRINT_DEBUGGER_LOG_TO_FILE(...) \ NEO::debugManager.logLazyEvaluateArgs([&] { \ char temp[4000]; \ @@ -280,7 +277,7 @@ void printDebugString(bool showDebugLogs, FILE *stream, Args... args) { if (NEO::debugManager.flags.DebuggerLogBitmask.get() & NEO::DebugVariables::DEBUGGER_LOG_BITMASK::DUMP_TO_FILE) { \ PRINT_DEBUGGER_LOG_TO_FILE(__VA_ARGS__) \ } else { \ - NEO::printDebugString(true, OUT, __VA_ARGS__); \ + NEO::printDebugStringForMacroUseOnly(OUT, __VA_ARGS__); \ } #define PRINT_DEBUGGER_INFO_LOG(STR, ...) \ diff --git a/shared/source/debugger/linux/debugger_l0_linux.cpp b/shared/source/debugger/linux/debugger_l0_linux.cpp index 6d6f8c725a..0e64b0d55d 100644 --- a/shared/source/debugger/linux/debugger_l0_linux.cpp +++ b/shared/source/debugger/linux/debugger_l0_linux.cpp @@ -38,8 +38,8 @@ bool DebuggerL0::initDebuggingInOs(NEO::OSInterface *osInterface) { drm->registerResourceClasses(); return true; } else { - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, - "Debugging not enabled. VmBind: %d, per-context VMs: %d\n", vmBindAvailable ? 1 : 0, perContextVms ? 1 : 0); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, + "Debugging not enabled. VmBind: %d, per-context VMs: %d\n", vmBindAvailable ? 1 : 0, perContextVms ? 1 : 0); } } return false; diff --git a/shared/source/device/device.cpp b/shared/source/device/device.cpp index 0b06400dd6..2734697c26 100644 --- a/shared/source/device/device.cpp +++ b/shared/source/device/device.cpp @@ -207,7 +207,7 @@ bool Device::initializeCommonResources() { auto rootDeviceEnvironment = getExecutionEnvironment()->rootDeviceEnvironments[rootDeviceIndex].get(); rootDeviceEnvironment->initDebuggerL0(this); if (rootDeviceEnvironment->debugger == nullptr) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Debug mode is not enabled in the system.\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Debug mode is not enabled in the system.\n"); return false; } } @@ -221,7 +221,7 @@ bool Device::initializeCommonResources() { if (debugSurfaceSize) { allocateDebugSurface(debugSurfaceSize); } else { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Unable to determine debug surface size.\n"); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Unable to determine debug surface size.\n"); return false; } } @@ -1345,7 +1345,7 @@ EngineControl *SecondaryContexts::getEngine(EngineUsage usage, std::optional engineUsage: " << EngineHelpers::engineUsageToString(usage).c_str() << " index: " << secondaryEngineIndex << " priorityLevel: " << (engines[secondaryEngineIndex].osContext->hasPriorityLevel() ? std::to_string(engines[secondaryEngineIndex].osContext->getPriorityLevel()) : "std::nullopt") << " \n"; - PRINT_DEBUG_STRING(debugManager.flags.PrintSecondaryContextEngineInfo.get(), stdout, "%s", contextEngineInfo.str().c_str()); + PRINT_STRING(debugManager.flags.PrintSecondaryContextEngineInfo.get(), stdout, "%s", contextEngineInfo.str().c_str()); } return &engines[secondaryEngineIndex]; } diff --git a/shared/source/device_binary_format/patchtokens_decoder.cpp b/shared/source/device_binary_format/patchtokens_decoder.cpp index 82150c0906..4e41c26201 100644 --- a/shared/source/device_binary_format/patchtokens_decoder.cpp +++ b/shared/source/device_binary_format/patchtokens_decoder.cpp @@ -284,13 +284,13 @@ inline void decodeKernelDataParameterToken(const SPatchDataParameterBuffer *toke inline bool decodeToken(const SPatchItemHeader *token, KernelFromPatchtokens &out) { switch (token->Token) { default: { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "Unknown kernel-scope Patch Token: %d\n", token->Token); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "Unknown kernel-scope Patch Token: %d\n", token->Token); DEBUG_BREAK_IF(true); out.unhandledTokens.push_back(token); break; } case PATCH_TOKEN_INTERFACE_DESCRIPTOR_DATA: - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "Ignored kernel-scope Patch Token: %d\n", token->Token); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "Ignored kernel-scope Patch Token: %d\n", token->Token); break; case PATCH_TOKEN_SAMPLER_STATE_ARRAY: assignToken(out.tokens.samplerStateArray, token); @@ -397,7 +397,7 @@ inline bool decodeToken(const SPatchItemHeader *token, ProgramFromPatchtokens &o auto &progTok = out.programScopeTokens; switch (token->Token) { default: { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "Unknown program-scope Patch Token: %d\n", token->Token); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "Unknown program-scope Patch Token: %d\n", token->Token); DEBUG_BREAK_IF(true); out.unhandledTokens.push_back(token); break; diff --git a/shared/source/direct_submission/direct_submission_hw.inl b/shared/source/direct_submission/direct_submission_hw.inl index bb2067ada5..dc76a03be5 100644 --- a/shared/source/direct_submission/direct_submission_hw.inl +++ b/shared/source/direct_submission/direct_submission_hw.inl @@ -149,13 +149,13 @@ bool DirectSubmissionHw::allocateResources() { for (uint32_t ringBufferIndex = 0; ringBufferIndex < RingBufferUse::initialRingBufferCount; ringBufferIndex++) { const auto ringBuffer = this->ringBuffers[ringBufferIndex].ringBuffer; - printf("Ring buffer %u - gpu address: %" PRIx64 " - %" PRIx64 ", cpu address: %p - %p, size: %zu \n", - ringBufferIndex, - ringBuffer->getGpuAddress(), - ptrOffset(ringBuffer->getGpuAddress(), ringBuffer->getUnderlyingBufferSize()), - ringBuffer->getUnderlyingBuffer(), - ptrOffset(ringBuffer->getUnderlyingBuffer(), ringBuffer->getUnderlyingBufferSize()), - ringBuffer->getUnderlyingBufferSize()); + PRINT_STRING(true, stdout, "Ring buffer %u - gpu address: %" PRIx64 " - %" PRIx64 ", cpu address: %p - %p, size: %zu \n", + ringBufferIndex, + ringBuffer->getGpuAddress(), + ptrOffset(ringBuffer->getGpuAddress(), ringBuffer->getUnderlyingBufferSize()), + ringBuffer->getUnderlyingBuffer(), + ptrOffset(ringBuffer->getUnderlyingBuffer(), ringBuffer->getUnderlyingBufferSize()), + ringBuffer->getUnderlyingBufferSize()); } } @@ -201,7 +201,7 @@ inline void DirectSubmissionHw::unblockGpu() { *this->pciBarrierPtr = 0u; } - PRINT_DEBUG_STRING(debugManager.flags.DirectSubmissionPrintSemaphoreUsage.get() == 1, stdout, "DirectSubmission semaphore %" PRIx64 " unlocked with value: %u\n", semaphoreGpuVa, currentQueueWorkCount); + PRINT_STRING(debugManager.flags.DirectSubmissionPrintSemaphoreUsage.get() == 1, stdout, "DirectSubmission semaphore %" PRIx64 " unlocked with value: %u\n", semaphoreGpuVa, currentQueueWorkCount); semaphoreData->queueWorkCount = currentQueueWorkCount; } @@ -281,9 +281,8 @@ template inline void DirectSubmissionHw::dispatchSemaphoreSection(uint32_t value) { using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION; - if (debugManager.flags.DirectSubmissionPrintSemaphoreUsage.get() == 1) { - printf("DirectSubmission semaphore %" PRIx64 " programmed with value: %u\n", semaphoreGpuVa, value); - } + PRINT_STRING(debugManager.flags.DirectSubmissionPrintSemaphoreUsage.get() == 1, stdout, + "DirectSubmission semaphore %" PRIx64 " programmed with value: %u\n", semaphoreGpuVa, value); dispatchDisablePrefetcher(true); @@ -383,29 +382,53 @@ void *DirectSubmissionHw::dispatchWorkloadSection(BatchBu auto copyCmdBuffer = this->copyCommandBufferIntoRing(batchBuffer); if (debugManager.flags.DirectSubmissionPrintBuffers.get()) { - printf("Client buffer:\n"); - printf("Command buffer allocation - gpu address: %" PRIx64 " - %" PRIx64 ", cpu address: %p - %p, size: %zu \n", - batchBuffer.commandBufferAllocation->getGpuAddress(), - ptrOffset(batchBuffer.commandBufferAllocation->getGpuAddress(), batchBuffer.commandBufferAllocation->getUnderlyingBufferSize()), - batchBuffer.commandBufferAllocation->getUnderlyingBuffer(), - ptrOffset(batchBuffer.commandBufferAllocation->getUnderlyingBuffer(), batchBuffer.commandBufferAllocation->getUnderlyingBufferSize()), - batchBuffer.commandBufferAllocation->getUnderlyingBufferSize()); - printf("Command buffer - start gpu address: %" PRIx64 " - %" PRIx64 ", start cpu address: %p - %p, start offset: %zu, used size: %zu \n", - ptrOffset(batchBuffer.commandBufferAllocation->getGpuAddress(), batchBuffer.startOffset), - ptrOffset(batchBuffer.commandBufferAllocation->getGpuAddress(), batchBuffer.usedSize), - ptrOffset(batchBuffer.commandBufferAllocation->getUnderlyingBuffer(), batchBuffer.startOffset), - ptrOffset(batchBuffer.commandBufferAllocation->getUnderlyingBuffer(), batchBuffer.usedSize), - batchBuffer.startOffset, - batchBuffer.usedSize); - printf("Ring buffer for submission - start gpu address: %" PRIx64 " - %" PRIx64 ", start cpu address: %p - %p, size: %zu, submission address: %" PRIx64 ", used size: %zu, copyCmdBuffer: %d \n", - ringCommandStream.getGraphicsAllocation()->getGpuAddress(), - ptrOffset(ringCommandStream.getGraphicsAllocation()->getGpuAddress(), ringCommandStream.getGraphicsAllocation()->getUnderlyingBufferSize()), - ringCommandStream.getGraphicsAllocation()->getUnderlyingBuffer(), - ptrOffset(ringCommandStream.getGraphicsAllocation()->getUnderlyingBuffer(), ringCommandStream.getGraphicsAllocation()->getUnderlyingBufferSize()), - ringCommandStream.getGraphicsAllocation()->getUnderlyingBufferSize(), - ptrOffset(ringCommandStream.getGraphicsAllocation()->getGpuAddress(), ringCommandStream.getUsed()), - ringCommandStream.getUsed(), - copyCmdBuffer); + std::ostringstream ss; + // clang-format off + ss << std::showbase + << "Client buffer:\n" + << "Command buffer allocation - gpu address: " << std::hex + << batchBuffer.commandBufferAllocation->getGpuAddress() + << " - " + << ptrOffset(batchBuffer.commandBufferAllocation->getGpuAddress(), batchBuffer.commandBufferAllocation->getUnderlyingBufferSize()) + << ", cpu address: " + << batchBuffer.commandBufferAllocation->getUnderlyingBuffer() + << " - " + << ptrOffset(batchBuffer.commandBufferAllocation->getUnderlyingBuffer(), batchBuffer.commandBufferAllocation->getUnderlyingBufferSize()) + << ", size: " << std::dec + << batchBuffer.commandBufferAllocation->getUnderlyingBufferSize() + << "\n" + << "Command buffer - start gpu address: " << std::hex + << ptrOffset(batchBuffer.commandBufferAllocation->getGpuAddress(), batchBuffer.startOffset) + << " - " + << ptrOffset(batchBuffer.commandBufferAllocation->getGpuAddress(), batchBuffer.usedSize) + << ", start cpu address: " + << ptrOffset(batchBuffer.commandBufferAllocation->getUnderlyingBuffer(), batchBuffer.startOffset) + << " - " + << ptrOffset(batchBuffer.commandBufferAllocation->getUnderlyingBuffer(), batchBuffer.usedSize) + << ", start offset: " << std::dec + << batchBuffer.startOffset + << ", used size: " + << batchBuffer.usedSize + << "\n" + << "Ring buffer for submission - start gpu address: " << std::hex + << ringCommandStream.getGraphicsAllocation()->getGpuAddress() + << " - " + << ptrOffset(ringCommandStream.getGraphicsAllocation()->getGpuAddress(), ringCommandStream.getGraphicsAllocation()->getUnderlyingBufferSize()) + << ", start cpu address: " + << ringCommandStream.getGraphicsAllocation()->getUnderlyingBuffer() + << " - " + << ptrOffset(ringCommandStream.getGraphicsAllocation()->getUnderlyingBuffer(), ringCommandStream.getGraphicsAllocation()->getUnderlyingBufferSize()) + << ", size: " << std::dec + << ringCommandStream.getGraphicsAllocation()->getUnderlyingBufferSize() + << ", submission address: " << std::hex + << ptrOffset(ringCommandStream.getGraphicsAllocation()->getGpuAddress(), ringCommandStream.getUsed()) + << ", used size: " << std::dec + << ringCommandStream.getUsed() + << ", copyCmdBuffer: " + << copyCmdBuffer + << "\n"; + // clang-format on + PRINT_STRING(true, stdout, "%s", ss.str().c_str()); } if (batchBuffer.pagingFenceSemInfo.requiresProgrammingSemaphore()) { diff --git a/shared/source/direct_submission/linux/drm_direct_submission.inl b/shared/source/direct_submission/linux/drm_direct_submission.inl index fc195b8184..236bb4ca01 100644 --- a/shared/source/direct_submission/linux/drm_direct_submission.inl +++ b/shared/source/direct_submission/linux/drm_direct_submission.inl @@ -64,7 +64,7 @@ DrmDirectSubmission::DrmDirectSubmission(const DirectSubm this->pciBarrierPtr = ptr; } } - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "Using PCI barrier ptr: %p\n", this->pciBarrierPtr); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "Using PCI barrier ptr: %p\n", this->pciBarrierPtr); if (this->pciBarrierPtr) { this->miMemFenceRequired = false; } diff --git a/shared/source/dll/linux/drm_neo_create.cpp b/shared/source/dll/linux/drm_neo_create.cpp index 9f5d608bfe..ad36b5af28 100644 --- a/shared/source/dll/linux/drm_neo_create.cpp +++ b/shared/source/dll/linux/drm_neo_create.cpp @@ -54,8 +54,8 @@ Drm *Drm::create(std::unique_ptr &&hwDeviceId, RootDeviceEnvironm } } if (!deviceDescriptor) { - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, - "FATAL: Unknown device: deviceId: %04x, revisionId: %04x\n", usDeviceID, usRevId); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, + "FATAL: Unknown device: deviceId: %04x, revisionId: %04x\n", usDeviceID, usRevId); return nullptr; } @@ -64,7 +64,7 @@ Drm *Drm::create(std::unique_ptr &&hwDeviceId, RootDeviceEnvironm } if (drm->enableTurboBoost()) { - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Failed to request OCL Turbo Boost\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Failed to request OCL Turbo Boost\n"); } drm->checkContextDebugSupport(); @@ -79,7 +79,7 @@ Drm *Drm::create(std::unique_ptr &&hwDeviceId, RootDeviceEnvironm if (drm->isVmBindAvailable()) { drm->setPerContextVMRequired(true); } else { - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Debugging not supported\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Debugging not supported\n"); } } } @@ -92,7 +92,7 @@ Drm *Drm::create(std::unique_ptr &&hwDeviceId, RootDeviceEnvironm if (!drm->isPerContextVMRequired()) { if (!drm->createVirtualMemoryAddressSpace(GfxCoreHelper::getSubDevicesCount(&hwInfo))) { - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "INFO: Device doesn't support GEM Virtual Memory\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "INFO: Device doesn't support GEM Virtual Memory\n"); } } diff --git a/shared/source/gmm_helper/gmm.cpp b/shared/source/gmm_helper/gmm.cpp index 3c1266e383..ce06fc9314 100644 --- a/shared/source/gmm_helper/gmm.cpp +++ b/shared/source/gmm_helper/gmm.cpp @@ -193,10 +193,9 @@ void Gmm::applyAuxFlagsForBuffer(bool preferCompression) { compressionEnabled = true; } - if (debugManager.flags.PrintGmmCompressionParams.get()) { - printf("\nGmm Resource compression params: \n\tFlags.Gpu.CCS: %u\n\tFlags.Gpu.UnifiedAuxSurface: %u\n\tFlags.Info.RenderCompressed: %u", - resourceParams.Flags.Gpu.CCS, resourceParams.Flags.Gpu.UnifiedAuxSurface, resourceParams.Flags.Info.RenderCompressed); - } + PRINT_STRING(debugManager.flags.PrintGmmCompressionParams.get(), stdout, + "\nGmm Resource compression params: \n\tFlags.Gpu.CCS: %u\n\tFlags.Gpu.UnifiedAuxSurface: %u\n\tFlags.Info.RenderCompressed: %u", + resourceParams.Flags.Gpu.CCS, resourceParams.Flags.Gpu.UnifiedAuxSurface, resourceParams.Flags.Info.RenderCompressed); gfxCoreHelper.applyAdditionalCompressionSettings(*this, !compressionEnabled); } @@ -244,10 +243,9 @@ void Gmm::applyAuxFlagsForImage(ImageInfo &imgInfo, bool preferCompressed) { } } - if (debugManager.flags.PrintGmmCompressionParams.get()) { - printf("\nGmm Resource compression params: \n\tFlags.Gpu.CCS: %u\n\tFlags.Gpu.UnifiedAuxSurface: %u\n\tFlags.Info.RenderCompressed: %u", - resourceParams.Flags.Gpu.CCS, resourceParams.Flags.Gpu.UnifiedAuxSurface, resourceParams.Flags.Info.RenderCompressed); - } + PRINT_STRING(debugManager.flags.PrintGmmCompressionParams.get(), stdout, + "\nGmm Resource compression params: \n\tFlags.Gpu.CCS: %u\n\tFlags.Gpu.UnifiedAuxSurface: %u\n\tFlags.Info.RenderCompressed: %u", + resourceParams.Flags.Gpu.CCS, resourceParams.Flags.Gpu.UnifiedAuxSurface, resourceParams.Flags.Info.RenderCompressed); gfxCoreHelper.applyAdditionalCompressionSettings(*this, !compressionEnabled); } diff --git a/shared/source/helpers/blit_commands_helper_base.inl b/shared/source/helpers/blit_commands_helper_base.inl index 12749da40c..5dc7131dd3 100644 --- a/shared/source/helpers/blit_commands_helper_base.inl +++ b/shared/source/helpers/blit_commands_helper_base.inl @@ -222,8 +222,8 @@ BlitCommandsResult BlitCommandsHelper::dispatchBlitCommandsForBufferP uint64_t width = 1; uint64_t height = 1; - PRINT_DEBUG_STRING(debugManager.flags.PrintBlitDispatchDetails.get(), stdout, - "\nBlit dispatch with AuxTranslationDirection %u ", static_cast(blitProperties.auxTranslationDirection)); + PRINT_STRING(debugManager.flags.PrintBlitDispatchDetails.get(), stdout, + "\nBlit dispatch with AuxTranslationDirection %u ", static_cast(blitProperties.auxTranslationDirection)); dispatchPreBlitCommand(linearStream, rootDeviceEnvironment); auto bltCmd = GfxFamily::cmdInitXyCopyBlt; @@ -263,8 +263,8 @@ BlitCommandsResult BlitCommandsHelper::dispatchBlitCommandsForBufferP auto dstAddr = calculateBlitCommandDestinationBaseAddress(blitProperties, offset, row, slice); auto srcAddr = calculateBlitCommandSourceBaseAddress(blitProperties, offset, row, slice); - PRINT_DEBUG_STRING(debugManager.flags.PrintBlitDispatchDetails.get(), stdout, - "\nBlit command. width: %u, height: %u, srcAddr: %#llx, dstAddr: %#llx ", width, height, srcAddr, dstAddr); + PRINT_STRING(debugManager.flags.PrintBlitDispatchDetails.get(), stdout, + "\nBlit command. width: %u, height: %u, srcAddr: %#llx, dstAddr: %#llx ", width, height, srcAddr, dstAddr); tmpCmd.setDestinationBaseAddress(dstAddr); tmpCmd.setSourceBaseAddress(srcAddr); diff --git a/shared/source/helpers/blit_commands_helper_xehp_and_later.inl b/shared/source/helpers/blit_commands_helper_xehp_and_later.inl index ddf1508e80..dd322853ba 100644 --- a/shared/source/helpers/blit_commands_helper_xehp_and_later.inl +++ b/shared/source/helpers/blit_commands_helper_xehp_and_later.inl @@ -301,44 +301,47 @@ void BlitCommandsHelper::appendClearColor(const BlitProperties &blitP template void BlitCommandsHelper::printImageBlitBlockCopyCommand(const typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd, const uint32_t sliceIndex) { - printf("Slice index: %u\n", sliceIndex); - printf("ColorDepth: %u\n", blitCmd.getColorDepth()); - printf("SourcePitch: %u\n", blitCmd.getSourcePitch()); - printf("SourceTiling: %u\n", blitCmd.getSourceTiling()); - printf("SourceX1Coordinate_Left: %u\n", blitCmd.getSourceX1CoordinateLeft()); - printf("SourceY1Coordinate_Top: %u\n", blitCmd.getSourceY1CoordinateTop()); - printf("SourceBaseAddress: %" PRIx64 "\n", blitCmd.getSourceBaseAddress()); - printf("SourceXOffset: %u\n", blitCmd.getSourceXOffset()); - printf("SourceYOffset: %u\n", blitCmd.getSourceYOffset()); - printf("SourceTargetMemory: %u\n", blitCmd.getSourceTargetMemory()); - printf("SourceCompressionFormat: %u\n", blitCmd.getSourceCompressionFormat()); - printf("SourceSurfaceHeight: %u\n", blitCmd.getSourceSurfaceHeight()); - printf("SourceSurfaceWidth: %u\n", blitCmd.getSourceSurfaceWidth()); - printf("SourceSurfaceType: %u\n", blitCmd.getSourceSurfaceType()); - printf("SourceSurfaceQpitch: %u\n", blitCmd.getSourceSurfaceQpitch()); - printf("SourceSurfaceDepth: %u\n", blitCmd.getSourceSurfaceDepth()); - printf("SourceHorizontalAlign: %u\n", blitCmd.getSourceHorizontalAlign()); - printf("SourceVerticalAlign: %u\n", blitCmd.getSourceVerticalAlign()); - printf("SourceArrayIndex: %u\n", blitCmd.getSourceArrayIndex()); - printf("DestinationPitch: %u\n", blitCmd.getDestinationPitch()); - printf("DestinationTiling: %u\n", blitCmd.getDestinationTiling()); - printf("DestinationX1Coordinate_Left: %u\n", blitCmd.getDestinationX1CoordinateLeft()); - printf("DestinationY1Coordinate_Top: %u\n", blitCmd.getDestinationY1CoordinateTop()); - printf("DestinationX2Coordinate_Right: %u\n", blitCmd.getDestinationX2CoordinateRight()); - printf("DestinationY2Coordinate_Bottom: %u\n", blitCmd.getDestinationY2CoordinateBottom()); - printf("DestinationBaseAddress: %" PRIx64 "\n", blitCmd.getDestinationBaseAddress()); - printf("DestinationXOffset: %u\n", blitCmd.getDestinationXOffset()); - printf("DestinationYOffset: %u\n", blitCmd.getDestinationYOffset()); - printf("DestinationTargetMemory: %u\n", blitCmd.getDestinationTargetMemory()); - printf("DestinationCompressionFormat: %u\n", blitCmd.getDestinationCompressionFormat()); - printf("DestinationSurfaceHeight: %u\n", blitCmd.getDestinationSurfaceHeight()); - printf("DestinationSurfaceWidth: %u\n", blitCmd.getDestinationSurfaceWidth()); - printf("DestinationSurfaceType: %u\n", blitCmd.getDestinationSurfaceType()); - printf("DestinationSurfaceQpitch: %u\n", blitCmd.getDestinationSurfaceQpitch()); - printf("DestinationSurfaceDepth: %u\n", blitCmd.getDestinationSurfaceDepth()); - printf("DestinationHorizontalAlign: %u\n", blitCmd.getDestinationHorizontalAlign()); - printf("DestinationVerticalAlign: %u\n", blitCmd.getDestinationVerticalAlign()); - printf("DestinationArrayIndex: %u\n\n", blitCmd.getDestinationArrayIndex()); + std::ostringstream ss; + ss << std::showbase; + ss << "Slice index: " << sliceIndex << "\n"; + ss << "ColorDepth: " << blitCmd.getColorDepth() << "\n"; + ss << "SourcePitch: " << blitCmd.getSourcePitch() << "\n"; + ss << "SourceTiling: " << blitCmd.getSourceTiling() << "\n"; + ss << "SourceX1Coordinate_Left: " << blitCmd.getSourceX1CoordinateLeft() << "\n"; + ss << "SourceY1Coordinate_Top: " << blitCmd.getSourceY1CoordinateTop() << "\n"; + ss << "SourceBaseAddress: " << std::hex << blitCmd.getSourceBaseAddress() << std::dec << "\n"; + ss << "SourceXOffset: " << blitCmd.getSourceXOffset() << "\n"; + ss << "SourceYOffset: " << blitCmd.getSourceYOffset() << "\n"; + ss << "SourceTargetMemory: " << blitCmd.getSourceTargetMemory() << "\n"; + ss << "SourceCompressionFormat: " << blitCmd.getSourceCompressionFormat() << "\n"; + ss << "SourceSurfaceHeight: " << blitCmd.getSourceSurfaceHeight() << "\n"; + ss << "SourceSurfaceWidth: " << blitCmd.getSourceSurfaceWidth() << "\n"; + ss << "SourceSurfaceType: " << blitCmd.getSourceSurfaceType() << "\n"; + ss << "SourceSurfaceQpitch: " << blitCmd.getSourceSurfaceQpitch() << "\n"; + ss << "SourceSurfaceDepth: " << blitCmd.getSourceSurfaceDepth() << "\n"; + ss << "SourceHorizontalAlign: " << blitCmd.getSourceHorizontalAlign() << "\n"; + ss << "SourceVerticalAlign: " << blitCmd.getSourceVerticalAlign() << "\n"; + ss << "SourceArrayIndex: " << blitCmd.getSourceArrayIndex() << "\n"; + ss << "DestinationPitch: " << blitCmd.getDestinationPitch() << "\n"; + ss << "DestinationTiling: " << blitCmd.getDestinationTiling() << "\n"; + ss << "DestinationX1Coordinate_Left: " << blitCmd.getDestinationX1CoordinateLeft() << "\n"; + ss << "DestinationY1Coordinate_Top: " << blitCmd.getDestinationY1CoordinateTop() << "\n"; + ss << "DestinationX2Coordinate_Right: " << blitCmd.getDestinationX2CoordinateRight() << "\n"; + ss << "DestinationY2Coordinate_Bottom: " << blitCmd.getDestinationY2CoordinateBottom() << "\n"; + ss << "DestinationBaseAddress: " << std::hex << blitCmd.getDestinationBaseAddress() << std::dec << "\n"; + ss << "DestinationXOffset: " << blitCmd.getDestinationXOffset() << "\n"; + ss << "DestinationYOffset: " << blitCmd.getDestinationYOffset() << "\n"; + ss << "DestinationTargetMemory: " << blitCmd.getDestinationTargetMemory() << "\n"; + ss << "DestinationCompressionFormat: " << blitCmd.getDestinationCompressionFormat() << "\n"; + ss << "DestinationSurfaceHeight: " << blitCmd.getDestinationSurfaceHeight() << "\n"; + ss << "DestinationSurfaceWidth: " << blitCmd.getDestinationSurfaceWidth() << "\n"; + ss << "DestinationSurfaceType: " << blitCmd.getDestinationSurfaceType() << "\n"; + ss << "DestinationSurfaceQpitch: " << blitCmd.getDestinationSurfaceQpitch() << "\n"; + ss << "DestinationSurfaceDepth: " << blitCmd.getDestinationSurfaceDepth() << "\n"; + ss << "DestinationHorizontalAlign: " << blitCmd.getDestinationHorizontalAlign() << "\n"; + ss << "DestinationVerticalAlign: " << blitCmd.getDestinationVerticalAlign() << "\n"; + ss << "DestinationArrayIndex: " << blitCmd.getDestinationArrayIndex() << "\n\n"; + PRINT_STRING(true, stdout, "%s", ss.str().c_str()); } template diff --git a/shared/source/helpers/debug_helpers.cpp b/shared/source/helpers/debug_helpers.cpp index 8d924e6f31..244a4accc8 100644 --- a/shared/source/helpers/debug_helpers.cpp +++ b/shared/source/helpers/debug_helpers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -16,13 +16,13 @@ namespace NEO { void debugBreak(int line, const char *file) { if (debugManager.flags.EnableDebugBreak.get()) { - printf("Assert was called at %d line in file:\n%s\n", line, file); + PRINT_STRING(true, stdout, "Assert was called at %d line in file:\n%s\n", line, file); fflush(stdout); assert(false); } } void abortUnrecoverable(int line, const char *file) { - printf("Abort was called at %d line in file:\n%s\n", line, file); + PRINT_STRING(true, stdout, "Abort was called at %d line in file:\n%s\n", line, file); fflush(stdout); abortExecution(); } diff --git a/shared/source/helpers/gfx_core_helper_xe2_and_later.inl b/shared/source/helpers/gfx_core_helper_xe2_and_later.inl index 5fb8595b2c..e5758e225e 100644 --- a/shared/source/helpers/gfx_core_helper_xe2_and_later.inl +++ b/shared/source/helpers/gfx_core_helper_xe2_and_later.inl @@ -19,9 +19,8 @@ void GfxCoreHelperHw::applyAdditionalCompressionSettings(Gmm &gmm, bool gmm.applyExtraAuxInitFlag(); } - if (debugManager.flags.PrintGmmCompressionParams.get()) { - printf("\n\tFlags.Info.NotCompressed: %u", gmm.resourceParams.Flags.Info.NotCompressed); - } + PRINT_STRING(debugManager.flags.PrintGmmCompressionParams.get(), stdout, + "\n\tFlags.Info.NotCompressed: %u", gmm.resourceParams.Flags.Info.NotCompressed); } template <> diff --git a/shared/source/helpers/kernel_helpers.cpp b/shared/source/helpers/kernel_helpers.cpp index c02176661e..47f4bba21c 100644 --- a/shared/source/helpers/kernel_helpers.cpp +++ b/shared/source/helpers/kernel_helpers.cpp @@ -92,23 +92,23 @@ KernelHelper::ErrorCode KernelHelper::checkIfThereIsSpaceForScratchOrPrivate(Ker auto totalScratchSize = KernelHelper::getScratchSize(attributes.perThreadScratchSize[0], computeUnitsForScratch); auto totalPrivateScratchSize = KernelHelper::getPrivateScratchSize(attributes.perThreadScratchSize[1], computeUnitsForScratch); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, - "computeUnits for each thread: %u\n", computeUnitsForScratch); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, + "computeUnits for each thread: %u\n", computeUnitsForScratch); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, - "global memory size: %llu\n", globalMemorySize); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, + "global memory size: %llu\n", globalMemorySize); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, - "perHwThreadPrivateMemorySize: %u\t totalPrivateMemorySize: %lu\n", - attributes.perHwThreadPrivateMemorySize, totalPrivateMemorySize); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, + "perHwThreadPrivateMemorySize: %u\t totalPrivateMemorySize: %lu\n", + attributes.perHwThreadPrivateMemorySize, totalPrivateMemorySize); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, - "perHwThreadScratchSize: %u\t totalScratchSize: %lu\n", - attributes.perThreadScratchSize[0], totalScratchSize); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, + "perHwThreadScratchSize: %u\t totalScratchSize: %lu\n", + attributes.perThreadScratchSize[0], totalScratchSize); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, - "perHwThreadPrivateScratchSize: %u\t totalPrivateScratchSize: %lu\n", - attributes.perThreadScratchSize[1], totalPrivateScratchSize); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, + "perHwThreadPrivateScratchSize: %u\t totalPrivateScratchSize: %lu\n", + attributes.perThreadScratchSize[1], totalPrivateScratchSize); if (totalPrivateMemorySize > globalMemorySize || totalScratchSize > globalMemorySize || diff --git a/shared/source/helpers/timestamp_packet.h b/shared/source/helpers/timestamp_packet.h index d898d68674..3fa8f0326a 100644 --- a/shared/source/helpers/timestamp_packet.h +++ b/shared/source/helpers/timestamp_packet.h @@ -102,9 +102,10 @@ struct TimestampPacketHelper { static void programSemaphore(LinearStream &cmdStream, TagNodeBase ×tampPacketNode) { using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION; - if (debugManager.flags.PrintTimestampPacketUsage.get() == 1) { - printf("\nPID: %u, TSP used for Semaphore: 0x%" PRIX64 ", cmdBuffer pos: 0x%" PRIX64, SysCalls::getProcessId(), timestampPacketNode.getGpuAddress(), cmdStream.getCurrentGpuAddressPosition()); - } + PRINT_STRING(debugManager.flags.PrintTimestampPacketUsage.get() == 1, + stdout, + "\nPID: %u, TSP used for Semaphore: 0x%" PRIX64 ", cmdBuffer pos: 0x%" PRIX64, + SysCalls::getProcessId(), timestampPacketNode.getGpuAddress(), cmdStream.getCurrentGpuAddressPosition()); auto compareAddress = getContextEndGpuAddress(timestampPacketNode); diff --git a/shared/source/os_interface/device_factory.cpp b/shared/source/os_interface/device_factory.cpp index 7e7f2cc42c..117e4bd5bf 100644 --- a/shared/source/os_interface/device_factory.cpp +++ b/shared/source/os_interface/device_factory.cpp @@ -97,11 +97,11 @@ bool DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(ExecutionE devIds << "0x" << std::hex << id << ", "; } - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), - stdout, "Info@ %s(): Mismatch of device ids. ForceDeviceId %s is used for platform with multiple deviceIds: [%s]. Consider using OverrideHwIpVersion flag.\n", - __FUNCTION__, - debugManager.flags.ForceDeviceId.get().c_str(), - devIds.str().substr(0, devIds.str().size() - 2).c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), + stdout, "Info@ %s(): Mismatch of device ids. ForceDeviceId %s is used for platform with multiple deviceIds: [%s]. Consider using OverrideHwIpVersion flag.\n", + __FUNCTION__, + debugManager.flags.ForceDeviceId.get().c_str(), + devIds.str().substr(0, devIds.str().size() - 2).c_str()); } } hardwareInfo->ipVersion.value = compilerProductHelper.getHwIpVersion(*hardwareInfo); @@ -201,12 +201,12 @@ bool DeviceFactory::validateDeviceFlags(const ProductHelper &productHelper) { if (!DeviceFactory::isHwModeSelected()) { if (debugManager.flags.ProductFamilyOverride.get() == "unk") { - PRINT_DEBUG_STRING(true, stderr, "Missing override for product family, required to set flag ProductFamilyOverride in non hw mode\n"); + PRINT_STRING(true, stderr, "Missing override for product family, required to set flag ProductFamilyOverride in non hw mode\n"); ret = false; } if (!(productHelper.isDeviceCapsReaderSupported()) && debugManager.flags.HardwareInfoOverride.get() == "default") { - PRINT_DEBUG_STRING(true, stderr, "Missing override for hardware info, required to set flag HardwareInfoOverride in non hw mode\n"); + PRINT_STRING(true, stderr, "Missing override for hardware info, required to set flag HardwareInfoOverride in non hw mode\n"); ret = false; } } diff --git a/shared/source/os_interface/linux/drm_allocation.cpp b/shared/source/os_interface/linux/drm_allocation.cpp index d0ed6144c4..a9308c1d7e 100644 --- a/shared/source/os_interface/linux/drm_allocation.cpp +++ b/shared/source/os_interface/linux/drm_allocation.cpp @@ -126,13 +126,13 @@ bool DrmAllocation::setPreferredLocation(Drm *drm, PreferredLocation memoryLocat region.memory_instance = memRegions[i / (this->storageInfo.numOfChunks / memRegions.size())].memoryInstance; uint64_t chunkLength = (bufferObjects[0]->peekSize() / this->storageInfo.numOfChunks); uint64_t chunkStart = i * chunkLength; - printDebugString(debugManager.flags.PrintBOChunkingLogs.get(), stdout, - "Setting PRELIM_DRM_I915_GEM_VM_ADVISE for BO-%d chunk 0x%lx chunkLength %ld memory_class %d, memory_region %d\n", - bufferObjects[0]->peekHandle(), - chunkStart, - chunkLength, - region.memory_class, - region.memory_instance); + PRINT_STRING(debugManager.flags.PrintBOChunkingLogs.get(), stdout, + "Setting PRELIM_DRM_I915_GEM_VM_ADVISE for BO-%d chunk 0x%lx chunkLength %ld memory_class %d, memory_region %d\n", + bufferObjects[0]->peekHandle(), + chunkStart, + chunkLength, + region.memory_class, + region.memory_instance); success &= ioctlHelper->setVmBoAdviseForChunking(bufferObjects[0]->peekHandle(), chunkStart, chunkLength, @@ -230,15 +230,15 @@ bool DrmAllocation::prefetchBOWithChunking(Drm *drm) { auto region = static_cast((memoryClassDevice << 16u) | subDeviceId); auto vmId = drm->getVirtualMemoryAddressSpace(vmHandleId); - PRINT_DEBUG_STRING(debugManager.flags.PrintBOPrefetchingResult.get(), stdout, - "prefetching BO=%d to VM %u, drmVmId=%u, range: %llx - %llx, size: %lld, region: %x\n", - bo->peekHandle(), vmId, vmHandleId, chunkStart, ptrOffset(chunkStart, chunkLength), chunkLength, region); + PRINT_STRING(debugManager.flags.PrintBOPrefetchingResult.get(), stdout, + "prefetching BO=%d to VM %u, drmVmId=%u, range: %llx - %llx, size: %lld, region: %x\n", + bo->peekHandle(), vmId, vmHandleId, chunkStart, ptrOffset(chunkStart, chunkLength), chunkLength, region); success &= ioctlHelper->setVmPrefetch(chunkStart, chunkLength, region, vmId); - PRINT_DEBUG_STRING(debugManager.flags.PrintBOPrefetchingResult.get(), stdout, - "prefetched BO=%d to VM %u, drmVmId=%u, range: %llx - %llx, size: %lld, region: %x, result: %d\n", - bo->peekHandle(), vmId, vmHandleId, chunkStart, ptrOffset(chunkStart, chunkLength), chunkLength, region, success); + PRINT_STRING(debugManager.flags.PrintBOPrefetchingResult.get(), stdout, + "prefetched BO=%d to VM %u, drmVmId=%u, range: %llx - %llx, size: %lld, region: %x, result: %d\n", + bo->peekHandle(), vmId, vmHandleId, chunkStart, ptrOffset(chunkStart, chunkLength), chunkLength, region, success); } } @@ -329,9 +329,9 @@ bool DrmAllocation::prefetchBO(BufferObject *bo, uint32_t vmHandleId, uint32_t s auto result = ioctlHelper->setVmPrefetch(bo->peekAddress(), bo->peekSize(), region, vmId); - PRINT_DEBUG_STRING(debugManager.flags.PrintBOPrefetchingResult.get(), stdout, - "prefetch BO=%d to VM %u, drmVmId=%u, range: %llx - %llx, size: %lld, region: %x, result: %d\n", - bo->peekHandle(), vmId, vmHandleId, bo->peekAddress(), ptrOffset(bo->peekAddress(), bo->peekSize()), bo->peekSize(), region, result); + PRINT_STRING(debugManager.flags.PrintBOPrefetchingResult.get(), stdout, + "prefetch BO=%d to VM %u, drmVmId=%u, range: %llx - %llx, size: %lld, region: %x, result: %d\n", + bo->peekHandle(), vmId, vmHandleId, bo->peekAddress(), ptrOffset(bo->peekAddress(), bo->peekSize()), bo->peekSize(), region, result); return result; } diff --git a/shared/source/os_interface/linux/drm_buffer_object.cpp b/shared/source/os_interface/linux/drm_buffer_object.cpp index 649e1ac13f..462cf9c1da 100644 --- a/shared/source/os_interface/linux/drm_buffer_object.cpp +++ b/shared/source/os_interface/linux/drm_buffer_object.cpp @@ -115,7 +115,7 @@ void BufferObject::setAddress(uint64_t address) { bool BufferObject::close() { if (!this->handle.canCloseBoHandle()) { - PRINT_DEBUG_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "Skipped closing BO-%d - more shared users!\n", this->handle.getBoHandle()); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "Skipped closing BO-%d - more shared users!\n", this->handle.getBoHandle()); return true; } @@ -123,7 +123,7 @@ bool BufferObject::close() { close.handle = this->handle.getBoHandle(); close.userptr = this->userptr; - PRINT_DEBUG_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "Calling gem close on handle: BO-%d\n", this->handle.getBoHandle()); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "Calling gem close on handle: BO-%d\n", this->handle.getBoHandle()); auto ioctlHelper = this->drm->getIoctlHelper(); int ret = ioctlHelper->ioctl(DrmIoctl::gemClose, &close); @@ -132,7 +132,7 @@ bool BufferObject::close() { CREATE_DEBUG_STRING(str, "ioctl(GEM_CLOSE) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); drm->getRootDeviceEnvironment().executionEnvironment.setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, str.get()); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, str.get()); DEBUG_BREAK_IF(true); return false; @@ -198,7 +198,7 @@ int BufferObject::exec(uint32_t used, size_t startOffset, unsigned int flags, bo alignUp(used, 8), flags, drmContextId); if (debugManager.flags.PrintExecutionBuffer.get()) { - PRINT_DEBUG_STRING(debugManager.flags.PrintExecutionBuffer.get(), stdout, "Exec called with drmVmId = %u\n", drm->getVmIdForContext(*osContext, vmHandleId)); + PRINT_STRING(debugManager.flags.PrintExecutionBuffer.get(), stdout, "Exec called with drmVmId = %u\n", drm->getVmIdForContext(*osContext, vmHandleId)); printExecutionBuffer(execbuf, residencyCount, execObjectsStorage, residency); } @@ -208,7 +208,7 @@ int BufferObject::exec(uint32_t used, size_t startOffset, unsigned int flags, bo if (ret != 0) { int err = this->drm->getErrno(); if (err == EOPNOTSUPP) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(I915_GEM_EXECBUFFER2) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(I915_GEM_EXECBUFFER2) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); return err; } @@ -219,7 +219,7 @@ int BufferObject::exec(uint32_t used, size_t startOffset, unsigned int flags, bo if (ret != 0) { const auto status = evictUnusedAllocations(true, true); if (status == MemoryOperationsStatus::gpuHangDetectedDuringOperation) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "Error! GPU hang detected in BufferObject::exec(). Returning %d\n", gpuHangDetected); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "Error! GPU hang detected in BufferObject::exec(). Returning %d\n", gpuHangDetected); return gpuHangDetected; } @@ -231,7 +231,7 @@ int BufferObject::exec(uint32_t used, size_t startOffset, unsigned int flags, bo } int err = this->drm->getErrno(); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(I915_GEM_EXECBUFFER2) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(I915_GEM_EXECBUFFER2) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); return err; } @@ -243,20 +243,20 @@ void BufferObject::printBOBindingResult(OsContext *osContext, uint32_t vmHandleI auto vmId = this->drm->getVmIdForContext(*osContext, vmHandleId); if (retVal == 0) { if (bind) { - PRINT_DEBUG_STRING(debugManager.flags.PrintBOBindingResult.get(), stdout, "bind BO-%d to VM %u, vmHandleId = %u, range: %llx - %llx, size: %lld, result: %d\n", - this->handle.getBoHandle(), vmId, vmHandleId, this->gpuAddress, ptrOffset(this->gpuAddress, this->size), this->size, retVal); + PRINT_STRING(debugManager.flags.PrintBOBindingResult.get(), stdout, "bind BO-%d to VM %u, vmHandleId = %u, range: %llx - %llx, size: %lld, result: %d\n", + this->handle.getBoHandle(), vmId, vmHandleId, this->gpuAddress, ptrOffset(this->gpuAddress, this->size), this->size, retVal); } else { - PRINT_DEBUG_STRING(debugManager.flags.PrintBOBindingResult.get(), stdout, "unbind BO-%d from VM %u, vmHandleId = %u, range: %llx - %llx, size: %lld, result: %d\n", - this->handle.getBoHandle(), vmId, vmHandleId, this->gpuAddress, ptrOffset(this->gpuAddress, this->size), this->size, retVal); + PRINT_STRING(debugManager.flags.PrintBOBindingResult.get(), stdout, "unbind BO-%d from VM %u, vmHandleId = %u, range: %llx - %llx, size: %lld, result: %d\n", + this->handle.getBoHandle(), vmId, vmHandleId, this->gpuAddress, ptrOffset(this->gpuAddress, this->size), this->size, retVal); } } else { auto err = this->drm->getErrno(); if (bind) { - PRINT_DEBUG_STRING(debugManager.flags.PrintBOBindingResult.get(), stderr, "bind BO-%d to VM %u, vmHandleId = %u, range: %llx - %llx, size: %lld, result: %d, errno: %d(%s)\n", - this->handle.getBoHandle(), vmId, vmHandleId, this->gpuAddress, ptrOffset(this->gpuAddress, this->size), this->size, retVal, err, strerror(err)); + PRINT_STRING(debugManager.flags.PrintBOBindingResult.get(), stderr, "bind BO-%d to VM %u, vmHandleId = %u, range: %llx - %llx, size: %lld, result: %d, errno: %d(%s)\n", + this->handle.getBoHandle(), vmId, vmHandleId, this->gpuAddress, ptrOffset(this->gpuAddress, this->size), this->size, retVal, err, strerror(err)); } else { - PRINT_DEBUG_STRING(debugManager.flags.PrintBOBindingResult.get(), stderr, "unbind BO-%d from VM %u, vmHandleId = %u, range: %llx - %llx, size: %lld, result: %d, errno: %d(%s)\n", - this->handle.getBoHandle(), vmId, vmHandleId, this->gpuAddress, ptrOffset(this->gpuAddress, this->size), this->size, retVal, err, strerror(err)); + PRINT_STRING(debugManager.flags.PrintBOBindingResult.get(), stderr, "unbind BO-%d from VM %u, vmHandleId = %u, range: %llx - %llx, size: %lld, result: %d, errno: %d(%s)\n", + this->handle.getBoHandle(), vmId, vmHandleId, this->gpuAddress, ptrOffset(this->gpuAddress, this->size), this->size, retVal, err, strerror(err)); } } } @@ -303,7 +303,7 @@ void BufferObject::printExecutionBuffer(ExecBuffer &execbuf, const size_t &resid logger << "Command "; ioctlHelper->logExecObject(execObjectsStorage[i], logger, this->peekSize()); - PRINT_DEBUG_STRING(debugManager.flags.PrintExecutionBuffer.get(), stdout, "%s\n", logger.str().c_str()); + PRINT_STRING(debugManager.flags.PrintExecutionBuffer.get(), stdout, "%s\n", logger.str().c_str()); } int bindBOsWithinContext(BufferObject *const boToPin[], size_t numberOfBos, OsContext *osContext, uint32_t vmHandleId, const bool forcePagingFence) { diff --git a/shared/source/os_interface/linux/drm_command_stream.inl b/shared/source/os_interface/linux/drm_command_stream.inl index 3ce1e70d90..f99bebfb16 100644 --- a/shared/source/os_interface/linux/drm_command_stream.inl +++ b/shared/source/os_interface/linux/drm_command_stream.inl @@ -198,11 +198,11 @@ SubmissionStatus DrmCommandStreamReceiver::printBOsForSubmit(Residenc } } } - PRINT_DEBUG_STRING(true, stdout, "Buffer object for submit\n"); + PRINT_STRING(true, stdout, "Buffer object for submit\n"); for (const auto &bo : bosForSubmit) { - PRINT_DEBUG_STRING(true, stdout, "BO-%d, range: %" SCNx64 " - %" SCNx64 ", size: %" SCNdPTR "\n", bo->peekHandle(), bo->peekAddress(), ptrOffset(bo->peekAddress(), bo->peekSize()), bo->peekSize()); + PRINT_STRING(true, stdout, "BO-%d, range: %" SCNx64 " - %" SCNx64 ", size: %" SCNdPTR "\n", bo->peekHandle(), bo->peekAddress(), ptrOffset(bo->peekAddress(), bo->peekSize()), bo->peekSize()); } - PRINT_DEBUG_STRING(true, stdout, "\n"); + PRINT_STRING(true, stdout, "\n"); } return SubmissionStatus::success; } @@ -323,9 +323,8 @@ SubmissionStatus DrmCommandStreamReceiver::flushInternal(const BatchB return processResidencySuccess; } - if (debugManager.flags.PrintDeviceAndEngineIdOnSubmission.get()) { - printf("%u: Drm Submission of contextIndex: %u, with context id %u\n", SysCalls::getProcessId(), contextIndex, drmContextIds[contextIndex]); - } + PRINT_STRING(debugManager.flags.PrintDeviceAndEngineIdOnSubmission.get(), stdout, + "%u: Drm Submission of contextIndex: %u, with context id %u\n", SysCalls::getProcessId(), contextIndex, drmContextIds[contextIndex]); int ret = this->exec(batchBuffer, tileIterator, drmContextIds[contextIndex], contextIndex); if (ret) { diff --git a/shared/source/os_interface/linux/drm_memory_manager.cpp b/shared/source/os_interface/linux/drm_memory_manager.cpp index 32b270dccd..2a65014603 100644 --- a/shared/source/os_interface/linux/drm_memory_manager.cpp +++ b/shared/source/os_interface/linux/drm_memory_manager.cpp @@ -58,7 +58,7 @@ int debugMunmap(void *ptr, size_t size) noexcept { int returnVal = munmap(ptr, size); - printf("\nmunmap(%p, %zu) = %d, errno: %d \n", ptr, size, returnVal, errno); + PRINT_STRING(true, stdout, "\nmunmap(%p, %zu) = %d, errno: %d \n", ptr, size, returnVal, errno); return returnVal; } @@ -68,7 +68,7 @@ void *debugMmap(void *ptr, size_t size, int prot, int flags, int fd, off_t offse void *returnVal = mmap(ptr, size, prot, flags, fd, offset); - printf("\nmmap(%p, %zu, %d, %d, %d, %ld) = %p, errno: %d \n", ptr, size, prot, flags, fd, offset, returnVal, errno); + PRINT_STRING(true, stdout, "\nmmap(%p, %zu, %d, %d, %d, %ld) = %p, errno: %d \n", ptr, size, prot, flags, fd, offset, returnVal, errno); return returnVal; } @@ -403,7 +403,7 @@ NEO::BufferObject *DrmMemoryManager::allocUserptr(uintptr_t address, size_t size return nullptr; } - PRINT_DEBUG_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "Created new BO with GEM_USERPTR, handle: BO-%d\n", userptr.handle); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "Created new BO with GEM_USERPTR, handle: BO-%d\n", userptr.handle); auto patIndex = drm.getPatIndex(nullptr, allocationType, CacheRegion::defaultRegion, CachePolicy::writeBack, false, true); @@ -1131,7 +1131,7 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromMultipleShared if (ret != 0) { [[maybe_unused]] int err = errno; - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(PRIME_FD_TO_HANDLE) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(PRIME_FD_TO_HANDLE) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); return nullptr; } @@ -1285,7 +1285,7 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(c if (ret != 0) { [[maybe_unused]] int err = errno; - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(PRIME_FD_TO_HANDLE) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(PRIME_FD_TO_HANDLE) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); return nullptr; } @@ -1335,12 +1335,12 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(c bo->setAddress(gpuRange); bo->setUnmapSize(size); - printDebugString(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, - "Created BO-%d range: %llx - %llx, size: %lld from PRIME_FD_TO_HANDLE\n", - bo->peekHandle(), - bo->peekAddress(), - ptrOffset(bo->peekAddress(), bo->peekSize()), - bo->peekSize()); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, + "Created BO-%d range: %llx - %llx, size: %lld from PRIME_FD_TO_HANDLE\n", + bo->peekHandle(), + bo->peekAddress(), + ptrOffset(bo->peekAddress(), bo->peekSize()), + bo->peekSize()); pushSharedBufferObject(bo); } @@ -2719,7 +2719,7 @@ void *DrmMemoryManager::lockBufferObject(BufferObject *bo) { DEBUG_BREAK_IF(addr == MAP_FAILED); if (addr == MAP_FAILED) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "mmap return of MAP_FAILED\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "mmap return of MAP_FAILED\n"); return nullptr; } @@ -2797,7 +2797,7 @@ GraphicsAllocation *DrmMemoryManager::createSharedUnifiedMemoryAllocation(const } if (cpuPointer == MAP_FAILED) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "mmap return of MAP_FAILED\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "mmap return of MAP_FAILED\n"); return nullptr; } @@ -2953,7 +2953,7 @@ DrmAllocation *DrmMemoryManager::createUSMHostAllocationFromSharedHandle(osHandl CREATE_DEBUG_STRING(str, "ioctl(PRIME_FD_TO_HANDLE) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); drm.getRootDeviceEnvironment().executionEnvironment.setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, str.get()); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, str.get()); DEBUG_BREAK_IF(true); return nullptr; @@ -3023,7 +3023,7 @@ DrmAllocation *DrmMemoryManager::createUSMHostAllocationFromSharedHandle(osHandl } if (cpuPointer == MAP_FAILED) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "mmap return of MAP_FAILED\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "mmap return of MAP_FAILED\n"); delete bo; return nullptr; } @@ -3045,12 +3045,12 @@ DrmAllocation *DrmMemoryManager::createUSMHostAllocationFromSharedHandle(osHandl bo->setUnmapSize(size); - printDebugString(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, - "Created BO-%d range: %llx - %llx, size: %lld from PRIME_FD_TO_HANDLE\n", - bo->peekHandle(), - bo->peekAddress(), - ptrOffset(bo->peekAddress(), bo->peekSize()), - bo->peekSize()); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, + "Created BO-%d range: %llx - %llx, size: %lld from PRIME_FD_TO_HANDLE\n", + bo->peekHandle(), + bo->peekAddress(), + ptrOffset(bo->peekAddress(), bo->peekSize()), + bo->peekSize()); pushSharedBufferObject(bo); diff --git a/shared/source/os_interface/linux/drm_neo.cpp b/shared/source/os_interface/linux/drm_neo.cpp index a848c14460..0930c64ae5 100644 --- a/shared/source/os_interface/linux/drm_neo.cpp +++ b/shared/source/os_interface/linux/drm_neo.cpp @@ -101,7 +101,7 @@ int Drm::ioctl(DrmIoctl request, void *arg) { auto printIoctl = debugManager.flags.PrintIoctlEntries.get(); if (printIoctl) { - PRINT_DEBUG_STRING(true, stdout, "IOCTL %s called\n", ioctlHelper->getIoctlString(request).c_str()); + PRINT_STRING(true, stdout, "IOCTL %s called\n", ioctlHelper->getIoctlString(request).c_str()); } if (measureTime) { @@ -136,11 +136,11 @@ int Drm::ioctl(DrmIoctl request, void *arg) { if (printIoctl) { if (ret == 0) { - PRINT_DEBUG_STRING(true, stdout, "IOCTL %s returns %d\n", - ioctlHelper->getIoctlString(request).c_str(), ret); + PRINT_STRING(true, stdout, "IOCTL %s returns %d\n", + ioctlHelper->getIoctlString(request).c_str(), ret); } else { - PRINT_DEBUG_STRING(true, stdout, "IOCTL %s returns %d, errno %d(%s)\n", - ioctlHelper->getIoctlString(request).c_str(), ret, returnedErrno, strerror(returnedErrno)); + PRINT_STRING(true, stdout, "IOCTL %s returns %d, errno %d(%s)\n", + ioctlHelper->getIoctlString(request).c_str(), ret, returnedErrno, strerror(returnedErrno)); } } @@ -155,12 +155,11 @@ int Drm::getParamIoctl(DrmParam param, int *dstValue) { getParam.value = dstValue; int retVal = ioctlHelper->ioctl(DrmIoctl::getparam, &getParam); - if (debugManager.flags.PrintIoctlEntries.get()) { - printf("DRM_IOCTL_I915_GETPARAM: param: %s, output value: %d, retCode:% d\n", - ioctlHelper->getDrmParamString(param).c_str(), - *getParam.value, - retVal); - } + PRINT_STRING(debugManager.flags.PrintIoctlEntries.get(), stdout, + "DRM_IOCTL_I915_GETPARAM: param: %s, output value: %d, retCode:% d\n", + ioctlHelper->getDrmParamString(param).c_str(), + *getParam.value, + retVal); return retVal; } @@ -288,7 +287,7 @@ bool Drm::checkResetStatus(OsContext &osContext) { UNRECOVERABLE_IF(true); } if (resetStats.batchActive > 0 || resetStats.batchPending > 0) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "ERROR: GPU HANG detected!\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "ERROR: GPU HANG detected!\n"); osContextLinux->setHangDetected(); return true; } @@ -412,7 +411,7 @@ int Drm::createDrmContext(uint32_t drmVmId, bool isDirectSubmissionRequested, bo auto ioctlResult = ioctlHelper->ioctl(DrmIoctl::gemContextCreateExt, &gcc); if (ioctlResult < 0) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: GemContextCreateExt ioctl failed. Not exposing this root device\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: GemContextCreateExt ioctl failed. Not exposing this root device\n"); return ioctlResult; } @@ -484,7 +483,7 @@ int Drm::setupHardwareInfo(const DeviceDescriptor *device, bool setupFeatureTabl rootDeviceEnvironment.initWaitUtils(); auto result = rootDeviceEnvironment.initAilConfiguration(); if (false == result) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: AIL creation failed!\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: AIL creation failed!\n"); return -1; } @@ -525,7 +524,7 @@ int Drm::setupHardwareInfo(const DeviceDescriptor *device, bool setupFeatureTabl if (!queryMemoryInfo()) { setPerContextVMRequired(true); - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Failed to query memory info\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Failed to query memory info\n"); } else if (getMemoryInfo()->isSmallBarDetected()) { IoFunctions::fprintf(stderr, "WARNING: Small BAR detected for device %s\n", getPciPath().c_str()); if (!ioctlHelper->isSmallBarConfigAllowed()) { @@ -535,7 +534,7 @@ int Drm::setupHardwareInfo(const DeviceDescriptor *device, bool setupFeatureTabl if (!queryEngineInfo()) { setPerContextVMRequired(true); - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Failed to query engine info\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Failed to query engine info\n"); } if (!hwInfo->gtSystemInfo.L3BankCount) { @@ -546,17 +545,17 @@ int Drm::setupHardwareInfo(const DeviceDescriptor *device, bool setupFeatureTabl if (!queryTopology(*hwInfo, topologyData)) { topologyData.sliceCount = hwInfo->gtSystemInfo.SliceCount; - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Topology query failed!\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Topology query failed!\n"); auto ret = getEuTotal(topologyData.euCount); if (ret != 0) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Cannot query EU total parameter!\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Cannot query EU total parameter!\n"); return ret; } ret = getSubsliceTotal(topologyData.subSliceCount); if (ret != 0) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Cannot query subslice total parameter!\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Cannot query subslice total parameter!\n"); return ret; } } @@ -579,7 +578,7 @@ int Drm::setupHardwareInfo(const DeviceDescriptor *device, bool setupFeatureTabl hwInfo->gtSystemInfo.SliceInfo[slice].Enabled = totalSliceMask.test(slice); } if (totalSliceMask.none()) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Incorrect slice mask from topology map!\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Incorrect slice mask from topology map!\n"); return -1; } if (totalSliceMask.count() == 1u) { @@ -831,18 +830,18 @@ void Drm::printIoctlStatistics() { return; } - printf("\n--- Ioctls statistics ---\n"); - printf("%41s %15s %10s %20s %20s %20s", "Request", "Total time(ns)", "Count", "Avg time per ioctl", "Min", "Max\n"); + PRINT_STRING(true, stdout, "\n--- Ioctls statistics ---\n"); + PRINT_STRING(true, stdout, "%41s %15s %10s %20s %20s %20s", "Request", "Total time(ns)", "Count", "Avg time per ioctl", "Min", "Max\n"); for (const auto &ioctlData : this->ioctlStatistics) { - printf("%41s %15llu %10lu %20f %20lld %20lld\n", - ioctlHelper->getIoctlString(ioctlData.first).c_str(), - ioctlData.second.totalTime, - static_cast(ioctlData.second.count), - ioctlData.second.totalTime / static_cast(ioctlData.second.count), - ioctlData.second.minTime, - ioctlData.second.maxTime); + PRINT_STRING(true, stdout, "%41s %15llu %10lu %20f %20lld %20lld\n", + ioctlHelper->getIoctlString(ioctlData.first).c_str(), + ioctlData.second.totalTime, + static_cast(ioctlData.second.count), + ioctlData.second.totalTime / static_cast(ioctlData.second.count), + ioctlData.second.minTime, + ioctlData.second.maxTime); } - printf("\n"); + PRINT_STRING(true, stdout, "\n"); } bool Drm::createVirtualMemoryAddressSpace(uint32_t vmCount) { @@ -956,7 +955,7 @@ int Drm::waitHandle(uint32_t waitHandle, int64_t timeout) { int ret = ioctlHelper->ioctl(DrmIoctl::gemWait, &wait); if (ret != 0) { int err = errno; - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(I915_GEM_WAIT) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(I915_GEM_WAIT) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); } return ret; @@ -1162,7 +1161,7 @@ bool Drm::querySystemInfo() { auto request = ioctlHelper->getDrmParamValue(DrmParam::queryHwconfigTable); auto deviceBlobQuery = this->query(request, 0); if (deviceBlobQuery.empty()) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stdout, "%s", "INFO: System Info query failed!\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stdout, "%s", "INFO: System Info query failed!\n"); return false; } this->systemInfo.reset(new SystemInfo(deviceBlobQuery)); @@ -1184,7 +1183,7 @@ bool Drm::queryMemoryInfo() { bool Drm::queryEngineInfo(bool isSysmanEnabled) { this->engineInfo = ioctlHelper->createEngineInfo(isSysmanEnabled); if (this->engineInfo && (this->engineInfo->hasEngines() == false)) { - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Engine info size is equal to 0.\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Engine info size is equal to 0.\n"); } return this->engineInfo != nullptr; @@ -1449,12 +1448,12 @@ bool Drm::isChunkingAvailable() { minimalChunkingSize = debugManager.flags.MinimalAllocationSizeForChunking.get(); } - printDebugString(debugManager.flags.PrintBOChunkingLogs.get(), stdout, - "Chunking available: %d; enabled for: shared allocations %d, device allocations %d; minimalChunkingSize: %zd\n", - chunkingAvailable, - (chunkingMode & chunkingModeShared), - (chunkingMode & chunkingModeDevice), - minimalChunkingSize); + PRINT_STRING(debugManager.flags.PrintBOChunkingLogs.get(), stdout, + "Chunking available: %d; enabled for: shared allocations %d, device allocations %d; minimalChunkingSize: %zd\n", + chunkingAvailable, + (chunkingMode & chunkingModeShared), + (chunkingMode & chunkingModeDevice), + minimalChunkingSize); }); } return chunkingAvailable; @@ -1739,8 +1738,8 @@ int Drm::createDrmVirtualMemory(uint32_t &drmVmId) { if (ioctlHelper->vmBind(vmBind)) { setSharedSystemAllocEnable(false); - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, - "INFO: Shared System USM capability not detected\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, + "INFO: Shared System USM capability not detected\n"); } } if (ctl.vmId == 0) { @@ -1748,9 +1747,9 @@ int Drm::createDrmVirtualMemory(uint32_t &drmVmId) { return -1; } } else { - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, - "INFO: Cannot create Virtual Memory at memory bank 0x%x info present %d return code %d\n", - memoryBank, memoryInfo != nullptr, ret); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, + "INFO: Cannot create Virtual Memory at memory bank 0x%x info present %d return code %d\n", + memoryBank, memoryInfo != nullptr, ret); } return ret; } @@ -1932,7 +1931,7 @@ void Drm::adjustSharedSystemMemCapabilities() { } if (gpuAddressLength < cpuAddressLength) { requestSharedSystemUsm = false; - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "Shared System USM NOT allowed: CPU address range > GPU address range\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "Shared System USM NOT allowed: CPU address range > GPU address range\n"); } else { this->setSharedSystemAllocAddressRange(cpuAddressLength); this->setPageFaultSupported(true); diff --git a/shared/source/os_interface/linux/ioctl_helper.cpp b/shared/source/os_interface/linux/ioctl_helper.cpp index f8e567cf30..890e43ba7b 100644 --- a/shared/source/os_interface/linux/ioctl_helper.cpp +++ b/shared/source/os_interface/linux/ioctl_helper.cpp @@ -70,8 +70,8 @@ void IoctlHelper::writeCcsMode(const std::string >File, uint32_t ccsMode, uint32_t ccsValue = 0; ssize_t ret = SysCalls::read(fd, &ccsValue, sizeof(uint32_t)); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get() && (ret < 0), stderr, "read() on %s failed errno = %d | ret = %d \n", - ccsFile.c_str(), errno, ret); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get() && (ret < 0), stderr, "read() on %s failed errno = %d | ret = %d \n", + ccsFile.c_str(), errno, ret); if ((ret < 0) || (ccsValue == ccsMode)) { return; diff --git a/shared/source/os_interface/linux/ioctl_helper_i915.cpp b/shared/source/os_interface/linux/ioctl_helper_i915.cpp index 9ef7ae17ac..9000076961 100644 --- a/shared/source/os_interface/linux/ioctl_helper_i915.cpp +++ b/shared/source/os_interface/linux/ioctl_helper_i915.cpp @@ -697,11 +697,11 @@ bool IoctlHelperI915::isPreemptionSupported() { getParam.value = &schedulerCap; int retVal = ioctl(DrmIoctl::getparam, &getParam); - if (debugManager.flags.PrintIoctlEntries.get()) { - printf("DRM_IOCTL_I915_GETPARAM: param: I915_PARAM_HAS_SCHEDULER, output value: %d, retCode:% d\n", - *getParam.value, - retVal); - } + PRINT_STRING(debugManager.flags.PrintIoctlEntries.get(), stdout, + "DRM_IOCTL_I915_GETPARAM: param: I915_PARAM_HAS_SCHEDULER, output value: %d, retCode:% d\n", + *getParam.value, + retVal); + return retVal == 0 && (schedulerCap & I915_SCHEDULER_CAP_PREEMPTION); } @@ -712,11 +712,11 @@ bool IoctlHelperI915::hasContextFreqHint() { getParam.value = ¶m; int retVal = ioctl(DrmIoctl::getparam, &getParam); - if (debugManager.flags.PrintIoctlEntries.get()) { - printf("DRM_IOCTL_I915_GETPARAM: param: I915_PARAM_HAS_CONTEXT_FREQ_HINT, output value: %d, retCode:% d\n", - *getParam.value, - retVal); - } + PRINT_STRING(debugManager.flags.PrintIoctlEntries.get(), stdout, + "DRM_IOCTL_I915_GETPARAM: param: I915_PARAM_HAS_CONTEXT_FREQ_HINT, output value: %d, retCode:% d\n", + *getParam.value, + retVal); + return retVal == 0 && (param == 1); } @@ -761,7 +761,7 @@ bool IoctlHelperI915::retrieveMmapOffsetForBufferObject(BufferObject &bo, uint64 CREATE_DEBUG_STRING(str, "ioctl(%s) failed with %d. errno=%d(%s)\n", getIoctlString(DrmIoctl::gemMmapOffset).c_str(), ret, err, strerror(err)); drm.getRootDeviceEnvironment().executionEnvironment.setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, str.get()); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, str.get()); DEBUG_BREAK_IF(true); return false; @@ -790,7 +790,7 @@ bool IoctlHelperI915::queryDeviceIdAndRevision(Drm &drm) { int ret = SysCalls::ioctl(fileDescriptor, DRM_IOCTL_I915_GETPARAM, &getParam); if (ret) { - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Cannot query device ID parameter!\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Cannot query device ID parameter!\n"); return false; } @@ -800,7 +800,7 @@ bool IoctlHelperI915::queryDeviceIdAndRevision(Drm &drm) { ret = SysCalls::ioctl(fileDescriptor, DRM_IOCTL_I915_GETPARAM, &getParam); if (ret != 0) { - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Cannot query device Rev ID parameter!\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Cannot query device Rev ID parameter!\n"); return false; } diff --git a/shared/source/os_interface/linux/ioctl_helper_prelim.cpp b/shared/source/os_interface/linux/ioctl_helper_prelim.cpp index 8740866aba..b72fa64572 100644 --- a/shared/source/os_interface/linux/ioctl_helper_prelim.cpp +++ b/shared/source/os_interface/linux/ioctl_helper_prelim.cpp @@ -229,36 +229,36 @@ int IoctlHelperPrelim20::createGemExt(const MemRegionsVec &memClassInstances, si createExt.extensions = reinterpret_cast(&setparamRegion); - printDebugString(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "Performing GEM_CREATE_EXT with { size: %lu, param: 0x%llX", - allocSize, regionParam.param); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "Performing GEM_CREATE_EXT with { size: %lu, param: 0x%llX", + allocSize, regionParam.param); if (debugManager.flags.PrintBOCreateDestroyResult.get()) { for (uint32_t i = 0; i < regionsSize; i++) { auto region = regions[i]; - printDebugString(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, ", memory class: %d, memory instance: %d", - region.memory_class, region.memory_instance); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, ", memory class: %d, memory instance: %d", + region.memory_class, region.memory_instance); } if (memPolicyMode != std::nullopt) { - printDebugString(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, - ", memory policy:{ mode: %d, nodemask_max: 0x%d, nodemask_ptr: 0x%llX }", - memPolicy.mode, - memPolicy.nodemask_max, - memPolicy.nodemask_ptr); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, + ", memory policy:{ mode: %d, nodemask_max: 0x%d, nodemask_ptr: 0x%llX }", + memPolicy.mode, + memPolicy.nodemask_max, + memPolicy.nodemask_ptr); } - printDebugString(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "%s", " }\n"); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "%s", " }\n"); } auto ret = ioctl(DrmIoctl::gemCreateExt, &createExt); if (isChunked) { - printDebugString(debugManager.flags.PrintBOChunkingLogs.get(), stdout, - "GEM_CREATE_EXT BO-%d with BOChunkingSize %d, chunkingParamRegion.param.data %d, numOfChunks %d\n", - createExt.handle, - chunkingSize, - chunkingParamRegion.param.data, - numOfChunks); + PRINT_STRING(debugManager.flags.PrintBOChunkingLogs.get(), stdout, + "GEM_CREATE_EXT BO-%d with BOChunkingSize %d, chunkingParamRegion.param.data %d, numOfChunks %d\n", + createExt.handle, + chunkingSize, + chunkingParamRegion.param.data, + numOfChunks); } - printDebugString(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "GEM_CREATE_EXT has returned: %d BO-%u with size: %lu\n", ret, createExt.handle, createExt.size); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "GEM_CREATE_EXT has returned: %d BO-%u with size: %lu\n", ret, createExt.handle, createExt.size); handle = createExt.handle; return ret; } @@ -269,7 +269,7 @@ CacheRegion IoctlHelperPrelim20::closAlloc(CacheLevel cacheLevel) { int ret = IoctlHelper::ioctl(DrmIoctl::gemClosReserve, &clos); if (ret != 0) { int err = errno; - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(I915_GEM_CLOS_RESERVE) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(I915_GEM_CLOS_RESERVE) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); DEBUG_BREAK_IF(true); return CacheRegion::none; } @@ -287,7 +287,7 @@ uint16_t IoctlHelperPrelim20::closAllocWays(CacheRegion closIndex, uint16_t cach int ret = IoctlHelper::ioctl(DrmIoctl::gemCacheReserve, &cache); if (ret != 0) { int err = errno; - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(I915_GEM_CACHE_RESERVE) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(I915_GEM_CACHE_RESERVE) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); return 0; } @@ -302,7 +302,7 @@ CacheRegion IoctlHelperPrelim20::closFree(CacheRegion closIndex) { int ret = IoctlHelper::ioctl(DrmIoctl::gemClosFree, &clos); if (ret != 0) { int err = errno; - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(I915_GEM_CLOS_FREE) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(I915_GEM_CLOS_FREE) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); DEBUG_BREAK_IF(true); return CacheRegion::none; } @@ -413,7 +413,7 @@ bool IoctlHelperPrelim20::setVmBoAdviseForChunking(int32_t handle, uint64_t star CREATE_DEBUG_STRING(str, "ioctl(PRELIM_DRM_I915_GEM_VM_ADVISE) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); drm.getRootDeviceEnvironment().executionEnvironment.setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, str.get()); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, str.get()); DEBUG_BREAK_IF(true); return false; @@ -436,7 +436,7 @@ bool IoctlHelperPrelim20::setVmBoAdvise(int32_t handle, uint32_t attribute, void CREATE_DEBUG_STRING(str, "ioctl(PRELIM_DRM_I915_GEM_VM_ADVISE) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); drm.getRootDeviceEnvironment().executionEnvironment.setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, str.get()); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, str.get()); DEBUG_BREAK_IF(true); return false; @@ -458,7 +458,7 @@ bool IoctlHelperPrelim20::setVmPrefetch(uint64_t start, uint64_t length, uint32_ CREATE_DEBUG_STRING(str, "ioctl(PRELIM_DRM_I915_GEM_VM_PREFETCH) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); drm.getRootDeviceEnvironment().executionEnvironment.setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, str.get()); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, str.get()); DEBUG_BREAK_IF(true); return false; @@ -580,11 +580,11 @@ bool IoctlHelperPrelim20::isPageFaultSupported() { getParam.value = &pagefaultSupport; int retVal = ioctl(DrmIoctl::getparam, &getParam); - if (debugManager.flags.PrintIoctlEntries.get()) { - printf("DRM_IOCTL_I915_GETPARAM: param: PRELIM_I915_PARAM_HAS_PAGE_FAULT, output value: %d, retCode:% d\n", - *getParam.value, - retVal); - } + PRINT_STRING(debugManager.flags.PrintIoctlEntries.get(), stdout, + "DRM_IOCTL_I915_GETPARAM: param: PRELIM_I915_PARAM_HAS_PAGE_FAULT, output value: %d, retCode:% d\n", + *getParam.value, + retVal); + return (retVal == 0) && (pagefaultSupport > 0); }; @@ -637,24 +637,24 @@ bool IoctlHelperPrelim20::perfOpenEuStallStream(uint32_t euStallFdParameter, uin param.properties_ptr = reinterpret_cast(properties.data()); *stream = ioctl(DrmIoctl::perfOpen, ¶m); if (*stream < 0) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (*stream < 0), stderr, - "%s failed errno = %d | ret = %d \n", "DRM_IOCTL_I915_PERF_OPEN", errno, *stream); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (*stream < 0), stderr, + "%s failed errno = %d | ret = %d \n", "DRM_IOCTL_I915_PERF_OPEN", errno, *stream); return false; } auto ret = ioctl(*stream, DrmIoctl::perfEnable, 0); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (ret < 0), stderr, - "%s failed errno = %d | ret = %d \n", "I915_PERF_IOCTL_ENABLE", errno, ret); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (ret < 0), stderr, + "%s failed errno = %d | ret = %d \n", "I915_PERF_IOCTL_ENABLE", errno, ret); return (ret == 0) ? true : false; } bool IoctlHelperPrelim20::perfDisableEuStallStream(int32_t *stream) { int disableStatus = ioctl(*stream, DrmIoctl::perfDisable, 0); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (disableStatus < 0), stderr, - "I915_PERF_IOCTL_DISABLE failed errno = %d | ret = %d \n", errno, disableStatus); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (disableStatus < 0), stderr, + "I915_PERF_IOCTL_DISABLE failed errno = %d | ret = %d \n", errno, disableStatus); int closeStatus = NEO::SysCalls::close(*stream); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (closeStatus < 0), stderr, - "close() failed errno = %d | ret = %d \n", errno, closeStatus); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (closeStatus < 0), stderr, + "close() failed errno = %d | ret = %d \n", errno, closeStatus); *stream = -1; return ((closeStatus == 0) && (disableStatus == 0)) ? true : false; } @@ -1064,8 +1064,8 @@ bool IoctlHelperPrelim20::queryHwIpVersion(EngineClassInstance &engineInfo, Hard } if (queryItem.length != sizeof(prelim_drm_i915_query_hw_ip_version)) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", - "Size got from PRELIM_DRM_I915_QUERY_HW_IP_VERSION query does not match PrelimI915::prelim_drm_i915_query_hw_ip_version size"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", + "Size got from PRELIM_DRM_I915_QUERY_HW_IP_VERSION query does not match PrelimI915::prelim_drm_i915_query_hw_ip_version size"); return false; } @@ -1107,8 +1107,8 @@ void IoctlHelperPrelim20::setupIpVersion() { if (result == false && ret != 0) { int err = drm.getErrno(); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, - "ioctl(PRELIM_DRM_I915_QUERY_HW_IP_VERSION) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, + "ioctl(PRELIM_DRM_I915_QUERY_HW_IP_VERSION) failed with %d. errno=%d(%s)\n", ret, err, strerror(err)); } } diff --git a/shared/source/os_interface/linux/ioctl_helper_upstream.cpp b/shared/source/os_interface/linux/ioctl_helper_upstream.cpp index 15d0954460..33951a2490 100644 --- a/shared/source/os_interface/linux/ioctl_helper_upstream.cpp +++ b/shared/source/os_interface/linux/ioctl_helper_upstream.cpp @@ -62,28 +62,28 @@ int IoctlHelperUpstream::createGemExt(const MemRegionsVec &memClassInstances, si } if (debugManager.flags.PrintBOCreateDestroyResult.get()) { - printDebugString(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "Performing GEM_CREATE_EXT with { size: %lu", - allocSize); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "Performing GEM_CREATE_EXT with { size: %lu", + allocSize); for (uint32_t i = 0; i < regionsSize; i++) { auto region = regions[i]; - printDebugString(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, ", memory class: %d, memory instance: %d", - region.memory_class, region.memory_instance); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, ", memory class: %d, memory instance: %d", + region.memory_class, region.memory_instance); } if (useSetPat) { - printDebugString(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, ", pat index: %lu", patIndex); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, ", pat index: %lu", patIndex); } - printDebugString(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "%s", " }\n"); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "%s", " }\n"); } auto ret = ioctl(DrmIoctl::gemCreateExt, &createExt); handle = createExt.handle; - printDebugString(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "GEM_CREATE_EXT with EXT_MEMORY_REGIONS%s has returned: %d BO-%u with size: %lu\n", - (useSetPat) ? " with EXT_SET_PAT" : "", - ret, createExt.handle, createExt.size); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "GEM_CREATE_EXT with EXT_MEMORY_REGIONS%s has returned: %d BO-%u with size: %lu\n", + (useSetPat) ? " with EXT_SET_PAT" : "", + ret, createExt.handle, createExt.size); return ret; } @@ -111,8 +111,8 @@ void IoctlHelperUpstream::detectExtSetPatSupport() { } } - printDebugString(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "EXT_SET_PAT support is: %s\n", - this->isSetPatSupported ? "enabled" : "disabled"); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "EXT_SET_PAT support is: %s\n", + this->isSetPatSupported ? "enabled" : "disabled"); } CacheRegion IoctlHelperUpstream::closAlloc(CacheLevel cacheLevel) { diff --git a/shared/source/os_interface/linux/local/dg1/ioctl_helper_dg1.cpp b/shared/source/os_interface/linux/local/dg1/ioctl_helper_dg1.cpp index 2f22554bb8..6f5e33bb21 100644 --- a/shared/source/os_interface/linux/local/dg1/ioctl_helper_dg1.cpp +++ b/shared/source/os_interface/linux/local/dg1/ioctl_helper_dg1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2024 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -51,7 +51,7 @@ int IoctlHelperImpl::createGemExt(const MemRegionsVec &memClassInsta ret = IoctlHelper::ioctl(DrmIoctl::dg1GemCreateExt, &createExt); handle = createExt.handle; - printDebugString(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "GEM_CREATE_EXT with EXT_SETPARAM has returned: %d BO-%u with size: %lu\n", ret, createExt.handle, createExt.size); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "GEM_CREATE_EXT with EXT_SETPARAM has returned: %d BO-%u with size: %lu\n", ret, createExt.handle, createExt.size); return ret; } diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp b/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp index dc257234ca..9d1fd9f3ac 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp @@ -151,7 +151,7 @@ bool IoctlHelperXe::queryDeviceIdAndRevision(Drm &drm) { int ret = SysCalls::ioctl(fileDescriptor, DRM_IOCTL_XE_DEVICE_QUERY, &queryConfig); if (ret || queryConfig.size == 0) { - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Cannot query size for device config!\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Cannot query size for device config!\n"); return false; } @@ -162,7 +162,7 @@ bool IoctlHelperXe::queryDeviceIdAndRevision(Drm &drm) { ret = SysCalls::ioctl(fileDescriptor, DRM_IOCTL_XE_DEVICE_QUERY, &queryConfig); if (ret) { - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Cannot query device ID and revision!\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Cannot query device ID and revision!\n"); return false; } @@ -173,7 +173,7 @@ bool IoctlHelperXe::queryDeviceIdAndRevision(Drm &drm) { if ((debugManager.flags.EnableRecoverablePageFaults.get() != 0) && (debugManager.flags.EnableSharedSystemUsmSupport.get() != 0) && (config->info[DRM_XE_QUERY_CONFIG_FLAGS] & DRM_XE_QUERY_CONFIG_FLAG_HAS_CPU_ADDR_MIRROR)) { drm.setSharedSystemAllocEnable(true); } else { - printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "Shared System USM NOT allowed: KMD does not support\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "Shared System USM NOT allowed: KMD does not support\n"); } return true; } @@ -657,13 +657,13 @@ int IoctlHelperXe::createGemExt(const MemRegionsVec &memClassInstances, size_t a create.flags |= DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING; } - printDebugString(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "Performing DRM_IOCTL_XE_GEM_CREATE with {vmid=0x%x size=0x%lx flags=0x%x placement=0x%x caching=%hu }", - create.vm_id, create.size, create.flags, create.placement, create.cpu_caching); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "Performing DRM_IOCTL_XE_GEM_CREATE with {vmid=0x%x size=0x%lx flags=0x%x placement=0x%x caching=%hu }", + create.vm_id, create.size, create.flags, create.placement, create.cpu_caching); auto ret = IoctlHelper::ioctl(DrmIoctl::gemCreate, &create); handle = create.handle; - printDebugString(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "DRM_IOCTL_XE_GEM_CREATE has returned: %d BO-%u with size: %lu\n", ret, handle, create.size); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "DRM_IOCTL_XE_GEM_CREATE has returned: %d BO-%u with size: %lu\n", ret, handle, create.size); XELOG(" -> IoctlHelperXe::%s [%d,%d] vmid=0x%x s=0x%lx f=0x%x p=0x%x h=0x%x c=%hu r=%d\n", __FUNCTION__, mem.memoryClass, mem.memoryInstance, @@ -703,12 +703,12 @@ uint32_t IoctlHelperXe::createGem(uint64_t size, uint32_t memoryBanks, std::opti create.flags |= DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING; } - printDebugString(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "Performing DRM_IOCTL_XE_GEM_CREATE with {vmid=0x%x size=0x%lx flags=0x%x placement=0x%x caching=%hu }", - create.vm_id, create.size, create.flags, create.placement, create.cpu_caching); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "Performing DRM_IOCTL_XE_GEM_CREATE with {vmid=0x%x size=0x%lx flags=0x%x placement=0x%x caching=%hu }", + create.vm_id, create.size, create.flags, create.placement, create.cpu_caching); [[maybe_unused]] auto ret = ioctl(DrmIoctl::gemCreate, &create); - printDebugString(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "DRM_IOCTL_XE_GEM_CREATE has returned: %d BO-%u with size: %lu\n", ret, create.handle, create.size); + PRINT_STRING(debugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "DRM_IOCTL_XE_GEM_CREATE has returned: %d BO-%u with size: %lu\n", ret, create.handle, create.size); XELOG(" -> IoctlHelperXe::%s vmid=0x%x s=0x%lx f=0x%x p=0x%x h=0x%x c=%hu r=%d\n", __FUNCTION__, create.vm_id, create.size, create.flags, create.placement, create.handle, create.cpu_caching, ret); @@ -2108,7 +2108,7 @@ bool IoctlHelperXe::retrieveMmapOffsetForBufferObject(BufferObject &bo, uint64_t CREATE_DEBUG_STRING(str, "ioctl(%s) failed with %d. errno=%d(%s)\n", getIoctlString(DrmIoctl::gemMmapOffset).c_str(), ret, err, strerror(err)); drm.getRootDeviceEnvironment().executionEnvironment.setErrorDescription(std::string(str.get())); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, str.get()); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, str.get()); DEBUG_BREAK_IF(true); return false; diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe.h b/shared/source/os_interface/linux/xe/ioctl_helper_xe.h index 790806ae2e..9a3cdc305a 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe.h +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe.h @@ -237,7 +237,7 @@ class IoctlHelperXe : public IoctlHelper { template void IoctlHelperXe::xeLog(XeLogArgs &&...args) const { - PRINT_DEBUG_STRING(debugManager.flags.PrintXeLogs.get(), stderr, args...); + PRINT_STRING(debugManager.flags.PrintXeLogs.get(), stderr, args...); } #define XELOG(...) \ diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe_perf.cpp b/shared/source/os_interface/linux/xe/ioctl_helper_xe_perf.cpp index d02fa3a5ac..fa3d4fa5e6 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe_perf.cpp +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe_perf.cpp @@ -56,8 +56,8 @@ bool IoctlHelperXe::perfOpenEuStallStream(uint32_t euStallFdParameter, uint32_t int ret = ioctl(DrmIoctl::perfQuery, &euStallDeviceQuery); if (ret != 0 || euStallDeviceQuery.size == 0) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (ret != 0), stderr, - "%s failed errno = %d | ret = %d \n", "DRM_IOCTL_XE_DEVICE_QUERY", errno, ret); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (ret != 0), stderr, + "%s failed errno = %d | ret = %d \n", "DRM_IOCTL_XE_DEVICE_QUERY", errno, ret); return false; } @@ -67,8 +67,8 @@ bool IoctlHelperXe::perfOpenEuStallStream(uint32_t euStallFdParameter, uint32_t euStallDeviceQuery.data = reinterpret_cast(euStallQueryData); ret = ioctl(DrmIoctl::perfQuery, &euStallDeviceQuery); if (ret != 0 || euStallQueryData->num_sampling_rates == 0) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (ret != 0), stderr, - "%s failed errno = %d | ret = %d \n", "DRM_IOCTL_XE_DEVICE_QUERY", errno, ret); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (ret != 0), stderr, + "%s failed errno = %d | ret = %d \n", "DRM_IOCTL_XE_DEVICE_QUERY", errno, ret); return false; } @@ -113,36 +113,36 @@ bool IoctlHelperXe::perfOpenEuStallStream(uint32_t euStallFdParameter, uint32_t *stream = ioctl(DrmIoctl::perfOpen, &observationParam); if (*stream < 0) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (*stream < 0), stderr, - "%s failed errno = %d | ret = %d \n", "DRM_IOCTL_XE_OBSERVATION", errno, *stream); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (*stream < 0), stderr, + "%s failed errno = %d | ret = %d \n", "DRM_IOCTL_XE_OBSERVATION", errno, *stream); return false; } auto flags = SysCalls::fcntl(*stream, F_GETFL); if (flags == -1) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "fcntl system call failed with return code %d\n", flags); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "fcntl system call failed with return code %d\n", flags); return false; } auto status = SysCalls::fcntl(*stream, F_SETFL, flags | O_CLOEXEC | O_NONBLOCK); if (status != 0) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "fcntl system call failed with return code %d\n", status); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "fcntl system call failed with return code %d\n", status); return false; } ret = ioctl(*stream, DrmIoctl::perfEnable, 0); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (ret < 0), stderr, - "%s failed errno = %d | ret = %d \n", "DRM_XE_OBSERVATION_IOCTL_ENABLE", errno, ret); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (ret < 0), stderr, + "%s failed errno = %d | ret = %d \n", "DRM_XE_OBSERVATION_IOCTL_ENABLE", errno, ret); return (ret == 0) ? true : false; } bool IoctlHelperXe::perfDisableEuStallStream(int32_t *stream) { int disableStatus = ioctl(*stream, DrmIoctl::perfDisable, 0); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (disableStatus < 0), stderr, - "DRM_XE_OBSERVATION_IOCTL_DISABLE failed errno = %d | ret = %d \n", errno, disableStatus); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (disableStatus < 0), stderr, + "DRM_XE_OBSERVATION_IOCTL_DISABLE failed errno = %d | ret = %d \n", errno, disableStatus); int closeStatus = NEO::SysCalls::close(*stream); - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (closeStatus < 0), stderr, - "close() failed errno = %d | ret = %d \n", errno, closeStatus); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (closeStatus < 0), stderr, + "close() failed errno = %d | ret = %d \n", errno, closeStatus); *stream = -1; return ((closeStatus == 0) && (disableStatus == 0)) ? true : false; diff --git a/shared/source/os_interface/os_context.cpp b/shared/source/os_interface/os_context.cpp index 6547022097..cf1706c47c 100644 --- a/shared/source/os_interface/os_context.cpp +++ b/shared/source/os_interface/os_context.cpp @@ -51,13 +51,12 @@ bool OsContext::isImmediateContextInitializationEnabled(bool isDefaultEngine) co bool OsContext::ensureContextInitialized(bool allocateInterrupt) { std::call_once(contextInitializedFlag, [this, allocateInterrupt] { - if (debugManager.flags.PrintOsContextInitializations.get()) { - printf("OsContext initialization: contextId=%d usage=%s type=%s isRootDevice=%d\n", - contextId, - EngineHelpers::engineUsageToString(engineUsage).c_str(), - EngineHelpers::engineTypeToString(engineType).c_str(), - static_cast(rootDevice)); - } + PRINT_STRING(debugManager.flags.PrintOsContextInitializations.get(), stdout, + "OsContext initialization: contextId=%d usage=%s type=%s isRootDevice=%d\n", + contextId, + EngineHelpers::engineUsageToString(engineUsage).c_str(), + EngineHelpers::engineTypeToString(engineType).c_str(), + static_cast(rootDevice)); if (!initializeContext(allocateInterrupt)) { contextInitialized = false; diff --git a/shared/source/os_interface/windows/wddm/wddm.cpp b/shared/source/os_interface/windows/wddm/wddm.cpp index 69bbd78def..170b9eeceb 100644 --- a/shared/source/os_interface/windows/wddm/wddm.cpp +++ b/shared/source/os_interface/windows/wddm/wddm.cpp @@ -417,7 +417,7 @@ std::unique_ptr createHwDeviceIdFromAdapterLuid(OsEnvironmentWin std::unique_ptr umKmDataTranslator = createUmKmDataTranslator(*osEnvironment.gdi, openAdapterData.hAdapter); if (false == umKmDataTranslator->enabled() && !debugManager.flags.DoNotValidateDriverPath.get()) { if (false == validDriverStorePath(osEnvironment, openAdapterData.hAdapter)) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "Driver path is not a valid DriverStore path. Try running with debug key: DoNotValidateDriverPath=1.\n"); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "Driver path is not a valid DriverStore path. Try running with debug key: DoNotValidateDriverPath=1.\n"); return nullptr; } } @@ -803,7 +803,7 @@ NTSTATUS Wddm::createAllocationsAndMapGpuVa(OsHandleStorage &osHandles) { } if (status != STATUS_SUCCESS) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s status: %d", __FUNCTION__, status); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s status: %d", __FUNCTION__, status); DEBUG_BREAK_IF(status != STATUS_GRAPHICS_NO_VIDEO_MEMORY); break; } @@ -817,7 +817,7 @@ NTSTATUS Wddm::createAllocationsAndMapGpuVa(OsHandleStorage &osHandles) { if (!success) { osHandles.fragmentStorageData[allocationIndex].freeTheFragment = true; - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s mapGpuVirtualAddress: %d", __FUNCTION__, success); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s mapGpuVirtualAddress: %d", __FUNCTION__, success); DEBUG_BREAK_IF(true); return STATUS_GRAPHICS_NO_VIDEO_MEMORY; } @@ -1007,9 +1007,9 @@ bool Wddm::setLowPriorityContextParam(D3DKMT_HANDLE contextHandle) { auto status = getGdi()->setSchedulingPriority(&contextPriority); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stdout, - "\nSet scheduling priority for Wddm context. Status: :%lu, context handle: %u, priority: %d \n", - status, contextHandle, contextPriority.Priority); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stdout, + "\nSet scheduling priority for Wddm context. Status: :%lu, context handle: %u, priority: %d \n", + status, contextHandle, contextPriority.Priority); return (status == STATUS_SUCCESS); } @@ -1061,9 +1061,9 @@ bool Wddm::createContext(OsContextWin &osContext) { status = getGdi()->createContext(&createContext); osContext.setWddmContextHandle(createContext.hContext); - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stdout, - "\nCreated Wddm context. Status: :%lu, engine: %u, contextId: %u, deviceBitfield: %lu \n", - status, osContext.getEngineType(), osContext.getContextId(), osContext.getDeviceBitfield().to_ulong()); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stdout, + "\nCreated Wddm context. Status: :%lu, engine: %u, contextId: %u, deviceBitfield: %lu \n", + status, osContext.getEngineType(), osContext.getContextId(), osContext.getDeviceBitfield().to_ulong()); if (status != STATUS_SUCCESS) { return false; @@ -1093,9 +1093,8 @@ bool Wddm::submit(uint64_t commandBuffer, size_t size, void *commandHeader, Wddm } DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "currentFenceValue =", submitArguments.monitorFence->currentFenceValue); - if (debugManager.flags.PrintDeviceAndEngineIdOnSubmission.get()) { - printf("%u: Wddm Submission with context handle %u and HwQueue handle %u\n", SysCalls::getProcessId(), submitArguments.contextHandle, submitArguments.hwQueueHandle); - } + PRINT_STRING(debugManager.flags.PrintDeviceAndEngineIdOnSubmission.get(), stdout, + "%u: Wddm Submission with context handle %u and HwQueue handle %u\n", SysCalls::getProcessId(), submitArguments.contextHandle, submitArguments.hwQueueHandle); status = getDeviceState(); if (!status) { @@ -1146,21 +1145,21 @@ bool Wddm::getDeviceState() { auto status = getDeviceExecutionState(D3DKMT_DEVICESTATE_EXECUTION, &executionState); if (status) { if (executionState == D3DKMT_DEVICEEXECUTION_ERROR_OUTOFMEMORY) { - PRINT_DEBUG_STRING(true, stderr, "Device execution error, out of memory %d\n", executionState); + PRINT_STRING(true, stderr, "Device execution error, out of memory %d\n", executionState); } else if (executionState == D3DKMT_DEVICEEXECUTION_ERROR_DMAPAGEFAULT) { - PRINT_DEBUG_STRING(true, stderr, "Device execution error, page fault\n", executionState); + PRINT_STRING(true, stderr, "Device execution error, page fault\n", executionState); D3DKMT_DEVICEPAGEFAULT_STATE pageFaultState = {}; status = getDeviceExecutionState(D3DKMT_DEVICESTATE_PAGE_FAULT, &pageFaultState); if (status) { - PRINT_DEBUG_STRING(true, stderr, "faulted gpuva 0x%" PRIx64 ", ", pageFaultState.FaultedVirtualAddress); - PRINT_DEBUG_STRING(true, stderr, "pipeline stage %d, bind table entry %u, flags 0x%x, error code(is device) %u, error code %u\n", - pageFaultState.FaultedPipelineStage, pageFaultState.FaultedBindTableEntry, pageFaultState.PageFaultFlags, - pageFaultState.FaultErrorCode.IsDeviceSpecificCode, pageFaultState.FaultErrorCode.IsDeviceSpecificCode ? pageFaultState.FaultErrorCode.DeviceSpecificCode : static_cast(pageFaultState.FaultErrorCode.GeneralErrorCode)); + PRINT_STRING(true, stderr, "faulted gpuva 0x%" PRIx64 ", ", pageFaultState.FaultedVirtualAddress); + PRINT_STRING(true, stderr, "pipeline stage %d, bind table entry %u, flags 0x%x, error code(is device) %u, error code %u\n", + pageFaultState.FaultedPipelineStage, pageFaultState.FaultedBindTableEntry, pageFaultState.PageFaultFlags, + pageFaultState.FaultErrorCode.IsDeviceSpecificCode, pageFaultState.FaultErrorCode.IsDeviceSpecificCode ? pageFaultState.FaultErrorCode.DeviceSpecificCode : static_cast(pageFaultState.FaultErrorCode.GeneralErrorCode)); DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "Page fault detected at address = ", std::hex, pageFaultState.FaultedVirtualAddress); } } else if (executionState != D3DKMT_DEVICEEXECUTION_ACTIVE) { - PRINT_DEBUG_STRING(true, stderr, "Device execution error %d\n", executionState); + PRINT_STRING(true, stderr, "Device execution error %d\n", executionState); } DEBUG_BREAK_IF(executionState != D3DKMT_DEVICEEXECUTION_ACTIVE); return executionState == D3DKMT_DEVICEEXECUTION_ACTIVE; @@ -1242,7 +1241,7 @@ bool Wddm::isGpuHangDetected(OsContext &osContext) { const auto &monitoredFence = osContextWin->getMonitoredFence(); bool hangDetected = monitoredFence.cpuAddress && *monitoredFence.cpuAddress == gpuHangIndication; - PRINT_DEBUG_STRING(hangDetected && debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "ERROR: GPU HANG detected!\n"); + PRINT_STRING(hangDetected && debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "ERROR: GPU HANG detected!\n"); return hangDetected; } diff --git a/shared/source/page_fault_manager/cpu_page_fault_manager.cpp b/shared/source/page_fault_manager/cpu_page_fault_manager.cpp index 3eccdc87d3..e283e9006b 100644 --- a/shared/source/page_fault_manager/cpu_page_fault_manager.cpp +++ b/shared/source/page_fault_manager/cpu_page_fault_manager.cpp @@ -95,7 +95,7 @@ inline void CpuPageFaultManager::migrateStorageToGpuDomain(void *ptr, PageFaultD end = std::chrono::steady_clock::now(); long long elapsedTime = std::chrono::duration_cast(end - start).count(); - PRINT_DEBUG_STRING(debugManager.flags.PrintUmdSharedMigration.get(), stdout, "UMD transferred shared allocation 0x%llx (%zu B) from CPU to GPU (%f us)\n", reinterpret_cast(ptr), pageFaultData.size, elapsedTime / 1e3); + PRINT_STRING(debugManager.flags.PrintUmdSharedMigration.get(), stdout, "UMD transferred shared allocation 0x%llx (%zu B) from CPU to GPU (%f us)\n", reinterpret_cast(ptr), pageFaultData.size, elapsedTime / 1e3); this->protectCPUMemoryAccess(ptr, pageFaultData.size); } @@ -145,7 +145,7 @@ inline void CpuPageFaultManager::migrateStorageToCpuDomain(void *ptr, PageFaultD end = std::chrono::steady_clock::now(); long long elapsedTime = std::chrono::duration_cast(end - start).count(); - PRINT_DEBUG_STRING(debugManager.flags.PrintUmdSharedMigration.get(), stdout, "UMD transferred shared allocation 0x%llx (%zu B) from GPU to CPU (%f us)\n", reinterpret_cast(ptr), pageFaultData.size, elapsedTime / 1e3); + PRINT_STRING(debugManager.flags.PrintUmdSharedMigration.get(), stdout, "UMD transferred shared allocation 0x%llx (%zu B) from GPU to CPU (%f us)\n", reinterpret_cast(ptr), pageFaultData.size, elapsedTime / 1e3); pageFaultData.unifiedMemoryManager->nonGpuDomainAllocs.push_back(ptr); } pageFaultData.domain = AllocationDomain::cpu; diff --git a/shared/source/pin/pin.cpp b/shared/source/pin/pin.cpp index c65ca70cca..d7d3ae00f3 100644 --- a/shared/source/pin/pin.cpp +++ b/shared/source/pin/pin.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -20,19 +20,19 @@ bool PinContext::init(const std::string >PinOpenFunctionName) { auto hGtPinLibrary = std::unique_ptr(OsLibrary::loadFunc({PinContext::gtPinLibraryFilename})); if (hGtPinLibrary == nullptr) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find gtpin library %s\n", PinContext::gtPinLibraryFilename.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find gtpin library %s\n", PinContext::gtPinLibraryFilename.c_str()); return false; } OpenGTPin_fn openGTPin = reinterpret_cast(hGtPinLibrary->getProcAddress(gtPinOpenFunctionName.c_str())); if (openGTPin == nullptr) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find gtpin library open function symbol %s\n", gtPinOpenFunctionName.c_str()); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find gtpin library open function symbol %s\n", gtPinOpenFunctionName.c_str()); return false; } uint32_t openResult = openGTPin(nullptr); if (openResult != 0) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "gtpin library open %s failed with status %u\n", gtPinOpenFunctionName.c_str(), openResult); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "gtpin library open %s failed with status %u\n", gtPinOpenFunctionName.c_str(), openResult); return false; } return true; diff --git a/shared/source/program/metadata_generation.cpp b/shared/source/program/metadata_generation.cpp index 677e8fd276..959325c211 100644 --- a/shared/source/program/metadata_generation.cpp +++ b/shared/source/program/metadata_generation.cpp @@ -24,7 +24,7 @@ void populateDefaultMetadata(const ArrayRef refBin, size_t kernel auto zeInfo = Zebin::getZeInfoFromZebin(refBin, errors, warnings); auto decodeError = Zebin::ZeInfo::decodeAndPopulateKernelMiscInfo(kernelMiscInfoOffset, kernelInfos, zeInfo, errors, warnings); if (decodeError != DecodeError::success) { - PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "decodeAndPopulateKernelMiscInfo failed with errors %s and warnings %s\n", errors.c_str(), warnings.c_str()); + PRINT_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "decodeAndPopulateKernelMiscInfo failed with errors %s and warnings %s\n", errors.c_str(), warnings.c_str()); } } diff --git a/shared/source/program/work_size_info.cpp b/shared/source/program/work_size_info.cpp index 9bb5c976a8..197bd04a9a 100644 --- a/shared/source/program/work_size_info.cpp +++ b/shared/source/program/work_size_info.cpp @@ -49,7 +49,7 @@ void WorkSizeInfo::setMinWorkGroupSize(const RootDeviceEnvironment &rootDeviceEn } if (slmTotalSize > 0) { if (localMemSize < slmTotalSize) { - PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize); + PRINT_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize); } UNRECOVERABLE_IF(localMemSize < slmTotalSize); minWorkGroupSize = std::max(maxWorkGroupSize / ((localMemSize / slmTotalSize)), minWorkGroupSize); diff --git a/shared/source/utilities/logger_neo_only.h b/shared/source/utilities/logger_neo_only.h index 124aa4485b..154a164f90 100644 --- a/shared/source/utilities/logger_neo_only.h +++ b/shared/source/utilities/logger_neo_only.h @@ -20,7 +20,7 @@ namespace NEO { template void logAllocation(FileLogger &logger, GraphicsAllocation const *graphicsAllocation, MemoryManager const *memoryManager) { if (logger.shouldLogAllocationType()) { - printDebugString(true, stdout, "Created Graphics Allocation of type %s\n", getAllocationTypeString(graphicsAllocation)); + PRINT_STRING(true, stdout, "Created Graphics Allocation of type %s\n", getAllocationTypeString(graphicsAllocation)); } if (!logger.enabled() && !logger.shouldLogAllocationToStdout()) { diff --git a/shared/source/utilities/tag_allocator.inl b/shared/source/utilities/tag_allocator.inl index e23c17c969..a23e9f9ab9 100644 --- a/shared/source/utilities/tag_allocator.inl +++ b/shared/source/utilities/tag_allocator.inl @@ -38,9 +38,8 @@ TagNodeBase *TagAllocator::getTag() { node->initialize(); } - if (debugManager.flags.PrintTimestampPacketUsage.get() == 1) { - printf("\nPID: %u, TSP taken from pool and initialized(%d): 0x%" PRIX64, SysCalls::getProcessId(), initializeTags, node->getGpuAddress()); - } + PRINT_STRING(debugManager.flags.PrintTimestampPacketUsage.get() == 1, stdout, + "\nPID: %u, TSP taken from pool and initialized(%d): 0x%" PRIX64, SysCalls::getProcessId(), initializeTags, node->getGpuAddress()); return node; } @@ -51,9 +50,8 @@ void TagAllocator::returnTagToFreePool(TagNodeBase *node) { [[maybe_unused]] auto usedNode = usedTags.removeOne(*nodeT).release(); DEBUG_BREAK_IF(usedNode == nullptr); - if (debugManager.flags.PrintTimestampPacketUsage.get() == 1) { - printf("\nPID: %u, TSP returned to pool: 0x%" PRIX64, SysCalls::getProcessId(), nodeT->getGpuAddress()); - } + PRINT_STRING(debugManager.flags.PrintTimestampPacketUsage.get() == 1, stdout, + "\nPID: %u, TSP returned to pool: 0x%" PRIX64, SysCalls::getProcessId(), nodeT->getGpuAddress()); freeTags.pushFrontOne(*nodeT); } @@ -75,9 +73,8 @@ void TagAllocator::releaseDeferredTags() { while (currentNode != nullptr) { auto nextNode = currentNode->next; if (currentNode->canBeReleased()) { - if (debugManager.flags.PrintTimestampPacketUsage.get() == 1) { - printf("\nPID: %u, TSP returned to pool: 0x%" PRIX64, SysCalls::getProcessId(), currentNode->getGpuAddress()); - } + PRINT_STRING(debugManager.flags.PrintTimestampPacketUsage.get() == 1, stdout, + "\nPID: %u, TSP returned to pool: 0x%" PRIX64, SysCalls::getProcessId(), currentNode->getGpuAddress()); pendingFreeTags.pushFrontOne(*currentNode); } else { pendingDeferredTags.pushFrontOne(*currentNode); diff --git a/shared/source/utilities/x86_64/cpu_info_x86_64.cpp b/shared/source/utilities/x86_64/cpu_info_x86_64.cpp index 3bfb8f60a1..83cea35e38 100644 --- a/shared/source/utilities/x86_64/cpu_info_x86_64.cpp +++ b/shared/source/utilities/x86_64/cpu_info_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2024 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -52,8 +52,8 @@ void CpuInfo::detect() const { virtualAddressSize = (cpuInfo[eax] >> 8) & 0xFF; } } - if (debugManager.flags.PrintCpuFlags.get()) { - printf("CPUFlags:\nCLFlush: %d Avx2: %d WaitPkg: %d\nVirtual Address Size %u\n", !!(features & featureClflush), !!(features & featureAvX2), !!(features & featureWaitPkg), virtualAddressSize); - } + PRINT_STRING(debugManager.flags.PrintCpuFlags.get(), stdout, + "CPUFlags:\nCLFlush: %d Avx2: %d WaitPkg: %d\nVirtual Address Size %u\n", + !!(features & featureClflush), !!(features & featureAvX2), !!(features & featureWaitPkg), virtualAddressSize); } } // namespace NEO diff --git a/shared/test/unit_test/utilities/debug_settings_reader_tests.cpp b/shared/test/unit_test/utilities/debug_settings_reader_tests.cpp index 3bfd50ed3e..5683b13f6b 100644 --- a/shared/test/unit_test/utilities/debug_settings_reader_tests.cpp +++ b/shared/test/unit_test/utilities/debug_settings_reader_tests.cpp @@ -90,7 +90,7 @@ TEST(SettingsReader, GivenTrueWhenPrintingDebugStringThenPrintsToOutput) { int i = 4; StreamCapture capture; capture.captureStdout(); - PRINT_DEBUG_STRING(true, stdout, "testing error %d", i); + PRINT_STRING(true, stdout, "testing error %d", i); std::string output = capture.getCapturedStdout(); EXPECT_STRNE(output.c_str(), ""); } @@ -99,7 +99,7 @@ TEST(SettingsReader, GivenFalseWhenPrintingDebugStringThenNoOutput) { int i = 4; StreamCapture capture; capture.captureStdout(); - PRINT_DEBUG_STRING(false, stderr, "Error String %d", i); + PRINT_STRING(false, stderr, "Error String %d", i); std::string output = capture.getCapturedStdout(); EXPECT_STREQ(output.c_str(), ""); } @@ -111,7 +111,7 @@ TEST(SettingsReader, GivenDebugMessagesBitmaskWithPidWhenPrintingDebugStringThen int i = 4; StreamCapture capture; capture.captureStdout(); - PRINT_DEBUG_STRING(true, stdout, "debug string %d", i); + PRINT_STRING(true, stdout, "debug string %d", i); std::string output = capture.getCapturedStdout(); EXPECT_TRUE(hasSubstr(output, "[PID: ")); } @@ -123,7 +123,7 @@ TEST(SettingsReader, GivenDebugMessagesBitmaskWithTimestampWhenPrintingDebugStri int i = 4; StreamCapture capture; capture.captureStdout(); - PRINT_DEBUG_STRING(true, stdout, "debug string %d", i); + PRINT_STRING(true, stdout, "debug string %d", i); std::string output = capture.getCapturedStdout(); std::string dateRegex = R"(\[20\d{2}-\d{2}-\d{2})"; EXPECT_TRUE(containsRegex(output, dateRegex));