SWDEV-559267 - Use CLPrint to DevLogPrintf with Log Level - detail debug. (#1160)

This commit is contained in:
Karthik Jayaprakash
2025-11-25 19:25:32 -05:00
committed by GitHub
parent 93682f2f75
commit 740a06d567
20 changed files with 130 additions and 99 deletions
+24 -14
View File
@@ -935,7 +935,8 @@ bool Sampler::create(const amd::Sampler& owner) {
Hsa::sampler_create(dev_.getBackendDevice(), &samplerDescriptor, &hsa_sampler);
if (HSA_STATUS_SUCCESS != status) {
DevLogPrintfError("Sampler creation failed with status: %d \n", status);
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_RESOURCE,
"Sampler creation failed with status: %d \n", status);
return false;
}
@@ -1943,7 +1944,7 @@ device::Memory* Device::createMemory(amd::Memory& owner) const {
if (!result) {
delete memory;
DevLogError("Cannot Write Image \n");
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_RESOURCE, "Cannot Write Image \n");
return nullptr;
}
@@ -2075,7 +2076,8 @@ void* Device::hostLock(void* hostMem, size_t size, const MemorySegment memSegmen
" deviceMemory = %p, memSegment = %d",
pool, size, hostMem, deviceMemory, static_cast<int>(memSegment));
if (status != HSA_STATUS_SUCCESS) {
DevLogPrintfError("Failed to lock memory to pool, failed with hsa_status: %d \n", status);
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_LOCK,
"Failed to lock memory to pool, failed with hsa_status: %d \n", status);
deviceMemory = nullptr;
}
return deviceMemory;
@@ -2164,8 +2166,9 @@ void* Device::deviceLocalAlloc(size_t size, const AllocationFlags& flags) const
: gpuvm_segment_;
if (pool.handle == 0 || gpuvm_segment_max_alloc_ == 0) {
DevLogPrintfError("Invalid argument, pool_handle: 0x%x , max_alloc: %u \n", pool.handle,
gpuvm_segment_max_alloc_);
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_MEM,
"Invalid argument, pool_handle: 0x%x , max_alloc: %u \n",
pool.handle, gpuvm_segment_max_alloc_);
return nullptr;
}
@@ -2240,7 +2243,7 @@ void* Device::svmAlloc(amd::Context& context, size_t size, size_t alignment, cl_
if (flags & CL_MEM_USE_HOST_PTR) {
svmPtrUsed = svmPtr;
} else {
DevLogPrintfError("Cannot find svm_ptr: 0x%x \n", svmPtr);
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_MEM, "Cannot find svm_ptr: 0x%x \n", svmPtr);
return nullptr;
}
}
@@ -2911,7 +2914,7 @@ hsa_queue_t* Device::acquireQueue(uint32_t queue_size_hint, bool coop_queue,
uint32_t queue_max_packets = 0;
if (HSA_STATUS_SUCCESS !=
Hsa::agent_get_info(bkendDevice_, HSA_AGENT_INFO_QUEUE_MAX_SIZE, &queue_max_packets)) {
DevLogError("Cannot get hsa agent info \n");
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_QUEUE, "Cannot get hsa agent info \n");
return nullptr;
}
auto queue_size = (queue_max_packets < queue_size_hint) ? queue_max_packets : queue_size_hint;
@@ -2933,7 +2936,8 @@ hsa_queue_t* Device::acquireQueue(uint32_t queue_size_hint, bool coop_queue,
if (!coop_queue && (cuMask.size() == 0) && (queuePool_[qIndex].size() > 0)) {
return getQueueFromPool(qIndex);
}
DevLogError("Device::acquireQueue: hsa_queue_create failed!");
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_QUEUE,
"Device::acquireQueue: hsa_queue_create failed!");
return nullptr;
}
}
@@ -2942,7 +2946,8 @@ hsa_queue_t* Device::acquireQueue(uint32_t queue_size_hint, bool coop_queue,
if (queue_priority != HSA_AMD_QUEUE_PRIORITY_NORMAL) {
hsa_status_t st = Hsa::queue_set_priority(queue, queue_priority);
if (st != HSA_STATUS_SUCCESS) {
DevLogError("Device::acquireQueue: hsa_amd_queue_set_priority failed!");
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_QUEUE,
"Device::acquireQueue: hsa_amd_queue_set_priority failed!");
Hsa::queue_destroy(queue);
return nullptr;
}
@@ -3017,7 +3022,8 @@ hsa_queue_t* Device::acquireQueue(uint32_t queue_size_hint, bool coop_queue,
hsa_status_t status =
Hsa::queue_cu_set_mask(queue, final_mask.size() * 32, final_mask.data());
if (status != HSA_STATUS_SUCCESS) {
DevLogError("Device::acquireQueue: hsa_amd_queue_cu_set_mask failed!");
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_QUEUE,
"Device::acquireQueue: hsa_amd_queue_cu_set_mask failed!");
Hsa::queue_destroy(queue);
return nullptr;
}
@@ -3169,7 +3175,8 @@ bool Device::findLinkInfo(const hsa_amd_memory_pool_t& pool,
bkendDevice_, pool, HSA_AMD_AGENT_MEMORY_POOL_INFO_NUM_LINK_HOPS, &hops);
if (hsa_status != HSA_STATUS_SUCCESS) {
DevLogPrintfError("Cannot get hops info, hsa failed with status: %d", hsa_status);
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_MEM,
"Cannot get hops info, hsa failed with status: %d", hsa_status);
return false;
}
@@ -3203,7 +3210,8 @@ bool Device::findLinkInfo(const hsa_amd_memory_pool_t& pool,
break;
}
default: {
DevLogPrintfError("Invalid LinkAttribute: %d ", link_attr.first);
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_MEM,
"Invalid LinkAttribute: %d ", link_attr.first);
return false;
}
}
@@ -3217,7 +3225,8 @@ bool Device::findLinkInfo(const hsa_amd_memory_pool_t& pool,
bkendDevice_, pool, HSA_AMD_AGENT_MEMORY_POOL_INFO_LINK_INFO, link_info.data());
if (hsa_status != HSA_STATUS_SUCCESS) {
DevLogPrintfError("Cannot retrieve link info, hsa failed with status: %d", hsa_status);
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_MEM,
"Cannot retrieve link info, hsa failed with status: %d", hsa_status);
return false;
}
@@ -3254,7 +3263,8 @@ bool Device::findLinkInfo(const hsa_amd_memory_pool_t& pool,
break;
}
default: {
DevLogPrintfError("Invalid LinkAttribute: %d ", link_attr.first);
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_MEM,
"Invalid LinkAttribute: %d ", link_attr.first);
return false;
}
}