Skip to content

Commit 34831f4

Browse files
committed
ROCm 6: use hipPointerAttributeType.type when supported
1 parent 205953d commit 34831f4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

source/adapters/hip/usm.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ USMFreeImpl([[maybe_unused]] ur_context_handle_t hContext, void *pMem) {
7272
try {
7373
hipPointerAttribute_t hipPointerAttributeType;
7474
UR_CHECK_ERROR(hipPointerGetAttributes(&hipPointerAttributeType, pMem));
75-
unsigned int Type = hipPointerAttributeType.memoryType;
75+
#if HIP_VERSION >= 50600000
76+
const auto Type = hipPointerAttributeType.type;
77+
#else
78+
const auto Type = hipPointerAttributeType.memoryType;
79+
#endif
7680
UR_ASSERT(Type == hipMemoryTypeDevice || Type == hipMemoryTypeHost,
7781
UR_RESULT_ERROR_INVALID_MEM_OBJECT);
7882
if (Type == hipMemoryTypeDevice) {
@@ -170,7 +174,11 @@ urUSMGetMemAllocInfo(ur_context_handle_t hContext, const void *pMem,
170174
return ReturnValue(UR_USM_TYPE_SHARED);
171175
}
172176
UR_CHECK_ERROR(hipPointerGetAttributes(&hipPointerAttributeType, pMem));
177+
#if HIP_VERSION >= 50600000
178+
Value = hipPointerAttributeType.type;
179+
#else
173180
Value = hipPointerAttributeType.memoryType;
181+
#endif
174182
UR_ASSERT(Value == hipMemoryTypeDevice || Value == hipMemoryTypeHost,
175183
UR_RESULT_ERROR_INVALID_MEM_OBJECT);
176184
if (Value == hipMemoryTypeDevice) {

0 commit comments

Comments
 (0)