clr: Fix some nullptr checks and prints (#2825)
This commit is contained in:
@@ -41,7 +41,8 @@ hipError_t hipMemAddressFree(void* devPtr, size_t size) {
|
|||||||
}
|
}
|
||||||
amd::Memory* memObj = amd::MemObjMap::FindVirtualMemObj(devPtr);
|
amd::Memory* memObj = amd::MemObjMap::FindVirtualMemObj(devPtr);
|
||||||
if (memObj == nullptr) {
|
if (memObj == nullptr) {
|
||||||
LogPrintfError("Cannot find the Virtual MemObj entry for this addr 0x%x", devPtr);
|
LogPrintfError("Cannot find the Virtual MemObj entry for this addr %p", devPtr);
|
||||||
|
HIP_RETURN(hipErrorInvalidValue);
|
||||||
}
|
}
|
||||||
// Single call frees address range for all devices.
|
// Single call frees address range for all devices.
|
||||||
if (!(g_devices[0]->devices()[0]->virtualFree(devPtr))) {
|
if (!(g_devices[0]->devices()[0]->virtualFree(devPtr))) {
|
||||||
@@ -74,10 +75,10 @@ hipError_t hipMemAddressReserve(void** ptr, size_t size, size_t alignment, void*
|
|||||||
|
|
||||||
// If requested address was not allocated, printf error message.
|
// If requested address was not allocated, printf error message.
|
||||||
if (addr != nullptr && addr == *ptr) {
|
if (addr != nullptr && addr == *ptr) {
|
||||||
LogPrintfError("Requested address was not allocated. Allocated address : 0x%x ", *ptr);
|
LogPrintfError("Requested address was not allocated. Allocated address : %p ", *ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
HIP_RETURN(hipSuccess);
|
HIP_RETURN(hipSuccess, ReturnPtrValue(ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
hipError_t hipMemCreate(hipMemGenericAllocationHandle_t* handle, size_t size,
|
hipError_t hipMemCreate(hipMemGenericAllocationHandle_t* handle, size_t size,
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ std::pair<const Isa*, const Isa*> Isa::supportedIsas() {
|
|||||||
//
|
//
|
||||||
// -- Compiler --|-- Runtime --|-- IP --|-- Target --|-- Target Properties --
|
// -- Compiler --|-- Runtime --|-- IP --|-- Target --|-- Target Properties --
|
||||||
// | Supported | Version| Features |
|
// | Supported | Version| Features |
|
||||||
// --------------|-------------|--------|------------|-----------------------
|
// --------------|-------------|--------|------------|-----------------------
|
||||||
// Target ID | ROC PAL | Major | SRAMECC | SIMD/CU
|
// Target ID | ROC PAL | Major | SRAMECC | SIMD/CU
|
||||||
// | | Minor | XNACK | SIMD Width
|
// | | Minor | XNACK | SIMD Width
|
||||||
// | | Step | | Instr Width
|
// | | Step | | Instr Width
|
||||||
@@ -546,7 +546,7 @@ amd::Memory* Device::CreateVirtualBuffer(amd::Context& device_context, void* vpt
|
|||||||
// If not parent, but sub-buffer/child, then validate the address range
|
// If not parent, but sub-buffer/child, then validate the address range
|
||||||
vaddr_base_obj = amd::MemObjMap::FindVirtualMemObj(vptr);
|
vaddr_base_obj = amd::MemObjMap::FindVirtualMemObj(vptr);
|
||||||
if (vaddr_base_obj == nullptr) {
|
if (vaddr_base_obj == nullptr) {
|
||||||
LogPrintfError("Cannot find entry in VirtualMemObjMap: 0x%x \n", vptr);
|
LogPrintfError("Cannot find entry in VirtualMemObjMap: %p ", vptr);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
assert(vaddr_base_obj->getMemFlags() & CL_MEM_VA_RANGE_AMD);
|
assert(vaddr_base_obj->getMemFlags() & CL_MEM_VA_RANGE_AMD);
|
||||||
@@ -588,7 +588,7 @@ amd::Memory* Device::CreateVirtualBuffer(amd::Context& device_context, void* vpt
|
|||||||
bool Device::DestroyVirtualBuffer(amd::Memory* vaddr_mem_obj) {
|
bool Device::DestroyVirtualBuffer(amd::Memory* vaddr_mem_obj) {
|
||||||
// Argument nullptr check.
|
// Argument nullptr check.
|
||||||
if (vaddr_mem_obj == nullptr || vaddr_mem_obj->getSvmPtr() == nullptr) {
|
if (vaddr_mem_obj == nullptr || vaddr_mem_obj->getSvmPtr() == nullptr) {
|
||||||
LogPrintfError("Mem obj passed is nullptr, vaddr_mem_obj: %p \n", vaddr_mem_obj);
|
LogPrintfError("Mem obj passed is nullptr, vaddr_mem_obj: %p ", vaddr_mem_obj);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -596,7 +596,7 @@ bool Device::DestroyVirtualBuffer(amd::Memory* vaddr_mem_obj) {
|
|||||||
// If parent is not nullptr, this is the sub-buffer object.
|
// If parent is not nullptr, this is the sub-buffer object.
|
||||||
amd::Memory* vaddr_base_obj = amd::MemObjMap::FindVirtualMemObj(vaddr_mem_obj->getSvmPtr());
|
amd::Memory* vaddr_base_obj = amd::MemObjMap::FindVirtualMemObj(vaddr_mem_obj->getSvmPtr());
|
||||||
if (vaddr_base_obj == nullptr) {
|
if (vaddr_base_obj == nullptr) {
|
||||||
LogPrintfError("Cannot find mem obj for ptr: 0x%x", vaddr_mem_obj->getSvmPtr());
|
LogPrintfError("Cannot find mem obj for ptr: %p", vaddr_mem_obj->getSvmPtr());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
vaddr_base_obj->removeSubBuffer(vaddr_mem_obj);
|
vaddr_base_obj->removeSubBuffer(vaddr_mem_obj);
|
||||||
@@ -631,7 +631,7 @@ bool Device::BlitProgram::create(amd::Device* device, const std::string& extraKe
|
|||||||
program_ = new Program(*context_, kernels.c_str(), Program::OpenCL_C);
|
program_ = new Program(*context_, kernels.c_str(), Program::OpenCL_C);
|
||||||
if (program_ == nullptr) {
|
if (program_ == nullptr) {
|
||||||
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_KERN,
|
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_KERN,
|
||||||
"Program creation for Kernel: %s failed\n", kernels.c_str());
|
"Program creation for Kernel: %s failed", kernels.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -654,12 +654,12 @@ bool Device::BlitProgram::create(amd::Device* device, const std::string& extraKe
|
|||||||
if ((retval = program_->build(devices, opt.c_str(), nullptr, nullptr, GPU_DUMP_BLIT_KERNELS)) !=
|
if ((retval = program_->build(devices, opt.c_str(), nullptr, nullptr, GPU_DUMP_BLIT_KERNELS)) !=
|
||||||
CL_SUCCESS) {
|
CL_SUCCESS) {
|
||||||
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_KERN,
|
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_KERN,
|
||||||
"Build failed for Kernel: %s with error code %d\n", kernels.c_str(), retval);
|
"Build failed for Kernel: %s with error code %d", kernels.c_str(), retval);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!program_->load()) {
|
if (!program_->load()) {
|
||||||
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_KERN,
|
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_KERN,
|
||||||
"Could not load the kernels: %s \n", kernels.c_str());
|
"Could not load the kernels: %s", kernels.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -689,7 +689,7 @@ bool Device::init() {
|
|||||||
// that KFD is not installed.
|
// that KFD is not installed.
|
||||||
// Ignore the failure and assume KFD is not installed.
|
// Ignore the failure and assume KFD is not installed.
|
||||||
// abort();
|
// abort();
|
||||||
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_INIT, "KFD is not installed \n");
|
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_INIT, "KFD is not installed");
|
||||||
// Disable direct dispatch if ROC initialization wasn't successful
|
// Disable direct dispatch if ROC initialization wasn't successful
|
||||||
if (flagIsDefault(AMD_DIRECT_DISPATCH)) {
|
if (flagIsDefault(AMD_DIRECT_DISPATCH)) {
|
||||||
AMD_DIRECT_DISPATCH = false;
|
AMD_DIRECT_DISPATCH = false;
|
||||||
@@ -1357,7 +1357,7 @@ bool ClBinary::createElfBinary(bool doencrypt, Program::type_t type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!elfOut_->dumpImage(&image, &imageSize)) {
|
if (!elfOut_->dumpImage(&image, &imageSize)) {
|
||||||
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_RESOURCE, "Dump Image failed \n");
|
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_RESOURCE, "Dump Image failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1438,7 +1438,7 @@ bool ClBinary::decryptElf(const char* binaryIn, size_t size, char** decryptBin,
|
|||||||
int outDataSize = 0;
|
int outDataSize = 0;
|
||||||
if (!amd::oclDecrypt(binaryIn, (int)size, outBuf, outBufSize, &outDataSize)) {
|
if (!amd::oclDecrypt(binaryIn, (int)size, outBuf, outBufSize, &outDataSize)) {
|
||||||
delete[] outBuf;
|
delete[] outBuf;
|
||||||
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_RESOURCE, "Cannot Decrypt Image \n");
|
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_RESOURCE, "Cannot Decrypt Image");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1508,7 +1508,7 @@ bool ClBinary::loadLlvmBinary(std::string& llvmBinary,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_KERN,
|
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_KERN,
|
||||||
"Cannot Load LLVM Binary: %s \n", llvmBinary.c_str());
|
"Cannot Load LLVM Binary: %s", llvmBinary.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -807,7 +807,7 @@ hsa_status_t Device::iterateGpuMemoryPoolCallback(hsa_amd_memory_pool_t pool, vo
|
|||||||
if (stat != HSA_STATUS_SUCCESS) {
|
if (stat != HSA_STATUS_SUCCESS) {
|
||||||
LogPrintfError(
|
LogPrintfError(
|
||||||
"Cannot query HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_GRANULE info"
|
"Cannot query HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_GRANULE info"
|
||||||
"failed with hsa_status: %d \n",
|
"failed with hsa_status: %d",
|
||||||
stat);
|
stat);
|
||||||
}
|
}
|
||||||
// Query the recommended granularity for this pool.
|
// Query the recommended granularity for this pool.
|
||||||
@@ -816,7 +816,7 @@ hsa_status_t Device::iterateGpuMemoryPoolCallback(hsa_amd_memory_pool_t pool, vo
|
|||||||
if (stat != HSA_STATUS_SUCCESS) {
|
if (stat != HSA_STATUS_SUCCESS) {
|
||||||
LogPrintfError(
|
LogPrintfError(
|
||||||
"Cannot query HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_REC_GRANULE info"
|
"Cannot query HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_REC_GRANULE info"
|
||||||
"failed with hsa_status: %d \n",
|
"failed with hsa_status: %d",
|
||||||
stat);
|
stat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -966,7 +966,7 @@ bool Sampler::create(const amd::Sampler& owner) {
|
|||||||
|
|
||||||
if (HSA_STATUS_SUCCESS != status) {
|
if (HSA_STATUS_SUCCESS != status) {
|
||||||
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_RESOURCE,
|
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_RESOURCE,
|
||||||
"Sampler creation failed with status: %d \n", status);
|
"Sampler creation failed with status: %d", status);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1980,7 +1980,7 @@ device::Memory* Device::createMemory(amd::Memory& owner) const {
|
|||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
delete memory;
|
delete memory;
|
||||||
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_RESOURCE, "Cannot Write Image \n");
|
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_RESOURCE, "Cannot Write Image");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2113,7 +2113,7 @@ void* Device::hostLock(void* hostMem, size_t size, const MemorySegment memSegmen
|
|||||||
pool, size, hostMem, deviceMemory, static_cast<int>(memSegment));
|
pool, size, hostMem, deviceMemory, static_cast<int>(memSegment));
|
||||||
if (status != HSA_STATUS_SUCCESS) {
|
if (status != HSA_STATUS_SUCCESS) {
|
||||||
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_LOCK,
|
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_LOCK,
|
||||||
"Failed to lock memory to pool, failed with hsa_status: %d \n", status);
|
"Failed to lock memory to pool, failed with hsa_status: %d", status);
|
||||||
deviceMemory = nullptr;
|
deviceMemory = nullptr;
|
||||||
}
|
}
|
||||||
return deviceMemory;
|
return deviceMemory;
|
||||||
@@ -2157,7 +2157,7 @@ uint64_t Device::deviceVmemAlloc(size_t size, uint64_t flags) const {
|
|||||||
hsa_status_t hsa_status =
|
hsa_status_t hsa_status =
|
||||||
Hsa::vmem_handle_create(gpuvm_segment_, size, MEMORY_TYPE_PINNED, flags, &hsa_vmem_handle);
|
Hsa::vmem_handle_create(gpuvm_segment_, size, MEMORY_TYPE_PINNED, flags, &hsa_vmem_handle);
|
||||||
if (hsa_status != HSA_STATUS_SUCCESS) {
|
if (hsa_status != HSA_STATUS_SUCCESS) {
|
||||||
LogPrintfError("Failed hsa_amd_vmem_handle_create! Failed with hsa status: %d \n", hsa_status);
|
LogPrintfError("Failed hsa_amd_vmem_handle_create! Failed with hsa status: %d", hsa_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hsa_vmem_handle.handle;
|
return hsa_vmem_handle.handle;
|
||||||
@@ -2169,7 +2169,7 @@ void Device::deviceVmemRelease(uint64_t mem_handle) const {
|
|||||||
|
|
||||||
hsa_status_t hsa_status = Hsa::vmem_handle_release(hsa_vmem_handle);
|
hsa_status_t hsa_status = Hsa::vmem_handle_release(hsa_vmem_handle);
|
||||||
if (hsa_status != HSA_STATUS_SUCCESS) {
|
if (hsa_status != HSA_STATUS_SUCCESS) {
|
||||||
LogPrintfError("Failed hsa_amd_vmem_handle_release! Failed with hsa status: %d \n", hsa_status);
|
LogPrintfError("Failed hsa_amd_vmem_handle_release! Failed with hsa status: %d", hsa_status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2190,7 +2190,7 @@ void Device::releaseMemory(void* ptr, size_t size) const {
|
|||||||
hsa_status_t hsa_status = Hsa::vmem_address_free(ptr, size);
|
hsa_status_t hsa_status = Hsa::vmem_address_free(ptr, size);
|
||||||
ClPrint(amd::LOG_DEBUG, amd::LOG_MEM, "Free hsa reserved memory %p", ptr);
|
ClPrint(amd::LOG_DEBUG, amd::LOG_MEM, "Free hsa reserved memory %p", ptr);
|
||||||
if (hsa_status != HSA_STATUS_SUCCESS) {
|
if (hsa_status != HSA_STATUS_SUCCESS) {
|
||||||
LogError("hsa_amd_vmem_address_free failed \n");
|
LogError("hsa_amd_vmem_address_free failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2203,7 +2203,7 @@ void* Device::deviceLocalAlloc(size_t size, const AllocationFlags& flags) const
|
|||||||
|
|
||||||
if (pool.handle == 0 || gpuvm_segment_max_alloc_ == 0) {
|
if (pool.handle == 0 || gpuvm_segment_max_alloc_ == 0) {
|
||||||
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_MEM,
|
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_MEM,
|
||||||
"Invalid argument, pool_handle: 0x%x , max_alloc: %u \n",
|
"Invalid argument, pool_handle: 0x%x , max_alloc: %u",
|
||||||
pool.handle, gpuvm_segment_max_alloc_);
|
pool.handle, gpuvm_segment_max_alloc_);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -2279,7 +2279,7 @@ void* Device::svmAlloc(amd::Context& context, size_t size, size_t alignment, cl_
|
|||||||
if (flags & CL_MEM_USE_HOST_PTR) {
|
if (flags & CL_MEM_USE_HOST_PTR) {
|
||||||
svmPtrUsed = svmPtr;
|
svmPtrUsed = svmPtr;
|
||||||
} else {
|
} else {
|
||||||
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_MEM, "Cannot find svm_ptr: 0x%x \n", svmPtr);
|
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_MEM, "Cannot find svm_ptr: %p", svmPtr);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2317,7 +2317,7 @@ void* Device::virtualAlloc(void* req_addr, size_t size, size_t alignment) {
|
|||||||
hsa_status_t hsa_status =
|
hsa_status_t hsa_status =
|
||||||
Hsa::vmem_address_reserve(&vptr, size, reinterpret_cast<uint64_t>(req_addr), 0);
|
Hsa::vmem_address_reserve(&vptr, size, reinterpret_cast<uint64_t>(req_addr), 0);
|
||||||
if (hsa_status != HSA_STATUS_SUCCESS) {
|
if (hsa_status != HSA_STATUS_SUCCESS) {
|
||||||
LogPrintfError("Failed hsa_amd_vmem_address_reserve. Failed with status: %d \n", hsa_status);
|
LogPrintfError("Failed hsa_amd_vmem_address_reserve. Failed with status: %d", hsa_status);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2333,7 +2333,8 @@ void* Device::virtualAlloc(void* req_addr, size_t size, size_t alignment) {
|
|||||||
bool Device::virtualFree(void* addr) {
|
bool Device::virtualFree(void* addr) {
|
||||||
amd::Memory* memObj = amd::MemObjMap::FindVirtualMemObj(addr);
|
amd::Memory* memObj = amd::MemObjMap::FindVirtualMemObj(addr);
|
||||||
if (memObj == nullptr) {
|
if (memObj == nullptr) {
|
||||||
LogPrintfError("Cannot find the Virtual MemObj entry for this addr 0x%x", addr);
|
LogPrintfError("Cannot find the Virtual MemObj entry for this addr %p", addr);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!memObj->getContext().devices()[0]->DestroyVirtualBuffer(memObj)) {
|
if (!memObj->getContext().devices()[0]->DestroyVirtualBuffer(memObj)) {
|
||||||
@@ -2342,7 +2343,7 @@ bool Device::virtualFree(void* addr) {
|
|||||||
|
|
||||||
hsa_status_t hsa_status = Hsa::vmem_address_free(memObj->getSvmPtr(), memObj->getSize());
|
hsa_status_t hsa_status = Hsa::vmem_address_free(memObj->getSvmPtr(), memObj->getSize());
|
||||||
if (hsa_status != HSA_STATUS_SUCCESS) {
|
if (hsa_status != HSA_STATUS_SUCCESS) {
|
||||||
LogPrintfError("Failed hsa_amd_vmem_address_free. Failed with status:%d \n", hsa_status);
|
LogPrintfError("Failed hsa_amd_vmem_address_free. Failed with status:%d", hsa_status);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -2357,7 +2358,7 @@ bool Device::SetMemAccess(void* va_addr, size_t va_size, VmmAccess access_flags,
|
|||||||
access_location == VmmLocationType::kDevice ? getBackendDevice() : getCpuAgent();
|
access_location == VmmLocationType::kDevice ? getBackendDevice() : getCpuAgent();
|
||||||
|
|
||||||
if ((hsa_status = Hsa::vmem_set_access(va_addr, va_size, &desc, 1)) != HSA_STATUS_SUCCESS) {
|
if ((hsa_status = Hsa::vmem_set_access(va_addr, va_size, &desc, 1)) != HSA_STATUS_SUCCESS) {
|
||||||
LogPrintfError("Failed hsa_amd_vmem_set_access. Failed with status:%d \n", hsa_status);
|
LogPrintfError("Failed hsa_amd_vmem_set_access. Failed with status:%d", hsa_status);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2371,13 +2372,13 @@ bool Device::GetMemAccess(void* va_addr, VmmAccess* access_flags_ptr) const {
|
|||||||
size_t discard_offset = 0;
|
size_t discard_offset = 0;
|
||||||
amd::Memory* va_mem_obj = amd::MemObjMap::FindMemObj(va_addr, &discard_offset);
|
amd::Memory* va_mem_obj = amd::MemObjMap::FindMemObj(va_addr, &discard_offset);
|
||||||
if (va_mem_obj == nullptr) {
|
if (va_mem_obj == nullptr) {
|
||||||
LogPrintfError("Failed to get Memory Object for va_addr: 0x%x", va_addr);
|
LogPrintfError("Failed to get Memory Object for va_addr: %p", va_addr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hsa_status = Hsa::vmem_get_access(va_mem_obj->getSvmPtr(), &perms, getBackendDevice())) !=
|
if ((hsa_status = Hsa::vmem_get_access(va_mem_obj->getSvmPtr(), &perms, getBackendDevice())) !=
|
||||||
HSA_STATUS_SUCCESS) {
|
HSA_STATUS_SUCCESS) {
|
||||||
LogPrintfError("Failed hsa_amd_vmem_get_access. Failed with status:%d \n", hsa_status);
|
LogPrintfError("Failed hsa_amd_vmem_get_access. Failed with status:%d", hsa_status);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2400,7 +2401,7 @@ bool Device::ExportShareableVMMHandle(amd::Memory& amd_mem_obj, int flags, void*
|
|||||||
|
|
||||||
if ((hsa_status = Hsa::vmem_export_shareable_handle(&dmabuf_fd, hsa_vmem_handle, flags)) !=
|
if ((hsa_status = Hsa::vmem_export_shareable_handle(&dmabuf_fd, hsa_vmem_handle, flags)) !=
|
||||||
HSA_STATUS_SUCCESS) {
|
HSA_STATUS_SUCCESS) {
|
||||||
LogPrintfError("Failed hsa_vmem_export_shareable_handle with status: %d \n", hsa_status);
|
LogPrintfError("Failed hsa_vmem_export_shareable_handle with status: %d", hsa_status);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2422,7 +2423,7 @@ bool Device::ImportShareableHSAHandle(void* osHandle, uint64_t* hsa_handle_ptr)
|
|||||||
int dmabuf_fd = static_cast<int>(reinterpret_cast<uintptr_t>(osHandle));
|
int dmabuf_fd = static_cast<int>(reinterpret_cast<uintptr_t>(osHandle));
|
||||||
if ((hsa_status = Hsa::vmem_import_shareable_handle(dmabuf_fd, &hsa_vmem_handle)) !=
|
if ((hsa_status = Hsa::vmem_import_shareable_handle(dmabuf_fd, &hsa_vmem_handle)) !=
|
||||||
HSA_STATUS_SUCCESS) {
|
HSA_STATUS_SUCCESS) {
|
||||||
LogPrintfError("Failed hsa_amd_vmem_import_shareable_handle with status: %d \n", hsa_status);
|
LogPrintfError("Failed hsa_amd_vmem_import_shareable_handle with status: %d", hsa_status);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3003,7 +3004,7 @@ hsa_queue_t* Device::acquireQueue(uint32_t queue_size_hint, bool coop_queue,
|
|||||||
uint32_t queue_max_packets = 0;
|
uint32_t queue_max_packets = 0;
|
||||||
if (HSA_STATUS_SUCCESS !=
|
if (HSA_STATUS_SUCCESS !=
|
||||||
Hsa::agent_get_info(bkendDevice_, HSA_AGENT_INFO_QUEUE_MAX_SIZE, &queue_max_packets)) {
|
Hsa::agent_get_info(bkendDevice_, HSA_AGENT_INFO_QUEUE_MAX_SIZE, &queue_max_packets)) {
|
||||||
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_QUEUE, "Cannot get hsa agent info \n");
|
ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_QUEUE, "Cannot get hsa agent info");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
auto queue_size = (queue_max_packets < queue_size_hint) ? queue_max_packets : queue_size_hint;
|
auto queue_size = (queue_max_packets < queue_size_hint) ? queue_max_packets : queue_size_hint;
|
||||||
|
|||||||
Reference in New Issue
Block a user