SWDEV-550882 - Expect HSA_EXT_POINTER_TYPE_RESERVED_ADDR pointer type from hsa_amd_pointer_info for hmm (#733)

Este commit está contenido en:
Ioannis Assiouras
2025-08-27 19:42:13 +01:00
cometido por GitHub
padre 89070536c0
commit 5f525ee934
+8 -4
Ver fichero
@@ -2578,8 +2578,12 @@ bool Device::GetSvmAttributes(void** data, size_t* data_sizes, int* attributes,
if (status != HSA_STATUS_SUCCESS) {
LogError("hsa_amd_pointer_info() failed");
}
// Check if it's a legacy non-HMM allocation and update query
if (ptr_info.type != HSA_EXT_POINTER_TYPE_UNKNOWN) {
*reinterpret_cast<uint32_t*>(data[i]) = HSA_AMD_SVM_GLOBAL_FLAG_INDETERMINATE;
if (ptr_info.type == HSA_EXT_POINTER_TYPE_HSA ||
ptr_info.type == HSA_EXT_POINTER_TYPE_LOCKED ||
ptr_info.type == HSA_EXT_POINTER_TYPE_IPC) {
if (ptr_info.global_flags & HSA_AMD_MEMORY_POOL_GLOBAL_FLAG_COARSE_GRAINED) {
*reinterpret_cast<uint32_t*>(data[i]) = HSA_AMD_SVM_GLOBAL_FLAG_COARSE_GRAINED;
} else if (ptr_info.global_flags & HSA_AMD_MEMORY_POOL_GLOBAL_FLAG_FINE_GRAINED) {
@@ -2617,7 +2621,7 @@ bool Device::GetSvmAttributes(void** data, size_t* data_sizes, int* attributes,
attr.push_back({HSA_AMD_SVM_ATTRIB_PREFETCH_LOCATION, 0});
break;
case amd::MemRangeAttribute::CoherencyMode:
if (ptr_info.type == HSA_EXT_POINTER_TYPE_UNKNOWN) {
if (*reinterpret_cast<uint32_t*>(data[i]) == HSA_AMD_SVM_GLOBAL_FLAG_INDETERMINATE) {
attr.push_back({HSA_AMD_SVM_ATTRIB_GLOBAL_FLAG, 0});
}
break;
@@ -2721,7 +2725,7 @@ bool Device::GetSvmAttributes(void** data, size_t* data_sizes, int* attributes,
return false;
}
// if ptr is HMM alloc then overwrite the values
if (ptr_info.type == HSA_EXT_POINTER_TYPE_UNKNOWN) {
if (*reinterpret_cast<uint32_t*>(data[idx]) == HSA_AMD_SVM_GLOBAL_FLAG_INDETERMINATE) {
// Cast ROCr value into the hip format
*reinterpret_cast<uint32_t*>(data[idx]) = static_cast<uint32_t>(it.value);
}
@@ -2734,7 +2738,7 @@ bool Device::GetSvmAttributes(void** data, size_t* data_sizes, int* attributes,
// Find the next location in the query
++idx;
}
} else if (ptr_info.type == HSA_EXT_POINTER_TYPE_UNKNOWN) {
} else if (ptr_info.type == HSA_EXT_POINTER_TYPE_RESERVED_ADDR) {
LogError("GetSvmAttributes() failed, because no HMM support");
return false;
}