@@ -265,8 +265,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory,
265
265
switch (MemInfoType) {
266
266
case UR_MEM_INFO_SIZE: {
267
267
#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
270
272
try {
271
273
const auto MemVisitor = [](auto &&Mem) -> size_t {
272
274
using T = std::decay_t <decltype (Mem)>;
@@ -276,6 +278,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory,
276
278
UR_CHECK_ERROR (hipMemGetAddressRange (&BasePtr, &AllocSize, Mem.Ptr ));
277
279
return AllocSize;
278
280
} else if constexpr (std::is_same_v<T, SurfaceMem>) {
281
+ #if HIP_VERSION < 50600000
282
+ return 0 ;
283
+ #else
279
284
HIP_ARRAY3D_DESCRIPTOR ArrayDescriptor;
280
285
UR_CHECK_ERROR (
281
286
hipArray3DGetDescriptor (&ArrayDescriptor, Mem.getArray ()));
@@ -288,6 +293,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory,
288
293
(ArrayDescriptor.Height ? ArrayDescriptor.Height : 1 ) *
289
294
(ArrayDescriptor.Depth ? ArrayDescriptor.Depth : 1 );
290
295
return ImageSizeBytes;
296
+ #endif
291
297
} else {
292
298
static_assert (ur_always_false_t <T>, " Not exhaustive visitor!" );
293
299
}
@@ -300,7 +306,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory,
300
306
} catch (...) {
301
307
return UR_RESULT_ERROR_UNKNOWN;
302
308
}
303
- #endif
304
309
}
305
310
case UR_MEM_INFO_CONTEXT: {
306
311
return ReturnValue (hMemory->getContext ());
0 commit comments