Skip to content

Commit 1c85750

Browse files
author
Hugh Delaney
committed
Make work for buffer case
1 parent 79457b2 commit 1c85750

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

source/adapters/hip/memory.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory,
265265
switch (MemInfoType) {
266266
case UR_MEM_INFO_SIZE: {
267267
#if HIP_VERSION < 50600000
268-
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
269-
#else
268+
if constexpr (std::is_same_v<T, SurfaceMem>) {
269+
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
270+
}
271+
#endif
270272
try {
271273
const auto MemVisitor = [](auto &&Mem) -> size_t {
272274
using T = std::decay_t<decltype(Mem)>;
@@ -276,6 +278,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory,
276278
UR_CHECK_ERROR(hipMemGetAddressRange(&BasePtr, &AllocSize, Mem.Ptr));
277279
return AllocSize;
278280
} else if constexpr (std::is_same_v<T, SurfaceMem>) {
281+
#if HIP_VERSION < 50600000
282+
return 0;
283+
#else
279284
HIP_ARRAY3D_DESCRIPTOR ArrayDescriptor;
280285
UR_CHECK_ERROR(
281286
hipArray3DGetDescriptor(&ArrayDescriptor, Mem.getArray()));
@@ -288,6 +293,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory,
288293
(ArrayDescriptor.Height ? ArrayDescriptor.Height : 1) *
289294
(ArrayDescriptor.Depth ? ArrayDescriptor.Depth : 1);
290295
return ImageSizeBytes;
296+
#endif
291297
} else {
292298
static_assert(ur_always_false_t<T>, "Not exhaustive visitor!");
293299
}
@@ -300,7 +306,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory,
300306
} catch (...) {
301307
return UR_RESULT_ERROR_UNKNOWN;
302308
}
303-
#endif
304309
}
305310
case UR_MEM_INFO_CONTEXT: {
306311
return ReturnValue(hMemory->getContext());

0 commit comments

Comments
 (0)