Skip to content

Commit c471c8c

Browse files
Bensuokbenzie
andauthored
[SYCL][Graph] Only get command handle for updatable command-buffers (#15522)
- Update UR tag to include changes to command-handles - Update calls to UrCommandBufferAppendKernelLaunch to only request command handles for updatable command-buffers - Only store command handles for updatable command-graphs UR PR: oneapi-src/unified-runtime#2131 --------- Co-authored-by: Kenneth Benzie (Benie) <k.benzie83@gmail.com>
1 parent df9a1a6 commit c471c8c

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

sycl/cmake/modules/FetchUnifiedRuntime.cmake

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,13 @@ if(SYCL_UR_USE_FETCH_CONTENT)
117117
endfunction()
118118

119119
set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
120-
# commit af7e275b509b41f54a66743ebf748dfb51668abf
121-
# Author: Maosu Zhao <maosu.zhao@intel.com>
122-
# Date: Thu Oct 17 16:31:21 2024 +0800
123-
# [DeviceSanitizer] Refactor the code to manage shadow memory (#2127)
124-
set(UNIFIED_RUNTIME_TAG af7e275b509b41f54a66743ebf748dfb51668abf)
120+
# commit c742ca49efb12380a35b8b0b467e6577ab8174ce
121+
# Merge: 3a8bf2c5 504d3b63
122+
# Author: Kenneth Benzie (Benie) <k.benzie@codeplay.com>
123+
# Date: Mon Oct 21 11:55:23 2024 +0100
124+
# Merge pull request #2131 from Bensuo/ben/command-handle-fix
125+
# [EXP][CMDBUF] Make command handle behaviour consistent
126+
set(UNIFIED_RUNTIME_TAG c742ca49efb12380a35b8b0b467e6577ab8174ce)
125127

126128
set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES")
127129
# Due to the use of dependentloadflag and no installer for UMF and hwloc we need

sycl/source/detail/graph_impl.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,11 @@ exec_graph_impl::enqueueNodeDirect(sycl::context Ctx,
706706
ur_result_t Res = sycl::detail::enqueueImpCommandBufferKernel(
707707
Ctx, DeviceImpl, CommandBuffer,
708708
*static_cast<sycl::detail::CGExecKernel *>((Node->MCommandGroup.get())),
709-
Deps, &NewSyncPoint, &NewCommand, nullptr);
709+
Deps, &NewSyncPoint, MIsUpdatable ? &NewCommand : nullptr, nullptr);
710710

711-
MCommandMap[Node] = NewCommand;
711+
if (MIsUpdatable) {
712+
MCommandMap[Node] = NewCommand;
713+
}
712714

713715
if (Res != UR_RESULT_SUCCESS) {
714716
throw sycl::exception(errc::invalid,
@@ -744,7 +746,10 @@ ur_exp_command_buffer_sync_point_t exec_graph_impl::enqueueNode(
744746
Node->getCGCopy(), AllocaQueue, /*EventNeeded=*/true, CommandBuffer,
745747
Deps);
746748

747-
MCommandMap[Node] = Event->getCommandBufferCommand();
749+
if (MIsUpdatable) {
750+
MCommandMap[Node] = Event->getCommandBufferCommand();
751+
}
752+
748753
return Event->getSyncPoint();
749754
}
750755
void exec_graph_impl::createCommandBuffers(

sycl/source/detail/scheduler/commands.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2558,12 +2558,22 @@ ur_result_t enqueueImpCommandBufferKernel(
25582558
LocalSize = RequiredWGSize;
25592559
}
25602560

2561+
// Command-buffers which are not updatable cannot return command handles, so
2562+
// we query the descriptor here to check if a handle is required.
2563+
ur_exp_command_buffer_desc_t CommandBufferDesc{};
2564+
2565+
Adapter->call<UrApiKind::urCommandBufferGetInfoExp>(
2566+
CommandBuffer,
2567+
ur_exp_command_buffer_info_t::UR_EXP_COMMAND_BUFFER_INFO_DESCRIPTOR,
2568+
sizeof(ur_exp_command_buffer_desc_t), &CommandBufferDesc, nullptr);
2569+
25612570
ur_result_t Res =
25622571
Adapter->call_nocheck<UrApiKind::urCommandBufferAppendKernelLaunchExp>(
25632572
CommandBuffer, UrKernel, NDRDesc.Dims, &NDRDesc.GlobalOffset[0],
25642573
&NDRDesc.GlobalSize[0], LocalSize, 0, nullptr, SyncPoints.size(),
25652574
SyncPoints.size() ? SyncPoints.data() : nullptr, 0, nullptr,
2566-
OutSyncPoint, nullptr, OutCommand);
2575+
OutSyncPoint, nullptr,
2576+
CommandBufferDesc.isUpdatable ? OutCommand : nullptr);
25672577

25682578
if (!SyclKernelImpl && !Kernel) {
25692579
Adapter->call<UrApiKind::urKernelRelease>(UrKernel);

0 commit comments

Comments
 (0)