Skip to content

Commit 22610c6

Browse files
[SYCL] Fuse zeCommandListAppendWaitOnEvents into subsequent memory copy command (#7807)
Signed-off-by: Sergey V Maslov <sergey.v.maslov@intel.com>
1 parent f4a9ef1 commit 22610c6

File tree

1 file changed

+9
-26
lines changed

1 file changed

+9
-26
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6929,19 +6929,15 @@ enqueueMemCopyHelper(pi_command_type CommandType, pi_queue Queue, void *Dst,
69296929

69306930
const auto &ZeCommandList = CommandList->first;
69316931
const auto &WaitList = (*Event)->WaitList;
6932-
if (WaitList.Length) {
6933-
6934-
ZE_CALL(zeCommandListAppendWaitOnEvents,
6935-
(ZeCommandList, WaitList.Length, WaitList.ZeEventList));
6936-
}
69376932

69386933
zePrint("calling zeCommandListAppendMemoryCopy() with\n"
69396934
" ZeEvent %#lx\n",
69406935
pi_cast<std::uintptr_t>(ZeEvent));
69416936
printZeEventList(WaitList);
69426937

69436938
ZE_CALL(zeCommandListAppendMemoryCopy,
6944-
(ZeCommandList, Dst, Src, Size, ZeEvent, 0, nullptr));
6939+
(ZeCommandList, Dst, Src, Size, ZeEvent, WaitList.Length,
6940+
WaitList.ZeEventList));
69456941

69466942
if (auto Res =
69476943
Queue->executeCommandList(CommandList, BlockingWrite, OkToBatch))
@@ -6993,10 +6989,6 @@ static pi_result enqueueMemCopyRectHelper(
69936989
const auto &ZeCommandList = CommandList->first;
69946990
const auto &WaitList = (*Event)->WaitList;
69956991

6996-
if (WaitList.Length) {
6997-
ZE_CALL(zeCommandListAppendWaitOnEvents,
6998-
(ZeCommandList, WaitList.Length, WaitList.ZeEventList));
6999-
}
70006992
zePrint("calling zeCommandListAppendMemoryCopy() with\n"
70016993
" ZeEvent %#lx\n",
70026994
pi_cast<std::uintptr_t>(ZeEvent));
@@ -7035,8 +7027,8 @@ static pi_result enqueueMemCopyRectHelper(
70357027

70367028
ZE_CALL(zeCommandListAppendMemoryCopyRegion,
70377029
(ZeCommandList, DstBuffer, &ZeDstRegion, DstPitch, DstSlicePitch,
7038-
SrcBuffer, &ZeSrcRegion, SrcPitch, SrcSlicePitch, nullptr, 0,
7039-
nullptr));
7030+
SrcBuffer, &ZeSrcRegion, SrcPitch, SrcSlicePitch, nullptr,
7031+
WaitList.Length, WaitList.ZeEventList));
70407032

70417033
zePrint("calling zeCommandListAppendMemoryCopyRegion()\n");
70427034

@@ -7250,14 +7242,9 @@ enqueueMemFillHelper(pi_command_type CommandType, pi_queue Queue, void *Ptr,
72507242
const auto &ZeCommandList = CommandList->first;
72517243
const auto &WaitList = (*Event)->WaitList;
72527244

7253-
if (WaitList.Length) {
7254-
ZE_CALL(zeCommandListAppendWaitOnEvents,
7255-
(ZeCommandList, WaitList.Length, WaitList.ZeEventList));
7256-
}
7257-
7258-
ZE_CALL(
7259-
zeCommandListAppendMemoryFill,
7260-
(ZeCommandList, Ptr, Pattern, PatternSize, Size, ZeEvent, 0, nullptr));
7245+
ZE_CALL(zeCommandListAppendMemoryFill,
7246+
(ZeCommandList, Ptr, Pattern, PatternSize, Size, ZeEvent,
7247+
WaitList.Length, WaitList.ZeEventList));
72617248

72627249
zePrint("calling zeCommandListAppendMemoryFill() with\n"
72637250
" ZeEvent %#lx\n",
@@ -7669,10 +7656,6 @@ static pi_result enqueueMemImageCommandHelper(
76697656
const auto &ZeCommandList = CommandList->first;
76707657
const auto &WaitList = (*Event)->WaitList;
76717658

7672-
if (WaitList.Length) {
7673-
ZE_CALL(zeCommandListAppendWaitOnEvents,
7674-
(ZeCommandList, WaitList.Length, WaitList.ZeEventList));
7675-
}
76767659
if (CommandType == PI_COMMAND_TYPE_IMAGE_READ) {
76777660
pi_mem SrcMem = pi_cast<pi_mem>(const_cast<void *>(Src));
76787661

@@ -7709,7 +7692,7 @@ static pi_result enqueueMemImageCommandHelper(
77097692
SrcMem->getZeHandle(ZeHandleSrc, _pi_mem::read_only, Queue->Device));
77107693
ZE_CALL(zeCommandListAppendImageCopyToMemory,
77117694
(ZeCommandList, Dst, pi_cast<ze_image_handle_t>(ZeHandleSrc),
7712-
&ZeSrcRegion, ZeEvent, 0, nullptr));
7695+
&ZeSrcRegion, ZeEvent, WaitList.Length, WaitList.ZeEventList));
77137696
} else if (CommandType == PI_COMMAND_TYPE_IMAGE_WRITE) {
77147697
pi_mem DstMem = pi_cast<pi_mem>(Dst);
77157698
ze_image_region_t ZeDstRegion;
@@ -7743,7 +7726,7 @@ static pi_result enqueueMemImageCommandHelper(
77437726
DstMem->getZeHandle(ZeHandleDst, _pi_mem::write_only, Queue->Device));
77447727
ZE_CALL(zeCommandListAppendImageCopyFromMemory,
77457728
(ZeCommandList, pi_cast<ze_image_handle_t>(ZeHandleDst), Src,
7746-
&ZeDstRegion, ZeEvent, 0, nullptr));
7729+
&ZeDstRegion, ZeEvent, WaitList.Length, WaitList.ZeEventList));
77477730
} else if (CommandType == PI_COMMAND_TYPE_IMAGE_COPY) {
77487731
pi_mem SrcImage = pi_cast<pi_mem>(const_cast<void *>(Src));
77497732
pi_mem DstImage = pi_cast<pi_mem>(Dst);

0 commit comments

Comments
 (0)