Skip to content

Commit 9c68768

Browse files
committed
[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.
1 parent e79993d commit 9c68768

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

source/adapters/hip/usm.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@ USMFreeImpl([[maybe_unused]] ur_context_handle_t hContext, void *pMem) {
7878
#else
7979
const auto Type = hipPointerAttributeType.memoryType;
8080
#endif
81-
UR_ASSERT(Type == hipMemoryTypeDevice || Type == hipMemoryTypeHost,
81+
UR_ASSERT(Type == hipMemoryTypeDevice || Type == hipMemoryTypeHost ||
82+
Type == hipMemoryTypeManaged,
8283
UR_RESULT_ERROR_INVALID_MEM_OBJECT);
83-
if (Type == hipMemoryTypeDevice) {
84+
if (Type == hipMemoryTypeDevice || Type == hipMemoryTypeManaged) {
8485
UR_CHECK_ERROR(hipFree(pMem));
8586
}
8687
if (Type == hipMemoryTypeHost) {

0 commit comments

Comments
 (0)