Skip to content

Commit 71342ad

Browse files
authored
Merge pull request #2472 from nrspruit/fix_3_channel_bindless
[L0] For 3-Channel memory, disable Copy engine Usage
2 parents 44da86d + b60c1fb commit 71342ad

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

source/adapters/level_zero/image.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,16 @@ ur_result_t ze2urImageFormat(const ze_image_desc_t *ZeImageDesc,
265265
return UR_RESULT_SUCCESS;
266266
}
267267

268+
static bool Is3ChannelOrder(ur_image_channel_order_t ChannelOrder) {
269+
switch (ChannelOrder) {
270+
case UR_IMAGE_CHANNEL_ORDER_RGB:
271+
case UR_IMAGE_CHANNEL_ORDER_RGX:
272+
return true;
273+
default:
274+
return false;
275+
}
276+
}
277+
268278
/// Construct ZE image desc from UR image format and desc.
269279
ur_result_t ur2zeImageDesc(const ur_image_format_t *ImageFormat,
270280
const ur_image_desc_t *ImageDesc,
@@ -843,6 +853,14 @@ ur_result_t urBindlessImagesImageCopyExp(
843853
UR_CALL(ur2zeImageDesc(pSrcImageFormat, pSrcImageDesc, ZeImageDesc));
844854

845855
bool UseCopyEngine = hQueue->useCopyEngine(/*PreferCopyEngine*/ true);
856+
// Due to the limitation of the copy engine, disable usage of Copy Engine
857+
// Given 3 channel image
858+
if (Is3ChannelOrder(
859+
ur_cast<ur_image_channel_order_t>(pSrcImageFormat->channelOrder)) ||
860+
Is3ChannelOrder(
861+
ur_cast<ur_image_channel_order_t>(pDstImageFormat->channelOrder))) {
862+
UseCopyEngine = false;
863+
}
846864

847865
_ur_ze_event_list_t TmpWaitList;
848866
UR_CALL(TmpWaitList.createAndRetainUrZeEventList(

0 commit comments

Comments
 (0)