From e7187aae9b0105ed3425fda972e0b552ec5fa98d Mon Sep 17 00:00:00 2001 From: Ben Tracy Date: Thu, 26 Sep 2024 14:32:50 +0100 Subject: [PATCH 1/2] [SYCL][Graph] Only get command handle for updatable command-buffers - 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 - Update UR commit tag --- sycl/cmake/modules/FetchUnifiedRuntime.cmake | 16 ++++++++-------- sycl/source/detail/graph_impl.cpp | 11 ++++++++--- sycl/source/detail/scheduler/commands.cpp | 11 ++++++++++- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/sycl/cmake/modules/FetchUnifiedRuntime.cmake b/sycl/cmake/modules/FetchUnifiedRuntime.cmake index 64ffe1dee7228..af6e334cf4bf7 100644 --- a/sycl/cmake/modules/FetchUnifiedRuntime.cmake +++ b/sycl/cmake/modules/FetchUnifiedRuntime.cmake @@ -116,14 +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 b79ebe4e98789144bcdf3832088eb6e6b5ae6967 - # Merge: 7b4bc761 fbb6e862 - # Author: Kenneth Benzie (Benie) - # Date: Fri Oct 4 16:39:59 2024 +0100 - # Merge pull request #2018 from wenju-he/L0-bindless-image-device-query - # [L0] Fix device query of bindless image support - set(UNIFIED_RUNTIME_TAG b79ebe4e98789144bcdf3832088eb6e6b5ae6967) + set(UNIFIED_RUNTIME_REPO "https://github.com/bensuo/unified-runtime.git") + # commit 22962057df1b9d538e08088a7b75d9d8e7c29f90 (HEAD, origin/main, origin/HEAD) + # Merge: e824ddc2 f0a1c433 + # Author: aarongreig + # 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 508a4531367f57c9d0deb38f151423530a350e54) 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 4df70fc78c1b1..f61beff2bc878 100644 --- a/sycl/source/detail/graph_impl.cpp +++ b/sycl/source/detail/graph_impl.cpp @@ -703,9 +703,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, @@ -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( diff --git a/sycl/source/detail/scheduler/commands.cpp b/sycl/source/detail/scheduler/commands.cpp index 10d42792d87e8..6c84c626e13cb 100644 --- a/sycl/source/detail/scheduler/commands.cpp +++ b/sycl/source/detail/scheduler/commands.cpp @@ -2558,12 +2558,21 @@ 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, OutSyncPoint, - OutCommand); + CommandBufferDesc.isUpdatable ? OutCommand : nullptr); if (!SyclKernelImpl && !Kernel) { Adapter->call(UrKernel); From 92b5f5263677513da2cba86bdd3d3bd3037ef1b8 Mon Sep 17 00:00:00 2001 From: Ben Tracy Date: Thu, 17 Oct 2024 15:24:05 +0100 Subject: [PATCH 2/2] Update UR Tag --- sycl/cmake/modules/FetchUnifiedRuntime.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/cmake/modules/FetchUnifiedRuntime.cmake b/sycl/cmake/modules/FetchUnifiedRuntime.cmake index af6e334cf4bf7..662ae76f8b91e 100644 --- a/sycl/cmake/modules/FetchUnifiedRuntime.cmake +++ b/sycl/cmake/modules/FetchUnifiedRuntime.cmake @@ -123,7 +123,7 @@ if(SYCL_UR_USE_FETCH_CONTENT) # 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 508a4531367f57c9d0deb38f151423530a350e54) + 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