SWDEV-301947 - Use new enum for CU count

Use HSA_AMD_AGENT_INFO_COOPERATIVE_COMPUTE_UNIT_COUNT to get compute
units. This is needed to work around assymentric CU harvesting bug on
gfx90a. Add a new device property to get the max available CUs on the
device.

Change-Id: I878f38f14f16c1af01fc0a77157aea1e816a63b8
Tá an tiomantas seo le fáil i:
Saleel Kudchadker tiomanta 2022-01-31 12:57:50 -05:00
1 tuismitheoir 87dd8dd0d7
tiomantas 33aca5a4a6
4 comhad athraithe
+20 -4

Níor tháinig aon chomhaid le do chuardach

+14 -2
Féach ar an gComhad
@@ -1076,7 +1076,8 @@ bool Device::populateOCLDeviceConstants() {
}
if (HSA_STATUS_SUCCESS !=
hsa_agent_get_info(_bkendDevice, (hsa_agent_info_t)HSA_AMD_AGENT_INFO_COMPUTE_UNIT_COUNT,
hsa_agent_get_info(_bkendDevice,
(hsa_agent_info_t)HSA_AMD_AGENT_INFO_COOPERATIVE_COMPUTE_UNIT_COUNT,
&info_.maxComputeUnits_)) {
return false;
}
@@ -1086,6 +1087,17 @@ bool Device::populateOCLDeviceConstants() {
? info_.maxComputeUnits_ / 2
: info_.maxComputeUnits_;
if (HSA_STATUS_SUCCESS !=
hsa_agent_get_info(_bkendDevice, (hsa_agent_info_t)HSA_AMD_AGENT_INFO_COMPUTE_UNIT_COUNT,
&info_.maxBoostComputeUnits_)) {
return false;
}
assert(info_.maxBoostComputeUnits_ > 0);
info_.maxBoostComputeUnits_ = settings().enableWgpMode_
? info_.maxBoostComputeUnits_ / 2
: info_.maxBoostComputeUnits_;
if (HSA_STATUS_SUCCESS != hsa_agent_get_info(_bkendDevice,
(hsa_agent_info_t)HSA_AMD_AGENT_INFO_CACHELINE_SIZE,
&info_.globalMemCacheLineSize_)) {
@@ -2106,7 +2118,7 @@ bool Device::IpcAttach(const void* handle, size_t mem_size, size_t mem_offset,
void* orig_dev_ptr = nullptr;
// Retrieve the devPtr from the handle
hsa_status_t hsa_status =
hsa_status_t hsa_status =
hsa_amd_ipc_memory_attach(reinterpret_cast<const hsa_amd_ipc_memory_t*>(handle),
mem_size, (1 + p2p_agents_.size()), p2p_agents_list_,
&orig_dev_ptr);