@@ -759,13 +759,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
759759 cpy_desc.dstZ = pCopyRegion->dstOffset .z ;
760760 cpy_desc.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_HOST;
761761 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 ) ;
764764 cpy_desc.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY;
765765 cpy_desc.dstArray = (CUarray)pDst;
766766 cpy_desc.WidthInBytes = PixelSizeBytes * pCopyRegion->copyExtent .width ;
767767 cpy_desc.Height = std::max (uint64_t {1 }, pCopyRegion->copyExtent .height );
768- cpy_desc.Depth = pDstImageDesc-> arraySize ;
768+ cpy_desc.Depth = pCopyRegion-> copyExtent . depth ;
769769 UR_CHECK_ERROR (cuMemcpy3DAsync (&cpy_desc, Stream));
770770 }
771771 } else if (imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST) {
@@ -855,10 +855,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
855855 cpy_desc.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_HOST;
856856 cpy_desc.dstHost = pDst;
857857 cpy_desc.dstPitch = pDstImageDesc->width * PixelSizeBytes;
858- cpy_desc.dstHeight = pDstImageDesc->height ;
858+ cpy_desc.dstHeight = std::max ( uint64_t { 1 }, pDstImageDesc->height ) ;
859859 cpy_desc.WidthInBytes = PixelSizeBytes * pCopyRegion->copyExtent .width ;
860860 cpy_desc.Height = std::max (uint64_t {1 }, pCopyRegion->copyExtent .height );
861- cpy_desc.Depth = pSrcImageDesc-> arraySize ;
861+ cpy_desc.Depth = pCopyRegion-> copyExtent . depth ;
862862 UR_CHECK_ERROR (cuMemcpy3DAsync (&cpy_desc, Stream));
863863 }
864864 } else {
@@ -932,7 +932,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
932932 cpy_desc.dstArray = (CUarray)pDst;
933933 cpy_desc.WidthInBytes = PixelSizeBytes * pCopyRegion->copyExtent .width ;
934934 cpy_desc.Height = std::max (uint64_t {1 }, pCopyRegion->copyExtent .height );
935- cpy_desc.Depth = pSrcImageDesc-> arraySize ;
935+ cpy_desc.Depth = pCopyRegion-> copyExtent . depth ;
936936 UR_CHECK_ERROR (cuMemcpy3DAsync (&cpy_desc, Stream));
937937 }
938938 // Synchronization is required here to handle the case of copying data
0 commit comments