From 9c68768d34e9c7c51b05ffd72cc1dc8de37dc058 Mon Sep 17 00:00:00 2001 From: Nicolas Miller Date: Thu, 14 Dec 2023 17:49:39 +0000 Subject: [PATCH] [HIP] Support managed allocations in USM free In ROCm 5.7.1 some USM allocations are reported as managed, these are freed in the same way as device allocations. --- source/adapters/hip/usm.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/adapters/hip/usm.cpp b/source/adapters/hip/usm.cpp index 9d084f7b4e..1a38e14f92 100644 --- a/source/adapters/hip/usm.cpp +++ b/source/adapters/hip/usm.cpp @@ -78,9 +78,10 @@ USMFreeImpl([[maybe_unused]] ur_context_handle_t hContext, void *pMem) { #else const auto Type = hipPointerAttributeType.memoryType; #endif - UR_ASSERT(Type == hipMemoryTypeDevice || Type == hipMemoryTypeHost, + UR_ASSERT(Type == hipMemoryTypeDevice || Type == hipMemoryTypeHost || + Type == hipMemoryTypeManaged, UR_RESULT_ERROR_INVALID_MEM_OBJECT); - if (Type == hipMemoryTypeDevice) { + if (Type == hipMemoryTypeDevice || Type == hipMemoryTypeManaged) { UR_CHECK_ERROR(hipFree(pMem)); } if (Type == hipMemoryTypeHost) {