@@ -528,35 +528,35 @@ ur_result_t migrateImageToDevice(ur_mem_handle_t Mem,
528
528
// dimensionality
529
529
if (Image.ImageDesc .type == UR_MEM_TYPE_IMAGE2D) {
530
530
memset (&CpyDesc2D, 0 , sizeof (CpyDesc2D));
531
- CpyDesc2D.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_HOST;
532
531
CpyDesc2D.srcHost = Image.HostPtr ;
533
532
CpyDesc2D.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY;
534
533
CpyDesc2D.dstArray = ImageArray;
535
534
CpyDesc2D.WidthInBytes = PixelSizeBytes * Image.ImageDesc .width ;
536
535
CpyDesc2D.Height = Image.ImageDesc .height ;
537
- UR_CHECK_ERROR (cuMemcpy2D (&CpyDesc2D));
538
536
} else if (Image.ImageDesc .type == UR_MEM_TYPE_IMAGE3D) {
539
537
memset (&CpyDesc3D, 0 , sizeof (CpyDesc3D));
540
- CpyDesc3D.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_HOST;
541
538
CpyDesc3D.srcHost = Image.HostPtr ;
542
539
CpyDesc3D.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY;
543
540
CpyDesc3D.dstArray = ImageArray;
544
541
CpyDesc3D.WidthInBytes = PixelSizeBytes * Image.ImageDesc .width ;
545
542
CpyDesc3D.Height = Image.ImageDesc .height ;
546
543
CpyDesc3D.Depth = Image.ImageDesc .depth ;
547
- UR_CHECK_ERROR (cuMemcpy3D (&CpyDesc3D));
548
544
}
549
545
550
546
if (Mem->LastEventWritingToMemObj == nullptr ) {
551
- if (Image.ImageDesc .type == UR_MEM_TYPE_IMAGE1D) {
552
- UR_CHECK_ERROR (
553
- cuMemcpyHtoA (ImageArray, 0 , Image.HostPtr , ImageSizeBytes));
554
- } else if (Image.ImageDesc .type == UR_MEM_TYPE_IMAGE2D) {
555
- CpyDesc2D.srcHost = Image.HostPtr ;
556
- UR_CHECK_ERROR (cuMemcpy2D (&CpyDesc2D));
557
- } else if (Image.ImageDesc .type == UR_MEM_TYPE_IMAGE3D) {
558
- CpyDesc3D.srcHost = Image.HostPtr ;
559
- UR_CHECK_ERROR (cuMemcpy3D (&CpyDesc3D));
547
+ if (Image.HostPtr ) {
548
+ if (Image.ImageDesc .type == UR_MEM_TYPE_IMAGE1D) {
549
+ UR_CHECK_ERROR (
550
+ cuMemcpyHtoA (ImageArray, 0 , Image.HostPtr , ImageSizeBytes));
551
+ } else if (Image.ImageDesc .type == UR_MEM_TYPE_IMAGE2D) {
552
+ CpyDesc2D.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_HOST;
553
+ CpyDesc2D.srcHost = Image.HostPtr ;
554
+ UR_CHECK_ERROR (cuMemcpy2D (&CpyDesc2D));
555
+ } else if (Image.ImageDesc .type == UR_MEM_TYPE_IMAGE3D) {
556
+ CpyDesc3D.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_HOST;
557
+ CpyDesc3D.srcHost = Image.HostPtr ;
558
+ UR_CHECK_ERROR (cuMemcpy3D (&CpyDesc3D));
559
+ }
560
560
}
561
561
} else if (Mem->LastEventWritingToMemObj ->getQueue ()->getDevice () !=
562
562
hDevice) {
0 commit comments