Skip to content

Commit

Permalink
Merge pull request #1961 from DBDuncan/duncan/num-channels-mipmap-fix
Browse files Browse the repository at this point in the history
[Bindless][Exp] Fix urBindlessImagesImageGetInfoExp failing with mipmap images
  • Loading branch information
omarahmed1111 authored Aug 26, 2024
2 parents b4195cb + 0db57da commit 76361a8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion source/adapters/cuda/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -961,8 +961,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp(
ur_context_handle_t, ur_exp_image_mem_native_handle_t hImageMem,
ur_image_info_t propName, void *pPropValue, size_t *pPropSizeRet) {

CUarray hCUarray;
CUresult Err = cuMipmappedArrayGetLevel(
&hCUarray, reinterpret_cast<CUmipmappedArray>(hImageMem), 0);

// If cuMipmappedArrayGetLevel failed, hImageMem is already CUarray.
if (Err != CUDA_SUCCESS) {
hCUarray = reinterpret_cast<CUarray>(hImageMem);
}

CUDA_ARRAY3D_DESCRIPTOR ArrayDesc;
UR_CHECK_ERROR(cuArray3DGetDescriptor(&ArrayDesc, (CUarray)hImageMem));
UR_CHECK_ERROR(cuArray3DGetDescriptor(&ArrayDesc, hCUarray));
switch (propName) {
case UR_IMAGE_INFO_WIDTH:
if (pPropValue) {
Expand Down

0 comments on commit 76361a8

Please sign in to comment.