@@ -759,13 +759,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
759
759
cpy_desc.dstZ = pCopyRegion->dstOffset .z ;
760
760
cpy_desc.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_HOST;
761
761
cpy_desc.srcHost = pSrc;
762
- cpy_desc.srcPitch = pCopyRegion-> copyExtent . width * PixelSizeBytes;
763
- cpy_desc.srcHeight = pCopyRegion-> copyExtent . height ;
762
+ cpy_desc.srcPitch = pSrcImageDesc-> width * PixelSizeBytes;
763
+ cpy_desc.srcHeight = std::max ( uint64_t { 1 }, pSrcImageDesc-> height ) ;
764
764
cpy_desc.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY;
765
765
cpy_desc.dstArray = (CUarray)pDst;
766
766
cpy_desc.WidthInBytes = PixelSizeBytes * pCopyRegion->copyExtent .width ;
767
767
cpy_desc.Height = std::max (uint64_t {1 }, pCopyRegion->copyExtent .height );
768
- cpy_desc.Depth = pDstImageDesc-> arraySize ;
768
+ cpy_desc.Depth = pCopyRegion-> copyExtent . depth ;
769
769
UR_CHECK_ERROR (cuMemcpy3DAsync (&cpy_desc, Stream));
770
770
}
771
771
} else if (imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST) {
@@ -855,10 +855,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
855
855
cpy_desc.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_HOST;
856
856
cpy_desc.dstHost = pDst;
857
857
cpy_desc.dstPitch = pDstImageDesc->width * PixelSizeBytes;
858
- cpy_desc.dstHeight = pDstImageDesc->height ;
858
+ cpy_desc.dstHeight = std::max ( uint64_t { 1 }, pDstImageDesc->height ) ;
859
859
cpy_desc.WidthInBytes = PixelSizeBytes * pCopyRegion->copyExtent .width ;
860
860
cpy_desc.Height = std::max (uint64_t {1 }, pCopyRegion->copyExtent .height );
861
- cpy_desc.Depth = pSrcImageDesc-> arraySize ;
861
+ cpy_desc.Depth = pCopyRegion-> copyExtent . depth ;
862
862
UR_CHECK_ERROR (cuMemcpy3DAsync (&cpy_desc, Stream));
863
863
}
864
864
} else {
@@ -932,7 +932,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
932
932
cpy_desc.dstArray = (CUarray)pDst;
933
933
cpy_desc.WidthInBytes = PixelSizeBytes * pCopyRegion->copyExtent .width ;
934
934
cpy_desc.Height = std::max (uint64_t {1 }, pCopyRegion->copyExtent .height );
935
- cpy_desc.Depth = pSrcImageDesc-> arraySize ;
935
+ cpy_desc.Depth = pCopyRegion-> copyExtent . depth ;
936
936
UR_CHECK_ERROR (cuMemcpy3DAsync (&cpy_desc, Stream));
937
937
}
938
938
// Synchronization is required here to handle the case of copying data
0 commit comments