Skip to content

[SYCL][E2E] Drop CUDA requirement from bindless image tests #19819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: sycl
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 25 additions & 43 deletions sycl/source/handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1661,10 +1661,12 @@ void handler::ext_oneapi_copy(
Desc.width * Desc.num_channels * detail::get_channel_size(Desc);

if (ImageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE) {
detail::fill_copy_args(get_impl(), Desc, ImageCopyFlags, HostRowPitch,
detail::fill_copy_args(get_impl(), Desc,
UR_EXP_IMAGE_COPY_FLAG_HOST_TO_HOST, HostRowPitch,
DeviceRowPitch);
} else if (ImageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST) {
detail::fill_copy_args(get_impl(), Desc, ImageCopyFlags, DeviceRowPitch,
detail::fill_copy_args(get_impl(), Desc,
UR_EXP_IMAGE_COPY_FLAG_HOST_TO_HOST, DeviceRowPitch,
HostRowPitch);
} else {
throw sycl::exception(make_error_code(errc::invalid),
Expand Down Expand Up @@ -1701,13 +1703,15 @@ void handler::ext_oneapi_copy(

// Fill the host extent based on the type of copy.
if (ImageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE) {
detail::fill_copy_args(get_impl(), DeviceImgDesc, ImageCopyFlags,
HostRowPitch, DeviceRowPitch, SrcOffset, HostExtent,
DestOffset, {0, 0, 0}, CopyExtent);
detail::fill_copy_args(get_impl(), DeviceImgDesc,
UR_EXP_IMAGE_COPY_FLAG_HOST_TO_HOST, HostRowPitch,
DeviceRowPitch, SrcOffset, HostExtent, DestOffset,
{0, 0, 0}, CopyExtent);
} else if (ImageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST) {
detail::fill_copy_args(get_impl(), DeviceImgDesc, ImageCopyFlags,
DeviceRowPitch, HostRowPitch, SrcOffset, {0, 0, 0},
DestOffset, HostExtent, CopyExtent);
detail::fill_copy_args(get_impl(), DeviceImgDesc,
UR_EXP_IMAGE_COPY_FLAG_HOST_TO_HOST, DeviceRowPitch,
HostRowPitch, SrcOffset, {0, 0, 0}, DestOffset,
HostExtent, CopyExtent);
} else {
throw sycl::exception(make_error_code(errc::invalid),
"Copy Error: This copy function only performs host "
Expand Down Expand Up @@ -1769,7 +1773,7 @@ void handler::ext_oneapi_copy(
MDstPtr = Dest;

detail::fill_copy_args(get_impl(), SrcImgDesc, DestImgDesc,
UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE, 0,
UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST, 0,
DestRowPitch);

setType(detail::CGType::CopyImage);
Expand All @@ -1790,7 +1794,7 @@ void handler::ext_oneapi_copy(
MDstPtr = Dest;

detail::fill_copy_args(get_impl(), SrcImgDesc, DestImgDesc,
UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE, 0,
UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST, 0,
DestRowPitch, SrcOffset, {0, 0, 0}, DestOffset,
{0, 0, 0}, CopyExtent);

Expand All @@ -1810,7 +1814,7 @@ void handler::ext_oneapi_copy(
MDstPtr = reinterpret_cast<void *>(Dest.raw_handle);

detail::fill_copy_args(get_impl(), SrcImgDesc, DestImgDesc,
UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE, SrcRowPitch,
UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE, SrcRowPitch,
0);

setType(detail::CGType::CopyImage);
Expand All @@ -1831,7 +1835,7 @@ void handler::ext_oneapi_copy(
MDstPtr = reinterpret_cast<void *>(Dest.raw_handle);

detail::fill_copy_args(get_impl(), SrcImgDesc, DestImgDesc,
UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE, SrcRowPitch,
UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE, SrcRowPitch,
0, SrcOffset, {0, 0, 0}, DestOffset, {0, 0, 0},
CopyExtent);

Expand All @@ -1851,21 +1855,10 @@ void handler::ext_oneapi_copy(
MSrcPtr = const_cast<void *>(Src);
MDstPtr = Dest;

ur_exp_image_copy_flags_t ImageCopyFlags = detail::getUrImageCopyFlags(
get_pointer_type(Src,
createSyclObjFromImpl<context>(impl->get_context())),
get_pointer_type(Dest,
createSyclObjFromImpl<context>(impl->get_context())));

if (ImageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE ||
ImageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_HOST_TO_HOST) {
detail::fill_copy_args(get_impl(), SrcImgDesc, DestImgDesc, ImageCopyFlags,
SrcRowPitch, DestRowPitch);
} else {
throw sycl::exception(make_error_code(errc::invalid),
"Copy Error: This copy function only performs device "
"to device or host to host copies!");
}
ur_exp_image_copy_flags_t ImageCopyFlags =
UR_EXP_IMAGE_COPY_FLAG_HOST_TO_HOST;
detail::fill_copy_args(get_impl(), SrcImgDesc, DestImgDesc, ImageCopyFlags,
SrcRowPitch, DestRowPitch);

setType(detail::CGType::CopyImage);
}
Expand All @@ -1880,22 +1873,11 @@ void handler::ext_oneapi_copy(
MSrcPtr = const_cast<void *>(Src);
MDstPtr = Dest;

ur_exp_image_copy_flags_t ImageCopyFlags = detail::getUrImageCopyFlags(
get_pointer_type(Src,
createSyclObjFromImpl<context>(impl->get_context())),
get_pointer_type(Dest,
createSyclObjFromImpl<context>(impl->get_context())));

if (ImageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE ||
ImageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_HOST_TO_HOST) {
detail::fill_copy_args(get_impl(), SrcImgDesc, DestImgDesc, ImageCopyFlags,
SrcRowPitch, DestRowPitch, SrcOffset, {0, 0, 0},
DestOffset, {0, 0, 0}, CopyExtent);
} else {
throw sycl::exception(make_error_code(errc::invalid),
"Copy Error: This copy function only performs device "
"to device or host to host copies!");
}
ur_exp_image_copy_flags_t ImageCopyFlags =
UR_EXP_IMAGE_COPY_FLAG_HOST_TO_HOST;
detail::fill_copy_args(get_impl(), SrcImgDesc, DestImgDesc, ImageCopyFlags,
SrcRowPitch, DestRowPitch, SrcOffset, {0, 0, 0},
DestOffset, {0, 0, 0}, CopyExtent);

setType(detail::CGType::CopyImage);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// REQUIRES: aspect-ext_oneapi_bindless_images
// REQUIRES: cuda

// RUN: %{build} -o %t.out
// RUN: %{run} %t.out
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// REQUIRES: aspect-ext_oneapi_bindless_images
// REQUIRES: cuda

// RUN: %{build} -o %t.out
// RUN: %{run} %t.out
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// REQUIRES: aspect-ext_oneapi_bindless_images
// REQUIRES: cuda

// RUN: %{build} -o %t.out
// RUN: %{run} %t.out
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// REQUIRES: aspect-ext_oneapi_bindless_images
// REQUIRES: aspect-ext_oneapi_bindless_images_2d_usm
// REQUIRES: cuda
// XFAIL: level_zero
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/17663
//
// UNSUPPORTED: cuda
// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/17231
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// REQUIRES: aspect-ext_oneapi_bindless_images
// REQUIRES: aspect-ext_oneapi_bindless_images_2d_usm
// REQUIRES: cuda
// XFAIL: level_zero
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/17663

// RUN: %{build} -o %t.out
// RUN: %{run} %t.out
Expand Down
3 changes: 2 additions & 1 deletion sycl/test-e2e/bindless_images/sampling_2D_USM_host.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// REQUIRES: cuda
// REQUIRES: aspect-ext_oneapi_bindless_images_2d_usm
// XFAIL: level_zero
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/17663

// RUN: %{build} -o %t.out
// RUN: %{run-unfiltered-devices} %t.out
Expand Down
24 changes: 24 additions & 0 deletions unified-runtime/source/adapters/level_zero/image_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,30 @@ ur_result_t bindlessImagesHandleCopyFlags(

return UR_RESULT_SUCCESS;
};
case UR_EXP_IMAGE_COPY_FLAG_HOST_TO_HOST: {
// Copy between pitched USM regions
uint32_t DstRowPitch = pDstImageDesc->rowPitch;
uint32_t SrcRowPitch = pSrcImageDesc->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 = DstRowPitch * pDstImageDesc->height;
uint32_t SrcSlicePitch = SrcRowPitch * pSrcImageDesc->height;
ZE2UR_CALL(zeCommandListAppendMemoryCopyRegion,
(ZeCommandList, pDst, &ZeDstRegion, DstRowPitch, DstSlicePitch,
pSrc, &ZeSrcRegion, SrcRowPitch, SrcSlicePitch, zeSignalEvent,
numWaitEvents, phWaitEvents));
return UR_RESULT_SUCCESS;
};
default:
UR_LOG(ERR, "ur_queue_immediate_in_order_t::bindlessImagesImageCopyExp: "
"unexpected imageCopyFlags");
Expand Down
Loading