diff --git a/sycl/test-e2e/bindless_images/copies/device_to_device_copy.cpp b/sycl/test-e2e/bindless_images/copies/device_to_device_copy.cpp index 08de84c55a795..560cefbc2d37e 100644 --- a/sycl/test-e2e/bindless_images/copies/device_to_device_copy.cpp +++ b/sycl/test-e2e/bindless_images/copies/device_to_device_copy.cpp @@ -1,6 +1,8 @@ // REQUIRES: aspect-ext_oneapi_bindless_images -// REQUIRES: cuda +// UNSUPPORTED: target-amd +// UNSUPPORTED-INTENDED: currently not supporting amd for bindless image d2d +// copy // RUN: %{build} -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/bindless_images/copies/device_to_device_copy_1D_subregion.cpp b/sycl/test-e2e/bindless_images/copies/device_to_device_copy_1D_subregion.cpp index 357d67d78de9b..9ef0f82e05180 100644 --- a/sycl/test-e2e/bindless_images/copies/device_to_device_copy_1D_subregion.cpp +++ b/sycl/test-e2e/bindless_images/copies/device_to_device_copy_1D_subregion.cpp @@ -1,5 +1,7 @@ // REQUIRES: aspect-ext_oneapi_bindless_images -// REQUIRES: cuda +// UNSUPPORTED: target-amd +// UNSUPPORTED-INTENDED: currently not supporting amd for bindless image d2d +// copy // RUN: %{build} -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/bindless_images/copies/device_to_device_copy_2D_subregion.cpp b/sycl/test-e2e/bindless_images/copies/device_to_device_copy_2D_subregion.cpp index d13a9146b2784..dcc0b972d14cd 100644 --- a/sycl/test-e2e/bindless_images/copies/device_to_device_copy_2D_subregion.cpp +++ b/sycl/test-e2e/bindless_images/copies/device_to_device_copy_2D_subregion.cpp @@ -1,6 +1,8 @@ // REQUIRES: aspect-ext_oneapi_bindless_images -// REQUIRES: cuda +// UNSUPPORTED: target-amd +// UNSUPPORTED-INTENDED: currently not supporting amd for bindless image d2d +// copy // RUN: %{build} -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test-e2e/bindless_images/copies/device_to_device_pitched.cpp b/sycl/test-e2e/bindless_images/copies/device_to_device_pitched.cpp index c8a644296eba2..e7cc5ee774741 100644 --- a/sycl/test-e2e/bindless_images/copies/device_to_device_pitched.cpp +++ b/sycl/test-e2e/bindless_images/copies/device_to_device_pitched.cpp @@ -1,8 +1,7 @@ // REQUIRES: aspect-ext_oneapi_bindless_images // REQUIRES: aspect-ext_oneapi_bindless_images_2d_usm -// REQUIRES: cuda // -// UNSUPPORTED: cuda +// UNSUPPORTED: target-amd // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/17231 // RUN: %{build} -o %t.out diff --git a/sycl/test-e2e/bindless_images/copies/host_to_host_pitched.cpp b/sycl/test-e2e/bindless_images/copies/host_to_host_pitched.cpp index 37e58a3d75bef..a7b0bc9ea3b20 100644 --- a/sycl/test-e2e/bindless_images/copies/host_to_host_pitched.cpp +++ b/sycl/test-e2e/bindless_images/copies/host_to_host_pitched.cpp @@ -1,7 +1,9 @@ // REQUIRES: aspect-ext_oneapi_bindless_images // REQUIRES: aspect-ext_oneapi_bindless_images_2d_usm -// REQUIRES: cuda +// UNSUPPORTED: target-amd +// UNSUPPORTED-INTENDED: currently not supporting amd for bindless image d2d +// copy // RUN: %{build} -o %t.out // RUN: %{run} %t.out diff --git a/unified-runtime/source/adapters/level_zero/image.cpp b/unified-runtime/source/adapters/level_zero/image.cpp index 24b2a8cfca758..9313336cc2f5a 100644 --- a/unified-runtime/source/adapters/level_zero/image.cpp +++ b/unified-runtime/source/adapters/level_zero/image.cpp @@ -538,18 +538,58 @@ ur_result_t urBindlessImagesImageCopyExp( WaitList.Length, WaitList.ZeEventList)); } } else if (imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE) { - ze_image_region_t DstRegion; - UR_CALL(getImageRegionHelper(ZeImageDesc, &pCopyRegion->dstOffset, - &pCopyRegion->copyExtent, DstRegion)); - ze_image_region_t SrcRegion; - UR_CALL(getImageRegionHelper(ZeImageDesc, &pCopyRegion->srcOffset, - &pCopyRegion->copyExtent, SrcRegion)); - auto *UrImageDst = static_cast<_ur_image *>(pDst); - auto *UrImageSrc = static_cast(pSrc); - ZE2UR_CALL(zeCommandListAppendImageCopyRegion, - (ZeCommandList, UrImageDst->ZeImage, UrImageSrc->ZeImage, - &DstRegion, &SrcRegion, ZeEvent, WaitList.Length, - WaitList.ZeEventList)); + if (pSrcImageDesc->rowPitch != 0 && pDstImageDesc->rowPitch != 0) { + // Copy from pitched USM memory to pitched USM memory + uint32_t SrcRowPitch = pSrcImageDesc->rowPitch; + uint32_t DstRowPitch = pDstImageDesc->rowPitch; + ze_copy_region_t ZeDstRegion = {(uint32_t)pCopyRegion->dstOffset.x, + (uint32_t)pCopyRegion->dstOffset.y, + (uint32_t)pCopyRegion->dstOffset.z, + DstRowPitch, + (uint32_t)pCopyRegion->copyExtent.height, + (uint32_t)pCopyRegion->copyExtent.depth}; + ze_copy_region_t ZeSrcRegion = {(uint32_t)pCopyRegion->srcOffset.x, + (uint32_t)pCopyRegion->srcOffset.y, + (uint32_t)pCopyRegion->srcOffset.z, + SrcRowPitch, + (uint32_t)pCopyRegion->copyExtent.height, + (uint32_t)pCopyRegion->copyExtent.depth}; + uint32_t DstSlicePitch = 0; + uint32_t SrcSlicePitch = 0; + ZE2UR_CALL(zeCommandListAppendMemoryCopyRegion, + (ZeCommandList, pDst, &ZeDstRegion, DstRowPitch, DstSlicePitch, + pSrc, &ZeSrcRegion, SrcRowPitch, SrcSlicePitch, ZeEvent, + WaitList.Length, WaitList.ZeEventList)); + } else if (pSrcImageDesc->rowPitch == 0 && pDstImageDesc->rowPitch != 0) { + // Handle the case where source row pitch is zero and destination row + // pitch is non-zero + logger::error( + "urBindlessImagesImageCopyExp: Source row pitch is zero, but " + "destination row pitch is non-zero. Potential " + "misconfiguration detected."); + return UR_RESULT_ERROR_INVALID_ARGUMENT; + } else if (pSrcImageDesc->rowPitch != 0 && pDstImageDesc->rowPitch == 0) { + // Handle the case where destination row pitch is zero and source row + // pitch is non-zero + logger::error( + "urBindlessImagesImageCopyExp: Destination row pitch is zero, but " + "source row pitch is non-zero. Potential misconfiguration detected."); + return UR_RESULT_ERROR_INVALID_ARGUMENT; + } else { + // Copy from Non-USM memory to Non-USM memory + ze_image_region_t DstRegion; + UR_CALL(getImageRegionHelper(ZeImageDesc, &pCopyRegion->dstOffset, + &pCopyRegion->copyExtent, DstRegion)); + ze_image_region_t SrcRegion; + UR_CALL(getImageRegionHelper(ZeImageDesc, &pCopyRegion->srcOffset, + &pCopyRegion->copyExtent, SrcRegion)); + auto *UrImageDst = static_cast<_ur_image *>(pDst); + auto *UrImageSrc = static_cast(pSrc); + ZE2UR_CALL(zeCommandListAppendImageCopyRegion, + (ZeCommandList, UrImageDst->ZeImage, UrImageSrc->ZeImage, + &DstRegion, &SrcRegion, ZeEvent, WaitList.Length, + WaitList.ZeEventList)); + } } else { logger::error("urBindlessImagesImageCopyExp: unexpected imageCopyFlags"); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;