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.
  • Loading branch information
edgargabriel committed May 3, 2022
1 parent 2b7943a commit 6efdbb4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/uct/rocm/base/rocm_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,15 @@ ucs_status_t uct_rocm_base_detect_memory_type(uct_md_h md, const void *addr,
info.size = sizeof(hsa_amd_pointer_info_t);
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)) {
hsa_device_type_t dev_type;

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 6efdbb4

Please sign in to comment.