Skip to content

Commit

Permalink
Merge pull request #1928 from isaacault/iault/image_array_copy
Browse files Browse the repository at this point in the history
[Bindless][Exp] Image Array Sub-Region Copies
  • Loading branch information
omarahmed1111 authored Sep 12, 2024
2 parents 1259718 + 8c9ec1c commit 33496b3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions source/adapters/cuda/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -759,13 +759,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
cpy_desc.dstZ = pCopyRegion->dstOffset.z;
cpy_desc.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_HOST;
cpy_desc.srcHost = pSrc;
cpy_desc.srcPitch = pCopyRegion->copyExtent.width * PixelSizeBytes;
cpy_desc.srcHeight = pCopyRegion->copyExtent.height;
cpy_desc.srcPitch = pSrcImageDesc->width * PixelSizeBytes;
cpy_desc.srcHeight = std::max(uint64_t{1}, pSrcImageDesc->height);
cpy_desc.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY;
cpy_desc.dstArray = (CUarray)pDst;
cpy_desc.WidthInBytes = PixelSizeBytes * pCopyRegion->copyExtent.width;
cpy_desc.Height = std::max(uint64_t{1}, pCopyRegion->copyExtent.height);
cpy_desc.Depth = pDstImageDesc->arraySize;
cpy_desc.Depth = pCopyRegion->copyExtent.depth;
UR_CHECK_ERROR(cuMemcpy3DAsync(&cpy_desc, Stream));
}
} else if (imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST) {
Expand Down Expand Up @@ -855,10 +855,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
cpy_desc.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_HOST;
cpy_desc.dstHost = pDst;
cpy_desc.dstPitch = pDstImageDesc->width * PixelSizeBytes;
cpy_desc.dstHeight = pDstImageDesc->height;
cpy_desc.dstHeight = std::max(uint64_t{1}, pDstImageDesc->height);
cpy_desc.WidthInBytes = PixelSizeBytes * pCopyRegion->copyExtent.width;
cpy_desc.Height = std::max(uint64_t{1}, pCopyRegion->copyExtent.height);
cpy_desc.Depth = pSrcImageDesc->arraySize;
cpy_desc.Depth = pCopyRegion->copyExtent.depth;
UR_CHECK_ERROR(cuMemcpy3DAsync(&cpy_desc, Stream));
}
} else {
Expand Down Expand Up @@ -932,7 +932,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
cpy_desc.dstArray = (CUarray)pDst;
cpy_desc.WidthInBytes = PixelSizeBytes * pCopyRegion->copyExtent.width;
cpy_desc.Height = std::max(uint64_t{1}, pCopyRegion->copyExtent.height);
cpy_desc.Depth = pSrcImageDesc->arraySize;
cpy_desc.Depth = pCopyRegion->copyExtent.depth;
UR_CHECK_ERROR(cuMemcpy3DAsync(&cpy_desc, Stream));
}
// Synchronization is required here to handle the case of copying data
Expand Down

0 comments on commit 33496b3

Please sign in to comment.