From 83af0bef556a113b38a9736b40eb3b904eb4b329 Mon Sep 17 00:00:00 2001 From: tiancyin Date: Mon, 9 Jun 2025 16:53:16 +0800 Subject: [PATCH] wsl/hsakmt: add more memory type info Reviewed-by: Longlong Yao Reviewed-by: Flora Cui Signed-off-by: tiancyin --- memory.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/memory.cpp b/memory.cpp index fca8984c45..085b4eb8cb 100644 --- a/memory.cpp +++ b/memory.cpp @@ -840,6 +840,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtQueryPointerInfo(const void *Pointer, memset(PointerInfo, 0, sizeof(HsaPointerInfo)); + wsl::thunk::GpuMemory *gpu_mem = nullptr; Allocation allocation_info; bool found = false; { @@ -850,6 +851,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtQueryPointerInfo(const void *Pointer, if (Pointer >= it->first && (Pointer < reinterpret_cast(it->first) + it->second.size_requested)) { allocation_info = it->second; + gpu_mem = wsl::thunk::GpuMemory::Convert(it->second.handle); found = true; } } @@ -864,6 +866,8 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtQueryPointerInfo(const void *Pointer, if (allocation_info.userptr) { PointerInfo->Type = HSA_POINTER_REGISTERED_USER; PointerInfo->SizeInBytes = allocation_info.size; + } else if (gpu_mem->IsVirtual()) { + PointerInfo->Type = HSA_POINTER_RESERVED_ADDR; } else { PointerInfo->Type = HSA_POINTER_ALLOCATED; PointerInfo->SizeInBytes = allocation_info.size_requested;