Skip to content
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

[SYCL][Graph] Only get command handle for updatable command-buffers #15522

Open
wants to merge 3 commits into
base: sycl
Choose a base branch
from
Open
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
14 changes: 8 additions & 6 deletions sycl/cmake/modules/FetchUnifiedRuntime.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,14 @@ if(SYCL_UR_USE_FETCH_CONTENT)
CACHE PATH "Path to external '${name}' adapter source dir" FORCE)
endfunction()

set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
# commit af7e275b509b41f54a66743ebf748dfb51668abf
# Author: Maosu Zhao <maosu.zhao@intel.com>
# Date: Thu Oct 17 16:31:21 2024 +0800
# [DeviceSanitizer] Refactor the code to manage shadow memory (#2127)
set(UNIFIED_RUNTIME_TAG af7e275b509b41f54a66743ebf748dfb51668abf)
set(UNIFIED_RUNTIME_REPO "https://github.com/bensuo/unified-runtime.git")
# commit 22962057df1b9d538e08088a7b75d9d8e7c29f90 (HEAD, origin/main, origin/HEAD)
# Merge: e824ddc2 f0a1c433
# Author: aarongreig <aaron.greig@codeplay.com>
# Date: Fri Sep 27 16:54:04 2024 +0100
# Merge pull request #2017 from nrspruit/new_sysman_init
# [L0] Use zesInit for SysMan API usage
set(UNIFIED_RUNTIME_TAG 504d3b6368e19990d57311c4bfab361c427b9054)

set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES")
# Due to the use of dependentloadflag and no installer for UMF and hwloc we need
Expand Down
11 changes: 8 additions & 3 deletions sycl/source/detail/graph_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,9 +703,11 @@ exec_graph_impl::enqueueNodeDirect(sycl::context Ctx,
ur_result_t Res = sycl::detail::enqueueImpCommandBufferKernel(
Ctx, DeviceImpl, CommandBuffer,
*static_cast<sycl::detail::CGExecKernel *>((Node->MCommandGroup.get())),
Deps, &NewSyncPoint, &NewCommand, nullptr);
Deps, &NewSyncPoint, MIsUpdatable ? &NewCommand : nullptr, nullptr);

MCommandMap[Node] = NewCommand;
if (MIsUpdatable) {
MCommandMap[Node] = NewCommand;
}

if (Res != UR_RESULT_SUCCESS) {
throw sycl::exception(errc::invalid,
Expand Down Expand Up @@ -741,7 +743,10 @@ ur_exp_command_buffer_sync_point_t exec_graph_impl::enqueueNode(
Node->getCGCopy(), AllocaQueue, /*EventNeeded=*/true, CommandBuffer,
Deps);

MCommandMap[Node] = Event->getCommandBufferCommand();
if (MIsUpdatable) {
MCommandMap[Node] = Event->getCommandBufferCommand();
}

return Event->getSyncPoint();
}
void exec_graph_impl::createCommandBuffers(
Expand Down
12 changes: 11 additions & 1 deletion sycl/source/detail/scheduler/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2558,12 +2558,22 @@ ur_result_t enqueueImpCommandBufferKernel(
LocalSize = RequiredWGSize;
}

// Command-buffers which are not updatable cannot return command handles, so
// we query the descriptor here to check if a handle is required.
ur_exp_command_buffer_desc_t CommandBufferDesc{};

Adapter->call<UrApiKind::urCommandBufferGetInfoExp>(
Bensuo marked this conversation as resolved.
Show resolved Hide resolved
CommandBuffer,
ur_exp_command_buffer_info_t::UR_EXP_COMMAND_BUFFER_INFO_DESCRIPTOR,
sizeof(ur_exp_command_buffer_desc_t), &CommandBufferDesc, nullptr);

ur_result_t Res =
Adapter->call_nocheck<UrApiKind::urCommandBufferAppendKernelLaunchExp>(
CommandBuffer, UrKernel, NDRDesc.Dims, &NDRDesc.GlobalOffset[0],
&NDRDesc.GlobalSize[0], LocalSize, 0, nullptr, SyncPoints.size(),
SyncPoints.size() ? SyncPoints.data() : nullptr, 0, nullptr,
OutSyncPoint, nullptr, OutCommand);
OutSyncPoint, nullptr,
CommandBufferDesc.isUpdatable ? OutCommand : nullptr);

if (!SyclKernelImpl && !Kernel) {
Adapter->call<UrApiKind::urKernelRelease>(UrKernel);
Expand Down
Loading