SWDEV-301667 - Logging refactor

- Remove newline from logging as log function internally inserts a new
line

Change-Id: I25eb2242a1f1e87cf811bcc373d1d485b2e027a8


[ROCm/clr commit: 058b2702db]
This commit is contained in:
Saleel Kudchadker
2023-12-07 01:32:20 +00:00
rodzic 3dfef513b1
commit f969d89aa4
16 zmienionych plików z 77 dodań i 78 usunięć
@@ -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;
}
@@ -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:
+1 -1
Wyświetl plik
@@ -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);
}
+4 -4
Wyświetl plik
@@ -191,7 +191,7 @@ hipError_t FatBinaryInfo::ExtractFatBinaryUsingCOMGR(const std::vector<hip::Devi
#if !defined(_WIN32)
// Using the file descriptor and file size, map the data object.
if (amd::Os::isValidFileDesc(fdesc_)) {
guarantee(fsize_ > 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::vector<hip::Devi
std::string device_name = devices[dev_idx]->devices()[0]->isa().isaName();
if (unique_isa_names.cend() == unique_isa_names.find(device_name)) {
unique_isa_names.insert({device_name, std::make_pair<size_t, size_t>(0,0)});
}
}
}
// Create a query list using COMGR info for unique ISAs.
@@ -253,7 +253,7 @@ hipError_t FatBinaryInfo::ExtractFatBinaryUsingCOMGR(const std::vector<hip::Devi
auto dev_it = unique_isa_names.find(device_name);
// If the size is 0, then COMGR API could not find the CO for this GPU device/ISA
if (dev_it->second.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::vector<hip::Devi
if ((comgr_status = amd_comgr_release_data(data_object)) != AMD_COMGR_STATUS_SUCCESS) {
LogPrintfError("Releasing COMGR data failed with status %d ", comgr_status);
return hipErrorInvalidValue;
}
}
}
return hip_status;
+11 -11
Wyświetl plik
@@ -54,13 +54,13 @@ void setupGLInteropOnce() {
amd::Context::Info info;
if (CL_SUCCESS != amd::Context::checkProperties(properties, &info)) {
LogError("Context setup failed \n");
LogError("Context setup failed");
return;
}
amdContext->setInfo(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);
}
+4 -4
Wyświetl plik
@@ -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<cl_program>(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() {
@@ -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<Node> 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<Node, bool>& 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<Node, bool>& 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<std::vector<Node>>& 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<std::vector<Node>>& parallelLists,
std::vector<Node> 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<std::vector<Node>>& 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;
@@ -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();
+19 -19
Wyświetl plik
@@ -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<amd::Device*>& 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<hipDeviceptr_t*>(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<hipDeviceptr_t*>(data) =
@@ -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;
+3 -3
Wyświetl plik
@@ -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);
}
+13 -13
Wyświetl plik
@@ -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<hip::FatBinaryInfo**>(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<hip::Stream*>(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);
}
+1 -1
Wyświetl plik
@@ -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];
+4 -4
Wyświetl plik
@@ -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);
}
+2 -2
Wyświetl plik
@@ -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);
}
@@ -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;
};