Skip to content

Commit

Permalink
[HIP] Support managed allocations in USM free
Browse files Browse the repository at this point in the history
In ROCm 5.7.1 some USM allocations are reported as managed, these are
freed in the same way as device allocations.
  • Loading branch information
npmiller committed Jan 29, 2024
1 parent e79993d commit 9c68768
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/adapters/hip/usm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9c68768

Please sign in to comment.