Skip to content

Commit

Permalink
UCT/ROCM: fix memory type detection
Browse files Browse the repository at this point in the history
fix the approach used to identify ROCm memory type. ROCm memory type
is as of right now of type HSA_EXT_POINTER_TYPE_HSA with the owner agent being a GPU.

(cherry picked from commit 4a876b5)
  • Loading branch information
edgargabriel committed May 17, 2022
1 parent ef6208b commit 5577bce
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/uct/rocm/base/rocm_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,24 @@ ucs_status_t uct_rocm_base_detect_memory_type(uct_md_h md, const void *addr,
{
hsa_status_t status;
hsa_amd_pointer_info_t info;
hsa_device_type_t dev_type;

*mem_type_p = UCS_MEMORY_TYPE_HOST;
if (addr == NULL) {
return UCS_OK;
}

info.size = sizeof(hsa_amd_pointer_info_t);
status = hsa_amd_pointer_info((void*)addr, &info, NULL, NULL, NULL);
status = hsa_amd_pointer_info((void*)addr, &info, NULL, NULL, NULL);
if ((status == HSA_STATUS_SUCCESS) &&
(info.type != HSA_EXT_POINTER_TYPE_UNKNOWN)) {
*mem_type_p = UCS_MEMORY_TYPE_ROCM;
(info.type == HSA_EXT_POINTER_TYPE_HSA)) {
status = hsa_agent_get_info(info.agentOwner, HSA_AGENT_INFO_DEVICE,
&dev_type);
if ((status == HSA_STATUS_SUCCESS) &&
(dev_type == HSA_DEVICE_TYPE_GPU)) {
*mem_type_p = UCS_MEMORY_TYPE_ROCM;
return UCS_OK;
}
}

return UCS_OK;
Expand Down

0 comments on commit 5577bce

Please sign in to comment.