Add global_flags reporting to pointer info.

global_flags reporting allows discovery of an allocation's memory
model (coarse, fine, kernarg).  This is critical on gfx90a and
also allows discovery of the memory model of IPC imports.

Change-Id: Icbc3c243ca20e264af5e1931becd2419f762c7ad
Этот коммит содержится в:
Sean Keely
2021-07-29 15:35:52 -05:00
родитель e6e66e8a05
Коммит e3a01690a5
2 изменённых файлов: 12 добавлений и 1 удалений
+6 -1
Просмотреть файл
@@ -776,7 +776,7 @@ hsa_status_t Runtime::PtrInfo(void* ptr, hsa_amd_pointer_info_t* info, void* (*a
HsaPointerInfo thunkInfo;
uint32_t* mappedNodes;
hsa_amd_pointer_info_t retInfo;
hsa_amd_pointer_info_t retInfo = {0};
// check output struct has an initialized size.
if (info->size == 0) return HSA_STATUS_ERROR_INVALID_ARGUMENT;
@@ -805,6 +805,11 @@ hsa_status_t Runtime::PtrInfo(void* ptr, hsa_amd_pointer_info_t* info, void* (*a
retInfo.hostBaseAddress = thunkInfo.CPUAddress;
retInfo.sizeInBytes = thunkInfo.SizeInBytes;
retInfo.userData = thunkInfo.UserData;
retInfo.global_flags = thunkInfo.MemFlags.ui32.CoarseGrain
? HSA_AMD_MEMORY_POOL_GLOBAL_FLAG_COARSE_GRAINED
: HSA_AMD_MEMORY_POOL_GLOBAL_FLAG_FINE_GRAINED;
retInfo.global_flags |=
thunkInfo.MemFlags.ui32.Uncached ? HSA_AMD_MEMORY_POOL_GLOBAL_FLAG_KERNARG_INIT : 0;
if (block_info != nullptr) {
// Block_info reports the thunk allocation from which we may have suballocated.
// For locked memory we want to return the host address since hostBaseAddress is used to