SWDEV-352502 - SWDEV-355630 - Revert "SWDEV-299940 - Query global memory available on device with HSA attribute HSA_AMD_AGENT_INFO_MEMORY_AVAIL"
This reverts commit1b2f5fbce1. Change-Id: I86175ccf2b543c3ff3dffec6ccae410976972f22 [ROCm/clr commit:4afca0647e]
This commit is contained in:
@@ -1665,23 +1665,10 @@ device::VirtualDevice* Device::createVirtualDevice(amd::CommandQueue* queue) {
|
||||
bool Device::globalFreeMemory(size_t* freeMemory) const {
|
||||
const uint TotalFreeMemory = 0;
|
||||
const uint LargestFreeBlock = 1;
|
||||
uint64_t globalAvailMemory;
|
||||
// Queries memory available in bytes across all global pools owned by the agent
|
||||
if (HSA_STATUS_SUCCESS !=
|
||||
hsa_agent_get_info(bkendDevice_,
|
||||
static_cast<hsa_agent_info_t>(HSA_AMD_AGENT_INFO_MEMORY_AVAIL),
|
||||
&globalAvailMemory)) {
|
||||
LogError("HSA_AMD_AGENT_INFO_MEMORY_AVAIL query failed.");
|
||||
}
|
||||
|
||||
globalAvailMemory = globalAvailMemory / Ki;
|
||||
if (globalAvailMemory > HIP_HIDDEN_FREE_MEM * Ki) {
|
||||
globalAvailMemory -= HIP_HIDDEN_FREE_MEM * Ki;
|
||||
} else {
|
||||
globalAvailMemory = 0;
|
||||
}
|
||||
|
||||
freeMemory[TotalFreeMemory] = globalAvailMemory;
|
||||
freeMemory[TotalFreeMemory] = freeMem_ / Ki;
|
||||
freeMemory[TotalFreeMemory] -= (freeMemory[TotalFreeMemory] > HIP_HIDDEN_FREE_MEM * Ki) ?
|
||||
HIP_HIDDEN_FREE_MEM * Ki : 0;
|
||||
// since there is no memory heap on ROCm, the biggest free block is
|
||||
// equal to total free local memory
|
||||
freeMemory[LargestFreeBlock] = freeMemory[TotalFreeMemory];
|
||||
|
||||
Reference in New Issue
Block a user