From 058b2702db53d3a61b5f595c090b54672250f117 Mon Sep 17 00:00:00 2001 From: Saleel Kudchadker Date: Thu, 7 Dec 2023 01:32:20 +0000 Subject: [PATCH] SWDEV-301667 - Logging refactor - Remove newline from logging as log function internally inserts a new line Change-Id: I25eb2242a1f1e87cf811bcc373d1d485b2e027a8 --- hipamd/src/hip_code_object.cpp | 4 ++-- hipamd/src/hip_code_object.hpp | 2 +- hipamd/src/hip_context.cpp | 2 +- hipamd/src/hip_fatbin.cpp | 8 +++---- hipamd/src/hip_gl.cpp | 22 +++++++++--------- hipamd/src/hip_global.cpp | 8 +++---- hipamd/src/hip_graph_internal.cpp | 17 +++++++------- hipamd/src/hip_graph_internal.hpp | 4 ++-- hipamd/src/hip_memory.cpp | 38 +++++++++++++++---------------- hipamd/src/hip_mempool_impl.cpp | 2 +- hipamd/src/hip_module.cpp | 6 ++--- hipamd/src/hip_platform.cpp | 26 ++++++++++----------- hipamd/src/hip_stream.cpp | 2 +- hipamd/src/hip_texture.cpp | 8 +++---- hipamd/src/hip_vm.cpp | 4 ++-- hipamd/src/hiprtc/hiprtc.cpp | 2 +- 16 files changed, 77 insertions(+), 78 deletions(-) diff --git a/hipamd/src/hip_code_object.cpp b/hipamd/src/hip_code_object.cpp index 95f8ab436f..37a0dc02e6 100644 --- a/hipamd/src/hip_code_object.cpp +++ b/hipamd/src/hip_code_object.cpp @@ -672,7 +672,7 @@ hipError_t DynCO::populateDynGlobalVars() { ->getDeviceProgram(*hip::getCurrentDevice()->devices()[0]); if (!dev_program->getGlobalVarFromCodeObj(&var_names)) { - LogPrintfError("Could not get Global vars from Code Obj for Module: 0x%x \n", module()); + LogPrintfError("Could not get Global vars from Code Obj for Module: 0x%x", module()); return hipErrorSharedObjectSymbolNotFound; } @@ -700,7 +700,7 @@ hipError_t DynCO::populateDynGlobalFuncs() { // Get all the global func names from COMGR if (!dev_program->getGlobalFuncFromCodeObj(&func_names)) { - LogPrintfError("Could not get Global Funcs from Code Obj for Module: 0x%x \n", module()); + LogPrintfError("Could not get Global Funcs from Code Obj for Module: 0x%x", module()); return hipErrorSharedObjectSymbolNotFound; } diff --git a/hipamd/src/hip_code_object.hpp b/hipamd/src/hip_code_object.hpp index bd0361f468..d0148cb8a9 100644 --- a/hipamd/src/hip_code_object.hpp +++ b/hipamd/src/hip_code_object.hpp @@ -104,7 +104,7 @@ public: // Device ID Check to check if module is launched in the same device it was loaded. inline void CheckDeviceIdMatch() const { guarantee(device_id_ == ihipGetDevice(), "Device mismatch from where this module is loaded," - "device_id: %d ihipGetDevice:%d \n", device_id_, ihipGetDevice()); + "device_id: %d ihipGetDevice:%d", device_id_, ihipGetDevice()); } private: diff --git a/hipamd/src/hip_context.cpp b/hipamd/src/hip_context.cpp index cab3b4babf..47569f0669 100644 --- a/hipamd/src/hip_context.cpp +++ b/hipamd/src/hip_context.cpp @@ -241,7 +241,7 @@ hipError_t hipCtxPopCurrent(hipCtx_t* ctx) { } tls.ctxt_stack_.pop(); } else { - DevLogError("Context Stack empty \n"); + DevLogError("Context Stack empty"); HIP_RETURN(hipErrorInvalidContext); } diff --git a/hipamd/src/hip_fatbin.cpp b/hipamd/src/hip_fatbin.cpp index fb95993cfd..cede736bdc 100644 --- a/hipamd/src/hip_fatbin.cpp +++ b/hipamd/src/hip_fatbin.cpp @@ -191,7 +191,7 @@ hipError_t FatBinaryInfo::ExtractFatBinaryUsingCOMGR(const std::vector 0, "Cannot have a file size of 0, fdesc: %d fname: %s \n", + guarantee(fsize_ > 0, "Cannot have a file size of 0, fdesc: %d fname: %s", fdesc_, fname_.c_str()); if ((comgr_status = amd_comgr_set_data_from_file_slice(data_object, fdesc_, foffset_, fsize_)) != AMD_COMGR_STATUS_SUCCESS) { @@ -219,7 +219,7 @@ hipError_t FatBinaryInfo::ExtractFatBinaryUsingCOMGR(const std::vectordevices()[0]->isa().isaName(); if (unique_isa_names.cend() == unique_isa_names.find(device_name)) { unique_isa_names.insert({device_name, std::make_pair(0,0)}); - } + } } // Create a query list using COMGR info for unique ISAs. @@ -253,7 +253,7 @@ hipError_t FatBinaryInfo::ExtractFatBinaryUsingCOMGR(const std::vectorsecond.first == 0) { - LogPrintfError("Cannot find CO in the bundle %s for ISA: %s \n", + LogPrintfError("Cannot find CO in the bundle %s for ISA: %s", fname_.c_str(), device_name.c_str()); hip_status = hipErrorNoBinaryForGpu; ListAllDeviceWithNoCOFromBundle(unique_isa_names); @@ -302,7 +302,7 @@ hipError_t FatBinaryInfo::ExtractFatBinaryUsingCOMGR(const std::vectorsetInfo(info); if (CL_SUCCESS != amdContext->create(properties)) { - LogError("Context setup failed \n"); + LogError("Context setup failed"); } } @@ -96,11 +96,11 @@ hipError_t hipGLGetDevices(unsigned int* pHipDeviceCount, int* pHipDevices, static const bool VALIDATE_ONLY = true; if (deviceList == hipGLDeviceListNextFrame) { - LogError(" hipGLDeviceListNextFrame not supported yet.\n"); + LogError(" hipGLDeviceListNextFrame not supported yet"); HIP_RETURN(hipErrorNotSupported); } if (pHipDeviceCount == nullptr || pHipDevices == nullptr || hipDeviceCount == 0) { - LogError(" Invalid Argument \n"); + LogError(" Invalid Argument"); HIP_RETURN(hipErrorInvalidValue); } @@ -108,7 +108,7 @@ hipError_t hipGLGetDevices(unsigned int* pHipDeviceCount, int* pHipDevices, amd::Context::Info info = hip::getCurrentDevice()->asContext()->info(); if (!(info.flags_ & amd::Context::GLDeviceKhr)) { - LogError("Failed : Invalid Shared Group Reference \n"); + LogError("Failed : Invalid Shared Group Reference"); HIP_RETURN(hipErrorInvalidValue); } amd::GLFunctions* glenv = hip::getCurrentDevice()->asContext()->glenv(); @@ -248,7 +248,7 @@ hipError_t hipGraphicsGLRegisterImage(hipGraphicsResource** resource, GLuint ima amd::GLFunctions::SetIntEnv ie(amdContext.glenv()); if (!ie.isValid()) { - LogWarning("\"amdContext\" is not created from GL context or share list \n"); + LogWarning("\"amdContext\" is not created from GL context or share list"); HIP_RETURN(hipErrorUnknown); } @@ -516,7 +516,7 @@ hipError_t hipGraphicsGLRegisterImage(hipGraphicsResource** resource, GLuint ima assert(amdContext.devices().size() == 1); const amd::Device& dev = *(amdContext.devices()[0]); - + device::Memory* mem = pImageGL->getDeviceMemory(dev); if (nullptr == mem) { LogPrintfError("Can't allocate memory size - 0x%08X bytes!", pImageGL->getSize()); @@ -562,7 +562,7 @@ hipError_t hipGraphicsGLRegisterBuffer(hipGraphicsResource** resource, GLuint bu { amd::GLFunctions::SetIntEnv ie(amdContext.glenv()); if (!ie.isValid()) { - LogWarning("\"amdContext\" is not created from GL context or share list \n"); + LogWarning("\"amdContext\" is not created from GL context or share list"); HIP_RETURN(hipErrorUnknown); } @@ -570,7 +570,7 @@ hipError_t hipGraphicsGLRegisterBuffer(hipGraphicsResource** resource, GLuint bu clearGLErrors(amdContext); if ((GL_FALSE == amdContext.glenv()->glIsBuffer_(buffer)) || (GL_NO_ERROR != (glErr = amdContext.glenv()->glGetError_()))) { - LogWarning("\"buffer\" is not a GL buffer object \n"); + LogWarning("\"buffer\" is not a GL buffer object"); HIP_RETURN(hipErrorInvalidResourceHandle); } @@ -579,11 +579,11 @@ hipError_t hipGraphicsGLRegisterBuffer(hipGraphicsResource** resource, GLuint bu clearGLErrors(amdContext); amdContext.glenv()->glGetBufferParameteriv_(glTarget, GL_BUFFER_SIZE, &gliSize); if (GL_NO_ERROR != (glErr = amdContext.glenv()->glGetError_())) { - LogWarning("cannot get the GL buffer size \n"); + LogWarning("cannot get the GL buffer size"); HIP_RETURN(hipErrorInvalidResourceHandle); } if (gliSize == 0) { - LogWarning("the GL buffer's data store is not created \n"); + LogWarning("the GL buffer's data store is not created"); HIP_RETURN(hipErrorInvalidResourceHandle); } diff --git a/hipamd/src/hip_global.cpp b/hipamd/src/hip_global.cpp index 0869998cd3..b12d566ad9 100644 --- a/hipamd/src/hip_global.cpp +++ b/hipamd/src/hip_global.cpp @@ -72,10 +72,10 @@ DeviceVar::DeviceVar(std::string name, device::Program* dev_program = program->getDeviceProgram(*g_devices.at(deviceId)->devices()[0]); - guarantee (dev_program != nullptr, "Cannot get Device Program for module: 0x%x \n", hmod); + guarantee (dev_program != nullptr, "Cannot get Device Program for module: 0x%x", hmod); if(!dev_program->createGlobalVarObj(&amd_mem_obj_, &device_ptr_, &size_, name.c_str())) { - guarantee(false, "Cannot create GlobalVar Obj for symbol: %s \n", name.c_str()); + guarantee(false, "Cannot create GlobalVar Obj for symbol: %s", name.c_str()); } // Handle size 0 symbols @@ -111,10 +111,10 @@ DeviceFunc::DeviceFunc(std::string name, hipModule_t hmod) : dflock_("function l amd::Program* program = as_amd(reinterpret_cast(hmod)); const amd::Symbol *symbol = program->findSymbol(name.c_str()); - guarantee(symbol != nullptr, "Cannot find Symbol with name: %s \n", name.c_str()); + guarantee(symbol != nullptr, "Cannot find Symbol with name: %s", name.c_str()); kernel_ = new amd::Kernel(*program, *symbol, name); - guarantee(kernel_ != nullptr, "Cannot Create kernel with name: %s \n", name.c_str()); + guarantee(kernel_ != nullptr, "Cannot Create kernel with name: %s", name.c_str()); } DeviceFunc::~DeviceFunc() { diff --git a/hipamd/src/hip_graph_internal.cpp b/hipamd/src/hip_graph_internal.cpp index 6886bc03c6..9150b281ad 100644 --- a/hipamd/src/hip_graph_internal.cpp +++ b/hipamd/src/hip_graph_internal.cpp @@ -126,7 +126,7 @@ bool Graph::isGraphValid(Graph* pGraph) { void Graph::AddNode(const Node& node) { vertices_.emplace_back(node); - ClPrint(amd::LOG_INFO, amd::LOG_CODE, "[hipGraph] Add %s(%p)\n", + ClPrint(amd::LOG_INFO, amd::LOG_CODE, "[hipGraph] Add %s(%p)", GetGraphNodeTypeString(node->GetType()), node); node->SetParentGraph(this); } @@ -142,11 +142,10 @@ std::vector Graph::GetRootNodes() const { for (auto entry : vertices_) { if (entry->GetInDegree() == 0) { roots.push_back(entry); - ClPrint(amd::LOG_INFO, amd::LOG_CODE, "[hipGraph] Root node: %s(%p)\n", + ClPrint(amd::LOG_INFO, amd::LOG_CODE, "[hipGraph] Root node: %s(%p)", GetGraphNodeTypeString(entry->GetType()), entry); } } - ClPrint(amd::LOG_INFO, amd::LOG_CODE, "\n"); return roots; } @@ -194,7 +193,7 @@ void Graph::GetRunListUtil(Node v, std::unordered_map& visited, // For the parallel list nodes add parent as the dependency if (singleList.empty()) { ClPrint(amd::LOG_INFO, amd::LOG_CODE, - "[hipGraph] For %s(%p)- add parent as dependency %s(%p)\n", + "[hipGraph] For %s(%p) - add parent as dependency %s(%p)", GetGraphNodeTypeString(adjNode->GetType()), adjNode, GetGraphNodeTypeString(v->GetType()), v); dependencies[adjNode].push_back(v); @@ -213,7 +212,7 @@ void Graph::GetRunListUtil(Node v, std::unordered_map& visited, } // If the list cannot be merged with the existing list add as dependancy if (!singleList.empty()) { - ClPrint(amd::LOG_INFO, amd::LOG_CODE, "[hipGraph] For %s(%p)- add dependency %s(%p)\n", + ClPrint(amd::LOG_INFO, amd::LOG_CODE, "[hipGraph] For %s(%p) - add dependency %s(%p)", GetGraphNodeTypeString(adjNode->GetType()), adjNode, GetGraphNodeTypeString(v->GetType()), v); dependencies[adjNode].push_back(v); @@ -245,7 +244,7 @@ void Graph::GetRunList(std::vector>& parallelLists, } for (size_t i = 0; i < parallelLists.size(); i++) { for (size_t j = 0; j < parallelLists[i].size(); j++) { - ClPrint(amd::LOG_INFO, amd::LOG_CODE, "[hipGraph] List %d - %s(%p)\n", i + 1, + ClPrint(amd::LOG_INFO, amd::LOG_CODE, "[hipGraph] List %d - %s(%p)", i + 1, GetGraphNodeTypeString(parallelLists[i][j]->GetType()), parallelLists[i][j]); } } @@ -328,7 +327,7 @@ hipError_t GraphExec::CreateStreams(uint32_t num_streams) { if (stream != nullptr) { hip::Stream::Destroy(stream); } - ClPrint(amd::LOG_ERROR, amd::LOG_CODE, "[hipGraph] Failed to create parallel stream!\n"); + ClPrint(amd::LOG_ERROR, amd::LOG_CODE, "[hipGraph] Failed to create parallel stream!"); return hipErrorOutOfMemory; } parallel_streams_.push_back(stream); @@ -447,7 +446,7 @@ hipError_t FillCommands(std::vector>& parallelLists, std::vector rootNodes = clonedGraph->GetRootNodes(); ClPrint(amd::LOG_INFO, amd::LOG_CODE, - "[hipGraph] RootCommand get launched on stream (stream:%p)\n", stream); + "[hipGraph] RootCommand get launched on stream %p", stream); for (auto& root : rootNodes) { //If rootnode is launched on to the same stream dont add dependency @@ -485,7 +484,7 @@ hipError_t FillCommands(std::vector>& parallelLists, if (!graphLastCmdWaitList.empty()) { graphEnd = new amd::Marker(*stream, false, graphLastCmdWaitList); ClPrint(amd::LOG_INFO, amd::LOG_CODE, - "[hipGraph] EndCommand will get launched on stream (stream:%p)\n", stream); + "[hipGraph] EndCommand will get launched on stream %p", stream); if (graphEnd == nullptr) { graphStart->release(); return hipErrorOutOfMemory; diff --git a/hipamd/src/hip_graph_internal.hpp b/hipamd/src/hip_graph_internal.hpp index 61bab5bb49..ab598c2179 100644 --- a/hipamd/src/hip_graph_internal.hpp +++ b/hipamd/src/hip_graph_internal.hpp @@ -1851,7 +1851,7 @@ class GraphEventRecordNode : public GraphNode { hipError_t status = e->enqueueRecordCommand(stream, commands_[0], true); if (status != hipSuccess) { ClPrint(amd::LOG_ERROR, amd::LOG_CODE, - "[hipGraph] Enqueue event record command failed for node %p - status %d\n", this, + "[hipGraph] Enqueue event record command failed for node %p - status %d", this, status); } } @@ -1903,7 +1903,7 @@ class GraphEventWaitNode : public GraphNode { hipError_t status = e->enqueueStreamWaitCommand(stream, commands_[0]); if (status != hipSuccess) { ClPrint(amd::LOG_ERROR, amd::LOG_CODE, - "[hipGraph] Enqueue stream wait command failed for node %p - status %d\n", this, + "[hipGraph] Enqueue stream wait command failed for node %p - status %d", this, status); } commands_[0]->release(); diff --git a/hipamd/src/hip_memory.cpp b/hipamd/src/hip_memory.cpp index 7b286963a3..eb1931e8c3 100644 --- a/hipamd/src/hip_memory.cpp +++ b/hipamd/src/hip_memory.cpp @@ -325,10 +325,10 @@ hipError_t ihipMalloc(void** ptr, size_t sizeBytes, unsigned int flags) size_t free = 0, total =0; hipError_t err = hipMemGetInfo(&free, &total); if (err == hipSuccess) { - LogPrintfError("Allocation failed : Device memory : required :%zu | free :%zu | total :%zu \n", sizeBytes, free, total); + LogPrintfError("Allocation failed : Device memory : required :%zu | free :%zu | total :%zu", sizeBytes, free, total); } } else { - LogPrintfError("Allocation failed : Pinned Memory, size :%zu \n", sizeBytes); + LogPrintfError("Allocation failed : Pinned Memory, size :%zu", sizeBytes); } return hipErrorOutOfMemory; } @@ -614,7 +614,7 @@ hipError_t hipHostMalloc(void** ptr, size_t sizeBytes, unsigned int flags) { if ((flags & coherentFlags) == coherentFlags) { LogPrintfError( "Cannot have both coherent and non-coherent flags " - "at the same time, flags: %u coherent flags: %u \n", + "at the same time, flags: %u coherent flags: %u", flags, coherentFlags); HIP_RETURN(hipErrorInvalidValue); } @@ -814,7 +814,7 @@ hipError_t ihipMallocPitch(void** ptr, size_t* pitch, size_t width, size_t heigh } if (device && !device->info().imageSupport_) { - LogPrintfError("Image is not supported on device %p \n", device); + LogPrintfError("Image is not supported on device %p", device); return hipErrorInvalidValue; } @@ -893,7 +893,7 @@ amd::Image* ihipImageCreate(const cl_channel_order channelOrder, status = hipSuccess; const amd::Image::Format imageFormat({channelOrder, channelType}); if (!imageFormat.isValid()) { - LogPrintfError("Invalid Image format for channel Order:%u Type:%u \n", channelOrder, + LogPrintfError("Invalid Image format for channel Order:%u Type:%u", channelOrder, channelType); status = hipErrorInvalidValue; return nullptr; @@ -901,14 +901,14 @@ amd::Image* ihipImageCreate(const cl_channel_order channelOrder, amd::Context& context = *hip::getCurrentDevice()->asContext(); if (!imageFormat.isSupported(context, imageType)) { - LogPrintfError("Image type: %u not supported \n", imageType); + LogPrintfError("Image type: %u not supported", imageType); status = hipErrorInvalidValue; return nullptr; } const std::vector& devices = context.devices(); if (!devices[0]->info().imageSupport_) { - LogPrintfError("Device: 0x%x does not support image \n", devices[0]); + LogPrintfError("Device: 0x%x does not support image", devices[0]); status = hipErrorInvalidValue; return nullptr; } @@ -919,7 +919,7 @@ amd::Image* ihipImageCreate(const cl_channel_order channelOrder, imageHeight, imageDepth, imageArraySize)) { - DevLogError("Image does not have valid dimensions \n"); + DevLogError("Image does not have valid dimensions"); status = hipErrorInvalidValue; return nullptr; } @@ -963,7 +963,7 @@ amd::Image* ihipImageCreate(const cl_channel_order channelOrder, offset); break; default: - LogPrintfError("Cannot create image of imageType: 0x%x for external buffer\n", imageType); + LogPrintfError("Cannot create image of imageType: 0x%x for external buffer", imageType); } } else if (buffer != nullptr) { switch (imageType) { @@ -982,7 +982,7 @@ amd::Image* ihipImageCreate(const cl_channel_order channelOrder, offset); break; default: - LogPrintfError("Cannot create image of imageType: 0x%x \n", imageType); + LogPrintfError("Cannot create image of imageType: 0x%x", imageType); } } else { switch (imageType) { @@ -1025,7 +1025,7 @@ amd::Image* ihipImageCreate(const cl_channel_order channelOrder, numMipLevels); break; default: - LogPrintfError("Cannot create image of imageType: 0x%x \n", imageType); + LogPrintfError("Cannot create image of imageType: 0x%x", imageType); } } @@ -1035,7 +1035,7 @@ amd::Image* ihipImageCreate(const cl_channel_order channelOrder, } if (!image->create(nullptr)) { - LogPrintfError("Cannot create image: 0x%x \n", image); + LogPrintfError("Cannot create image: 0x%x", image); status = hipErrorOutOfMemory; delete image; return nullptr; @@ -1217,7 +1217,7 @@ hipError_t ihipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags) constexpr bool forceAlloc = true; if (!mem->create(hostPtr, sysMemAlloc, skipAlloc, forceAlloc)) { mem->release(); - LogPrintfError("Cannot create memory for size: %u with flags: %d \n", sizeBytes, flags); + LogPrintfError("Cannot create memory for size: %u with flags: %d", sizeBytes, flags); return hipErrorInvalidValue; } @@ -1272,7 +1272,7 @@ hipError_t ihipHostUnregister(void* hostPtr) { return hipSuccess; } - LogPrintfError("Cannot unregister host_ptr: 0x%x \n", hostPtr); + LogPrintfError("Cannot unregister host_ptr: 0x%x", hostPtr); return hipErrorHostMemoryNotRegistered; } @@ -1297,7 +1297,7 @@ inline hipError_t ihipMemcpySymbol_validate(const void* symbol, size_t sizeBytes /* Size Check to make sure offset is correct */ if ((offset + sizeBytes) > sym_size) { - LogPrintfError("Trying to access out of bounds, offset: %u sizeBytes: %u sym_size: %u \n", + LogPrintfError("Trying to access out of bounds, offset: %u sizeBytes: %u sym_size: %u", offset, sizeBytes, sym_size); HIP_RETURN(hipErrorInvalidValue); } @@ -3568,7 +3568,7 @@ hipError_t hipPointerGetAttributes(hipPointerAttribute_t* attributes, const void } //getDeviceMemory can fail, hence validate the sanity of the mem obtained if (nullptr == devMem) { - DevLogPrintfError("getDeviceMemory for ptr failed : %p \n", ptr); + DevLogPrintfError("getDeviceMemory for ptr failed : %p", ptr); HIP_RETURN(hipErrorMemoryAllocation); } @@ -3589,7 +3589,7 @@ hipError_t hipPointerGetAttributes(hipPointerAttribute_t* attributes, const void attributes->isManaged = false; attributes->allocationFlags = 0; attributes->device = hipInvalidDeviceId; - LogPrintfError("Cannot get amd_mem_obj for ptr: 0x%x \n", ptr); + LogPrintfError("Cannot get amd_mem_obj for ptr: 0x%x", ptr); } HIP_RETURN(hipSuccess); } @@ -3655,7 +3655,7 @@ hipError_t ihipPointerGetAttributes(void* data, hipPointer_attribute attribute, //getDeviceMemory can fail, hence validate the sanity of the mem obtained if (nullptr == devMem) { - DevLogPrintfError("getDeviceMemory for ptr failed : %p \n", ptr); + DevLogPrintfError("getDeviceMemory for ptr failed : %p", ptr); return hipErrorMemoryAllocation; } *reinterpret_cast(data) = @@ -3743,7 +3743,7 @@ hipError_t ihipPointerGetAttributes(void* data, hipPointer_attribute attribute, //getDeviceMemory can fail, hence validate the sanity of the mem obtained if (nullptr == devMem) { - DevLogPrintfError("getDeviceMemory for ptr failed : %p \n", ptr); + DevLogPrintfError("getDeviceMemory for ptr failed : %p", ptr); return hipErrorMemoryAllocation; } *reinterpret_cast(data) = diff --git a/hipamd/src/hip_mempool_impl.cpp b/hipamd/src/hip_mempool_impl.cpp index 097236ae72..de620e1ee6 100644 --- a/hipamd/src/hip_mempool_impl.cpp +++ b/hipamd/src/hip_mempool_impl.cpp @@ -174,7 +174,7 @@ void* MemoryPool::AllocateMemory(size_t size, hip::Stream* stream, void* dptr) { size_t free = 0, total =0; hipError_t err = hipMemGetInfo(&free, &total); if (err == hipSuccess) { - LogPrintfError("Allocation failed : Device memory : required :%zu | free :%zu | total :%zu \n", + LogPrintfError("Allocation failed : Device memory : required :%zu | free :%zu | total :%zu", size, free, total); } return nullptr; diff --git a/hipamd/src/hip_module.cpp b/hipamd/src/hip_module.cpp index 93fa193c23..c783294d6c 100644 --- a/hipamd/src/hip_module.cpp +++ b/hipamd/src/hip_module.cpp @@ -81,7 +81,7 @@ hipError_t hipModuleGetFunction(hipFunction_t* hfunc, hipModule_t hmod, const ch } if (hipSuccess != PlatformState::instance().getDynFunc(hfunc, hmod, name)) { - LogPrintfError("Cannot find the function: %s for module: 0x%x \n", name, hmod); + LogPrintfError("Cannot find the function: %s for module: 0x%x", name, hmod); HIP_RETURN(hipErrorNotFound); } @@ -104,7 +104,7 @@ hipError_t hipModuleGetGlobal(hipDeviceptr_t* dptr, size_t* bytes, hipModule_t h } /* Get address and size for the global symbol */ if (hipSuccess != PlatformState::instance().getDynGlobalVar(name, hmod, dptr, bytes)) { - LogPrintfError("Cannot find global Var: %s for module: 0x%x at device: %d \n", name, hmod, + LogPrintfError("Cannot find global Var: %s for module: 0x%x at device: %d", name, hmod, ihipGetDevice()); HIP_RETURN(hipErrorNotFound); } @@ -825,7 +825,7 @@ hipError_t hipModuleGetTexRef(textureReference** texRef, hipModule_t hmod, const /* Get address and size for the global symbol */ if (hipSuccess != PlatformState::instance().getDynTexRef(name, hmod, texRef)) { - LogPrintfError("Cannot get texRef for name: %s at module:0x%x \n", name, hmod); + LogPrintfError("Cannot get texRef for name: %s at module:0x%x", name, hmod); HIP_RETURN(hipErrorNotFound); } diff --git a/hipamd/src/hip_platform.cpp b/hipamd/src/hip_platform.cpp index 66773ba480..f4a4ab4b74 100644 --- a/hipamd/src/hip_platform.cpp +++ b/hipamd/src/hip_platform.cpp @@ -88,7 +88,7 @@ void __hipRegisterFunction(hip::FatBinaryInfo** modules, const void* hostFunctio hipError_t hip_error = hipSuccess; hip::Function* func = new hip::Function(std::string(deviceName), modules); hip_error = PlatformState::instance().registerStatFunction(hostFunction, func); - guarantee((hip_error == hipSuccess), "Cannot register Static function, error: %d \n", hip_error); + guarantee((hip_error == hipSuccess), "Cannot register Static function, error: %d", hip_error); if (!enable_deferred_loading) { HIP_INIT_VOID(); @@ -96,7 +96,7 @@ void __hipRegisterFunction(hip::FatBinaryInfo** modules, const void* hostFunctio for (size_t dev_idx = 0; dev_idx < g_devices.size(); ++dev_idx) { hip_error = PlatformState::instance().getStatFunc(&hfunc, hostFunction, dev_idx); - guarantee((hip_error == hipSuccess), "Cannot retrieve Static function, error: %d \n", + guarantee((hip_error == hipSuccess), "Cannot retrieve Static function, error: %d", hip_error); } } @@ -120,7 +120,7 @@ void __hipRegisterVar( hip::Var* var_ptr = new hip::Var(std::string(hostVar), hip::Var::DeviceVarKind::DVK_Variable, size, 0, 0, modules); hipError_t err = PlatformState::instance().registerStatGlobalVar(var, var_ptr); - guarantee((err == hipSuccess), "Cannot register Static Global Var, error:%d \n", err); + guarantee((err == hipSuccess), "Cannot register Static Global Var, error:%d", err); } void __hipRegisterSurface( @@ -132,7 +132,7 @@ void __hipRegisterSurface( hip::Var* var_ptr = new hip::Var(std::string(hostVar), hip::Var::DeviceVarKind::DVK_Surface, sizeof(surfaceReference), 0, 0, modules); hipError_t err = PlatformState::instance().registerStatGlobalVar(var, var_ptr); - guarantee((err == hipSuccess), "Cannot register Static Glbal Var, err:%d \n", err); + guarantee((err == hipSuccess), "Cannot register Static Glbal Var, err:%d", err); } void __hipRegisterManagedVar( @@ -148,18 +148,18 @@ void __hipRegisterManagedVar( hip::Stream* stream = hip::getNullStream(); if (stream != nullptr) { status = ihipMemcpy(*pointer, init_value, size, hipMemcpyHostToDevice, *stream); - guarantee((status == hipSuccess), "Error during memcpy to managed memory, error:%d \n!", + guarantee((status == hipSuccess), "Error during memcpy to managed memory, error:%d!", status); } else { ClPrint(amd::LOG_ERROR, amd::LOG_API, "Host Queue is NULL"); } } else { - guarantee(false, "Error during allocation of managed memory!, error: %d \n", status); + guarantee(false, "Error during allocation of managed memory!, error: %d", status); } hip::Var* var_ptr = new hip::Var(std::string(name), hip::Var::DeviceVarKind::DVK_Managed, pointer, size, align, reinterpret_cast(hipModule)); status = PlatformState::instance().registerStatManagedVar(var_ptr); - guarantee((status == hipSuccess), "Cannot register Static Managed Var, error: %d \n", status); + guarantee((status == hipSuccess), "Cannot register Static Managed Var, error: %d", status); } void __hipRegisterTexture( @@ -171,12 +171,12 @@ void __hipRegisterTexture( hip::Var* var_ptr = new hip::Var(std::string(hostVar), hip::Var::DeviceVarKind::DVK_Texture, sizeof(textureReference), 0, 0, modules); hipError_t err = PlatformState::instance().registerStatGlobalVar(var, var_ptr); - guarantee((err == hipSuccess), "Cannot register Static Global Var, status: %d \n", err); + guarantee((err == hipSuccess), "Cannot register Static Global Var, status: %d", err); } void __hipUnregisterFatBinary(hip::FatBinaryInfo** modules) { hipError_t err = PlatformState::instance().removeFatBinary(modules); - guarantee((err == hipSuccess), "Cannot Unregister Fat Binary, error:%d \n", err); + guarantee((err == hipSuccess), "Cannot Unregister Fat Binary, error:%d", err); } void __hipRegisterFunction(void** modules, const void* hostFunction, char* deviceFunction, @@ -254,13 +254,13 @@ hipError_t hipLaunchByPtr(const void* hostFunction) { hip::Stream* stream = reinterpret_cast(exec.hStream_); int deviceId = (stream != nullptr) ? stream->DeviceId() : ihipGetDevice(); if (deviceId == -1) { - LogPrintfError("Wrong DeviceId: %d \n", deviceId); + LogPrintfError("Wrong DeviceId: %d", deviceId); HIP_RETURN(hipErrorNoDevice); } hipFunction_t func = nullptr; hipError_t hip_error = PlatformState::instance().getStatFunc(&func, hostFunction, deviceId); if ((hip_error != hipSuccess) || (func == nullptr)) { - LogPrintfError("Could not retrieve hostFunction: 0x%x \n", hostFunction); + LogPrintfError("Could not retrieve hostFunction: 0x%x", hostFunction); HIP_RETURN(hipErrorInvalidDeviceFunction); } @@ -309,12 +309,12 @@ hipError_t ihipCreateGlobalVarObj(const char* name, hipModule_t hmod, amd::Memor device::Program* dev_program = program->getDeviceProgram(*hip::getCurrentDevice()->devices()[0]); if (dev_program == nullptr) { - LogPrintfError("Cannot get Device Function for module: 0x%x \n", hmod); + LogPrintfError("Cannot get Device Function for module: 0x%x", hmod); HIP_RETURN(hipErrorInvalidDeviceFunction); } /* Find the global Symbols */ if (!dev_program->createGlobalVarObj(amd_mem_obj, dptr, bytes, name)) { - LogPrintfError("Cannot create Global Var obj for symbol: %s \n", name); + LogPrintfError("Cannot create Global Var obj for symbol: %s", name); HIP_RETURN(hipErrorInvalidSymbol); } diff --git a/hipamd/src/hip_stream.cpp b/hipamd/src/hip_stream.cpp index 8246cdbb27..6dc5b16aa6 100644 --- a/hipamd/src/hip_stream.cpp +++ b/hipamd/src/hip_stream.cpp @@ -332,7 +332,7 @@ hipStream_t stream_per_thread::get() { hipError_t status = ihipStreamCreate(&m_streams[currDev], hipStreamDefault, hip::Stream::Priority::Normal); if (status != hipSuccess) { - DevLogError("Stream creation failed\n"); + DevLogError("Stream creation failed"); } } return m_streams[currDev]; diff --git a/hipamd/src/hip_texture.cpp b/hipamd/src/hip_texture.cpp index eb9652973e..ddbcbfb058 100644 --- a/hipamd/src/hip_texture.cpp +++ b/hipamd/src/hip_texture.cpp @@ -503,7 +503,7 @@ inline hipError_t ihipGetTextureAlignmentOffset(size_t* offset, // If the device memory pointer was returned from hipMalloc(), // the offset is guaranteed to be 0 and NULL may be passed as the offset parameter. if ((alignedOffset != 0) && (offset == nullptr)) { - LogPrintfError("Texture object not aligned with offset %u \n", alignedOffset); + LogPrintfError("Texture object not aligned with offset %u", alignedOffset); return hipErrorInvalidValue; } @@ -896,7 +896,7 @@ hipError_t hipTexRefGetAddressMode(hipTextureAddressMode* pam, if ((dim != 0) && (dim != 1)) { LogPrintfError( "Currently only 2 dimensions (0,1) are valid," - "dim : %d \n", + "dim : %d", dim); HIP_RETURN(hipErrorInvalidValue); } @@ -918,7 +918,7 @@ hipError_t hipTexRefSetAddressMode(textureReference* texRef, if ((dim < 0) || (dim > 2)) { LogPrintfError( "Currently only 3 dimensions (0,1,2) are valid," - "dim : %d \n", + "dim : %d", dim); HIP_RETURN(hipErrorInvalidValue); } @@ -1022,7 +1022,7 @@ hipError_t hipTexRefGetAddress(hipDeviceptr_t* dptr, // TODO use ihipGetTextureObjectResourceDesc() to not pollute the API trace. hipError_t error = ihipGetTextureObjectResourceDesc(&resDesc, texRef->textureObject); if (error != hipSuccess) { - LogPrintfError("hipGetTextureObjectResourceDesc failed with error code: %s \n", + LogPrintfError("hipGetTextureObjectResourceDesc failed with error code: %s", ihipGetErrorName(error)); HIP_RETURN(error); } diff --git a/hipamd/src/hip_vm.cpp b/hipamd/src/hip_vm.cpp index 45f9ea00fc..9daa1ea86f 100644 --- a/hipamd/src/hip_vm.cpp +++ b/hipamd/src/hip_vm.cpp @@ -106,13 +106,13 @@ hipError_t hipMemCreate(hipMemGenericAllocationHandle_t* handle, size_t size, void* ptr = amd::SvmBuffer::malloc(*amdContext, ROCCLR_MEM_PHYMEM, size, dev_info.memBaseAddrAlign_, nullptr); - // Handle out of memory cases, + // Handle out of memory cases, if (ptr == nullptr) { size_t free = 0, total =0; hipError_t hip_error = hipMemGetInfo(&free, &total); if (hip_error == hipSuccess) { LogPrintfError("Allocation failed : Device memory : required :%zu | free :%zu" - "| total :%zu \n", size, free, total); + "| total :%zu", size, free, total); } HIP_RETURN(hipErrorOutOfMemory); } diff --git a/hipamd/src/hiprtc/hiprtc.cpp b/hipamd/src/hiprtc/hiprtc.cpp index 733d00aa28..004836a712 100644 --- a/hipamd/src/hiprtc/hiprtc.cpp +++ b/hipamd/src/hiprtc/hiprtc.cpp @@ -56,7 +56,7 @@ const char* hiprtcGetErrorString(hiprtcResult x) { case HIPRTC_ERROR_LINKING: return "HIPRTC_ERROR_LINKING"; default: - LogPrintfError("Invalid HIPRTC error code: %d \n", x); + LogPrintfError("Invalid HIPRTC error code: %d", x); return nullptr; };