diff --git a/sycl/cmake/modules/FetchUnifiedRuntime.cmake b/sycl/cmake/modules/FetchUnifiedRuntime.cmake index 8f59101cbeb32..7dbb2f4c604ea 100644 --- a/sycl/cmake/modules/FetchUnifiedRuntime.cmake +++ b/sycl/cmake/modules/FetchUnifiedRuntime.cmake @@ -117,11 +117,13 @@ if(SYCL_UR_USE_FETCH_CONTENT) endfunction() set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git") - # commit af7e275b509b41f54a66743ebf748dfb51668abf - # Author: Maosu Zhao - # Date: Thu Oct 17 16:31:21 2024 +0800 - # [DeviceSanitizer] Refactor the code to manage shadow memory (#2127) - set(UNIFIED_RUNTIME_TAG af7e275b509b41f54a66743ebf748dfb51668abf) + # commit c742ca49efb12380a35b8b0b467e6577ab8174ce + # Merge: 3a8bf2c5 504d3b63 + # Author: Kenneth Benzie (Benie) + # Date: Mon Oct 21 11:55:23 2024 +0100 + # Merge pull request #2131 from Bensuo/ben/command-handle-fix + # [EXP][CMDBUF] Make command handle behaviour consistent + set(UNIFIED_RUNTIME_TAG c742ca49efb12380a35b8b0b467e6577ab8174ce) set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES") # Due to the use of dependentloadflag and no installer for UMF and hwloc we need diff --git a/sycl/source/detail/graph_impl.cpp b/sycl/source/detail/graph_impl.cpp index afe32ed7a4fbc..ec847888357f2 100644 --- a/sycl/source/detail/graph_impl.cpp +++ b/sycl/source/detail/graph_impl.cpp @@ -706,9 +706,11 @@ exec_graph_impl::enqueueNodeDirect(sycl::context Ctx, ur_result_t Res = sycl::detail::enqueueImpCommandBufferKernel( Ctx, DeviceImpl, CommandBuffer, *static_cast((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, @@ -744,7 +746,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( diff --git a/sycl/source/detail/scheduler/commands.cpp b/sycl/source/detail/scheduler/commands.cpp index 6556b8008b30a..1d24a2bb41c40 100644 --- a/sycl/source/detail/scheduler/commands.cpp +++ b/sycl/source/detail/scheduler/commands.cpp @@ -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( + 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( 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(UrKernel);