Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions source/adapters/hip/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory,
UR_CHECK_ERROR(hipMemGetAddressRange(&BasePtr, &AllocSize, Mem.Ptr));
return AllocSize;
} else if constexpr (std::is_same_v<T, SurfaceMem>) {
#if HIP_VERSION < 50600000
throw UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
#else
HIP_ARRAY3D_DESCRIPTOR ArrayDescriptor;
UR_CHECK_ERROR(hipArray3DGetDescriptor(&ArrayDescriptor, Mem.Array));
UR_CHECK_ERROR(
hipArray3DGetDescriptor(&ArrayDescriptor, Mem.getArray()));
const auto PixelSizeBytes =
GetHipFormatPixelSize(ArrayDescriptor.Format) *
ArrayDescriptor.NumChannels;
Expand All @@ -284,6 +288,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory,
(ArrayDescriptor.Height ? ArrayDescriptor.Height : 1) *
(ArrayDescriptor.Depth ? ArrayDescriptor.Depth : 1);
return ImageSizeBytes;
#endif
} else {
static_assert(ur_always_false_t<T>, "Not exhaustive visitor!");
}
Expand Down Expand Up @@ -535,10 +540,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemImageGetInfo(ur_mem_handle_t hMemory,
UrReturnHelper ReturnValue(propSize, pPropValue, pPropSizeRet);

try {

HIP_ARRAY3D_DESCRIPTOR ArrayInfo;
#if HIP_VERSION >= 50600000
UR_CHECK_ERROR(hipArray3DGetDescriptor(
&ArrayInfo, std::get<SurfaceMem>(hMemory->Mem).Array));
&ArrayInfo, std::get<SurfaceMem>(hMemory->Mem).getArray()));
#else
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
#endif

const auto hip2urFormat =
[](hipArray_Format HipFormat) -> ur_image_channel_type_t {
Expand Down