From beb9a429983db6edeefe7bd6934fee35ed8d318f Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 28 May 2024 14:45:34 +0000 Subject: [PATCH] VMM: return error if memory-only handle alloc fail Return HSA_STATUS_ERROR_OUT_OF_RESOURCES if thunk call to allocate memory handle returns NULL. Change-Id: I6cf74f93f7d606416414ea7c2354db86aeef3137 Signed-off-by: Chris Freehill --- runtime/hsa-runtime/core/runtime/amd_memory_region.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp b/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp index 40e1d6821c..7d38a83b4f 100644 --- a/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp +++ b/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp @@ -245,9 +245,9 @@ hsa_status_t MemoryRegion::AllocateImpl(size_t& size, AllocateFlags alloc_flags, *address = AllocateKfdMemory(kmt_alloc_flags, node_id, size); } - if (kmt_alloc_flags.ui32.NoAddress) return HSA_STATUS_SUCCESS; - if (*address != nullptr) { + if (kmt_alloc_flags.ui32.NoAddress) return HSA_STATUS_SUCCESS; + // Commit the memory. // For system memory, on non-restricted allocation, map it to all GPUs. On // restricted allocation, only CPU is allowed to access by default, so