From d314fded7abd300020de9d67b0a661b6a74b0ede Mon Sep 17 00:00:00 2001 From: Ben Tracy Date: Tue, 29 Aug 2023 15:46:21 +0100 Subject: [PATCH 01/23] [SYCL][Graph] Add support for fill and memset nodes in graphs - Add support for fill/memset nodes in command graphs - Add tests for buffer fills and memset - Changes to UR Append* naming --- sycl/doc/design/CommandGraph.md | 2 + sycl/include/sycl/detail/pi.def | 2 + sycl/include/sycl/detail/pi.h | 42 ++++++++++++- sycl/plugins/level_zero/pi_level_zero.cpp | 21 +++++++ sycl/plugins/unified_runtime/CMakeLists.txt | 10 +-- sycl/plugins/unified_runtime/pi2ur.hpp | 31 ++++++++++ sycl/source/detail/memory_manager.cpp | 44 +++++++++++++ sycl/source/detail/memory_manager.hpp | 18 ++++++ sycl/source/detail/scheduler/commands.cpp | 22 +++++++ sycl/test-e2e/Graph/Explicit/buffer_fill.cpp | 11 ++++ sycl/test-e2e/Graph/Explicit/usm_memset.cpp | 11 ++++ sycl/test-e2e/Graph/Inputs/buffer_fill.cpp | 34 ++++++++++ sycl/test-e2e/Graph/Inputs/usm_memset.cpp | 30 +++++++++ .../Graph/RecordReplay/buffer_fill.cpp | 11 ++++ .../Graph/RecordReplay/usm_memset.cpp | 11 ++++ sycl/unittests/Extensions/CommandGraph.cpp | 62 +++++++++++++++++++ sycl/unittests/helpers/PiMockPlugin.hpp | 17 +++++ 17 files changed, 368 insertions(+), 11 deletions(-) create mode 100644 sycl/test-e2e/Graph/Explicit/buffer_fill.cpp create mode 100644 sycl/test-e2e/Graph/Explicit/usm_memset.cpp create mode 100644 sycl/test-e2e/Graph/Inputs/buffer_fill.cpp create mode 100644 sycl/test-e2e/Graph/Inputs/usm_memset.cpp create mode 100644 sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp create mode 100644 sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp diff --git a/sycl/doc/design/CommandGraph.md b/sycl/doc/design/CommandGraph.md index 48c0a7fa197f1..b6b1876696c7e 100644 --- a/sycl/doc/design/CommandGraph.md +++ b/sycl/doc/design/CommandGraph.md @@ -37,12 +37,14 @@ with the following entry-points: | `urCommandBufferFinalizeExp` | No more commands can be appended, makes command-buffer ready to enqueue on a command-queue. | | `urCommandBufferAppendKernelLaunchExp` | Append a kernel execution command to command-buffer. | | `urCommandBufferAppendUSMMemcpyExp` | Append a USM memcpy command to the command-buffer. | +| `urCommandBufferAppendUSMFillExp` | Append a USM fill command to the command-buffer. | | `urCommandBufferAppendMemBufferCopyExp` | Append a mem buffer copy command to the command-buffer. | | `urCommandBufferAppendMemBufferWriteExp` | Append a memory write command to a command-buffer object. | | `urCommandBufferAppendMemBufferReadExp` | Append a memory read command to a command-buffer object. | | `urCommandBufferAppendMemBufferCopyRectExp` | Append a rectangular memory copy command to a command-buffer object. | | `urCommandBufferAppendMemBufferWriteRectExp` | Append a rectangular memory write command to a command-buffer object. | | `urCommandBufferAppendMemBufferReadRectExp` | Append a rectangular memory read command to a command-buffer object. | +| `urCommandBufferAppendMemBufferFillExp` | Append a memory fill command to a command-buffer object. | | `urCommandBufferEnqueueExp` | Submit command-buffer to a command-queue for execution. | See the [UR EXP-COMMAND-BUFFER](https://oneapi-src.github.io/unified-runtime/core/EXP-COMMAND-BUFFER.html) diff --git a/sycl/include/sycl/detail/pi.def b/sycl/include/sycl/detail/pi.def index 69513335bf191..d963cfb860f4e 100644 --- a/sycl/include/sycl/detail/pi.def +++ b/sycl/include/sycl/detail/pi.def @@ -176,6 +176,8 @@ _PI_API(piextCommandBufferMemBufferWrite) _PI_API(piextCommandBufferMemBufferWriteRect) _PI_API(piextCommandBufferMemBufferRead) _PI_API(piextCommandBufferMemBufferReadRect) +_PI_API(piextCommandBufferMemBufferFill) +_PI_API(piextCommandBufferFillUSM) _PI_API(piextEnqueueCommandBuffer) _PI_API(piextUSMPitchedAlloc) diff --git a/sycl/include/sycl/detail/pi.h b/sycl/include/sycl/detail/pi.h index 3845be3600a24..ef8249b629714 100644 --- a/sycl/include/sycl/detail/pi.h +++ b/sycl/include/sycl/detail/pi.h @@ -2417,7 +2417,7 @@ __SYCL_EXPORT pi_result piextCommandBufferMemBufferReadRect( pi_buff_rect_offset buffer_offset, pi_buff_rect_offset host_offset, pi_buff_rect_region region, size_t buffer_row_pitch, size_t buffer_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch, - void *ptr, pi_uint32 num_events_in_wait_list, + void *ptr, pi_uint32 num_sync_points_in_wait_list, const pi_ext_sync_point *sync_point_wait_list, pi_ext_sync_point *sync_point); @@ -2434,7 +2434,7 @@ __SYCL_EXPORT pi_result piextCommandBufferMemBufferReadRect( /// \param sync_point The sync_point associated with this memory operation. __SYCL_EXPORT pi_result piextCommandBufferMemBufferWrite( pi_ext_command_buffer command_buffer, pi_mem buffer, size_t offset, - size_t size, const void *ptr, pi_uint32 num_events_in_wait_list, + size_t size, const void *ptr, pi_uint32 num_sync_points_in_wait_list, const pi_ext_sync_point *sync_point_wait_list, pi_ext_sync_point *sync_point); @@ -2459,7 +2459,43 @@ __SYCL_EXPORT pi_result piextCommandBufferMemBufferWriteRect( pi_buff_rect_offset buffer_offset, pi_buff_rect_offset host_offset, pi_buff_rect_region region, size_t buffer_row_pitch, size_t buffer_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch, - const void *ptr, pi_uint32 num_events_in_wait_list, + const void *ptr, pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point); + +/// API to append a mem buffer fill command to the command-buffer. +/// \param command_buffer The command-buffer to append onto. +/// \param buffer is the location to fill the data +/// \param pattern pointer to the pattern to fill the buffer with. +/// \param pattern_size size of the pattern in bytes. +/// \param offset Offset into the buffer to fill from. +/// \param size fill size in bytes. +/// \param num_sync_points_in_wait_list The number of sync points in the +/// provided wait list. +/// \param sync_point_wait_list A list of sync points that this command must +/// wait on. +/// \param sync_point The sync_point associated with this memory operation. +__SYCL_EXPORT pi_result piextCommandBufferMemBufferFill( + pi_ext_command_buffer command_buffer, pi_mem buffer, const void *pattern, + size_t pattern_size, size_t offset, size_t size, + pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point); + +/// API to append a USM fill command to the command-buffer. +/// \param command_buffer The command-buffer to append onto. +/// \param ptr pointer to the USM allocation to fill. +/// \param pattern pointer to the pattern to fill ptr with. +/// \param pattern_size size of the pattern in bytes. +/// \param size fill size in bytes. +/// \param num_sync_points_in_wait_list The number of sync points in the +/// provided wait list. +/// \param sync_point_wait_list A list of sync points that this command must +/// wait on. +/// \param sync_point The sync_point associated with this memory operation. +__SYCL_EXPORT pi_result piextCommandBufferFillUSM( + pi_ext_command_buffer command_buffer, void *ptr, const void *pattern, + size_t pattern_size, size_t size, pi_uint32 num_sync_points_in_wait_list, const pi_ext_sync_point *sync_point_wait_list, pi_ext_sync_point *sync_point); diff --git a/sycl/plugins/level_zero/pi_level_zero.cpp b/sycl/plugins/level_zero/pi_level_zero.cpp index 4816341bb0f01..b4231ffdaff03 100644 --- a/sycl/plugins/level_zero/pi_level_zero.cpp +++ b/sycl/plugins/level_zero/pi_level_zero.cpp @@ -1304,6 +1304,27 @@ pi_result piextCommandBufferMemBufferWriteRect( NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); } +pi_result piextCommandBufferMemBufferFill( + pi_ext_command_buffer CommandBuffer, pi_mem Buffer, const void *Pattern, + size_t PatternSize, size_t Offset, size_t Size, + pi_uint32 NumSyncPointsInWaitList, + const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint) { + return pi2ur::piextCommandBufferMemBufferFill( + CommandBuffer, Buffer, Pattern, PatternSize, Offset, Size, + NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); +} + +pi_result piextCommandBufferFillUSM(pi_ext_command_buffer CommandBuffer, + void *Ptr, const void *Pattern, + size_t PatternSize, size_t Size, + pi_uint32 NumSyncPointsInWaitList, + const pi_ext_sync_point *SyncPointWaitList, + pi_ext_sync_point *SyncPoint) { + return pi2ur::piextCommandBufferFillUSM( + CommandBuffer, Ptr, Pattern, PatternSize, Size, NumSyncPointsInWaitList, + SyncPointWaitList, SyncPoint); +} + pi_result piextEnqueueCommandBuffer(pi_ext_command_buffer CommandBuffer, pi_queue Queue, pi_uint32 NumEventsInWaitList, diff --git a/sycl/plugins/unified_runtime/CMakeLists.txt b/sycl/plugins/unified_runtime/CMakeLists.txt index 8291a4fd02bf9..46120994ccc52 100644 --- a/sycl/plugins/unified_runtime/CMakeLists.txt +++ b/sycl/plugins/unified_runtime/CMakeLists.txt @@ -56,14 +56,8 @@ endif() if(SYCL_PI_UR_USE_FETCH_CONTENT) include(FetchContent) - set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git") - # commit 47af3ee296ae0517213114332ffd3ac54a456b16 - # Merge: bd76c510 f2ca7a91 - # Author: Omar Ahmed <30423288+omarahmed1111@users.noreply.github.com> - # Date: Thu Nov 30 16:11:56 2023 +0000 - # - Merge pull request #1072 from omarahmed1111/merge-some-main-changes-into-adapters-third-patch - # - Merge main into adapters branch - set(UNIFIED_RUNTIME_TAG 47af3ee296ae0517213114332ffd3ac54a456b16) + set(UNIFIED_RUNTIME_REPO "https://github.com/bensuo/unified-runtime.git") + set(UNIFIED_RUNTIME_TAG cmdbuf-fill-memset-l0) if(SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO) set(UNIFIED_RUNTIME_REPO "${SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO}") diff --git a/sycl/plugins/unified_runtime/pi2ur.hpp b/sycl/plugins/unified_runtime/pi2ur.hpp index 01da9137e440c..18e717fe3fe1e 100644 --- a/sycl/plugins/unified_runtime/pi2ur.hpp +++ b/sycl/plugins/unified_runtime/pi2ur.hpp @@ -4521,6 +4521,37 @@ inline pi_result piextCommandBufferMemBufferWrite( return PI_SUCCESS; } +inline pi_result piextCommandBufferMemBufferFill( + pi_ext_command_buffer CommandBuffer, pi_mem Buffer, const void *Pattern, + size_t PatternSize, size_t Offset, size_t Size, + pi_uint32 NumSyncPointsInWaitList, + const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint) { + PI_ASSERT(Buffer, PI_ERROR_INVALID_MEM_OBJECT); + + ur_exp_command_buffer_handle_t UrCommandBuffer = + reinterpret_cast(CommandBuffer); + ur_mem_handle_t UrBuffer = reinterpret_cast(Buffer); + + HANDLE_ERRORS(urCommandBufferAppendMemBufferFillExp( + UrCommandBuffer, UrBuffer, Pattern, PatternSize, Offset, Size, + NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint)); + return PI_SUCCESS; +} + +inline pi_result piextCommandBufferFillUSM( + pi_ext_command_buffer CommandBuffer, void *Ptr, const void *Pattern, + size_t PatternSize, size_t Size, pi_uint32 NumSyncPointsInWaitList, + const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint) { + + ur_exp_command_buffer_handle_t UrCommandBuffer = + reinterpret_cast(CommandBuffer); + + HANDLE_ERRORS(urCommandBufferAppendUSMFillExp( + UrCommandBuffer, Ptr, Pattern, PatternSize, Size, NumSyncPointsInWaitList, + SyncPointWaitList, SyncPoint)); + return PI_SUCCESS; +} + inline pi_result piextEnqueueCommandBuffer(pi_ext_command_buffer CommandBuffer, pi_queue Queue, pi_uint32 NumEventsInWaitList, diff --git a/sycl/source/detail/memory_manager.cpp b/sycl/source/detail/memory_manager.cpp index ae357a8f4fe5b..d0071dbabd15a 100644 --- a/sycl/source/detail/memory_manager.cpp +++ b/sycl/source/detail/memory_manager.cpp @@ -1666,6 +1666,50 @@ void MemoryManager::ext_oneapi_copy_usm_cmd_buffer( } } +void MemoryManager::ext_oneapi_fill_usm_cmd_buffer( + sycl::detail::ContextImplPtr Context, + sycl::detail::pi::PiExtCommandBuffer CommandBuffer, void *DstMem, + size_t Len, int Pattern, std::vector Deps, + sycl::detail::pi::PiExtSyncPoint *OutSyncPoint) { + + if (!DstMem) + throw runtime_error("NULL pointer argument in memory fill operation.", + PI_ERROR_INVALID_VALUE); + + const PluginPtr &Plugin = Context->getPlugin(); + // Pattern is interpreted as an unsigned char so pattern size is always 1. + size_t PatternSize = 1; + Plugin->call( + CommandBuffer, DstMem, &Pattern, PatternSize, Len, Deps.size(), + Deps.data(), OutSyncPoint); +} + +void MemoryManager::ext_oneapi_fill_cmd_buffer( + sycl::detail::ContextImplPtr Context, + sycl::detail::pi::PiExtCommandBuffer CommandBuffer, SYCLMemObjI *SYCLMemObj, + void *Mem, size_t PatternSize, const char *Pattern, unsigned int Dim, + sycl::range<3> Size, sycl::range<3> AccessRange, sycl::id<3> AccessOffset, + unsigned int ElementSize, + std::vector Deps, + sycl::detail::pi::PiExtSyncPoint *OutSyncPoint) { + assert(SYCLMemObj && "The SYCLMemObj is nullptr"); + + const PluginPtr &Plugin = Context->getPlugin(); + if (SYCLMemObj->getType() != detail::SYCLMemObjI::MemObjType::Buffer) { + throw sycl::exception(sycl::make_error_code(sycl::errc::invalid), + "Images are not supported in Graphs"); + } + if (Dim <= 1) { + Plugin->call( + CommandBuffer, pi::cast(Mem), Pattern, + PatternSize, AccessOffset[0] * ElementSize, + AccessRange[0] * ElementSize, Deps.size(), Deps.data(), OutSyncPoint); + return; + } + throw runtime_error("Not supported configuration of fill requested", + PI_ERROR_INVALID_OPERATION); +} + void MemoryManager::copy_image_bindless( void *Src, QueueImplPtr Queue, void *Dst, const sycl::detail::pi::PiMemImageDesc &Desc, diff --git a/sycl/source/detail/memory_manager.hpp b/sycl/source/detail/memory_manager.hpp index a1b68b1418c69..6169c99392f66 100644 --- a/sycl/source/detail/memory_manager.hpp +++ b/sycl/source/detail/memory_manager.hpp @@ -316,6 +316,24 @@ class __SYCL_EXPORT MemoryManager { void *DstMem, std::vector Deps, sycl::detail::pi::PiExtSyncPoint *OutSyncPoint); + static void ext_oneapi_fill_usm_cmd_buffer( + sycl::detail::ContextImplPtr Context, + sycl::detail::pi::PiExtCommandBuffer CommandBuffer, void *DstMem, + size_t Len, int Pattern, + std::vector Deps, + sycl::detail::pi::PiExtSyncPoint *OutSyncPoint); + + static void + ext_oneapi_fill_cmd_buffer(sycl::detail::ContextImplPtr Context, + sycl::detail::pi::PiExtCommandBuffer CommandBuffer, + SYCLMemObjI *SYCLMemObj, void *Mem, + size_t PatternSize, const char *Pattern, + unsigned int Dim, sycl::range<3> Size, + sycl::range<3> AccessRange, + sycl::id<3> AccessOffset, unsigned int ElementSize, + std::vector Deps, + sycl::detail::pi::PiExtSyncPoint *OutSyncPoint); + static void copy_image_bindless(void *Src, QueueImplPtr Queue, void *Dst, const sycl::detail::pi::PiMemImageDesc &Desc, diff --git a/sycl/source/detail/scheduler/commands.cpp b/sycl/source/detail/scheduler/commands.cpp index 15741a11d5a2b..a6e6aa0756262 100644 --- a/sycl/source/detail/scheduler/commands.cpp +++ b/sycl/source/detail/scheduler/commands.cpp @@ -2768,6 +2768,28 @@ pi_int32 ExecCGCommand::enqueueImpCommandBuffer() { MEvent->setSyncPoint(OutSyncPoint); return PI_SUCCESS; } + case CG::CGTYPE::Fill: { + CGFill *Fill = (CGFill *)MCommandGroup.get(); + Requirement *Req = (Requirement *)(Fill->getReqToFill()); + AllocaCommandBase *AllocaCmd = getAllocaForReq(Req); + + MemoryManager::ext_oneapi_fill_cmd_buffer( + MQueue->getContextImplPtr(), MCommandBuffer, AllocaCmd->getSYCLMemObj(), + AllocaCmd->getMemAllocation(), Fill->MPattern.size(), + Fill->MPattern.data(), Req->MDims, Req->MMemoryRange, Req->MAccessRange, + Req->MOffset, Req->MElemSize, std::move(MSyncPointDeps), &OutSyncPoint); + + return PI_SUCCESS; + } + case CG::CGTYPE::FillUSM: { + CGFillUSM *Fill = (CGFillUSM *)MCommandGroup.get(); + MemoryManager::ext_oneapi_fill_usm_cmd_buffer( + MQueue->getContextImplPtr(), MCommandBuffer, Fill->getDst(), + Fill->getLength(), Fill->getFill(), std::move(MSyncPointDeps), + &OutSyncPoint); + + return PI_SUCCESS; + } default: throw runtime_error("CG type not implemented for command buffers.", PI_ERROR_INVALID_OPERATION); diff --git a/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp b/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp new file mode 100644 index 0000000000000..8a13e4487d929 --- /dev/null +++ b/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp @@ -0,0 +1,11 @@ +// REQUIRES: level_zero, gpu +// RUN: %{build} -o %t.out +// RUN: %{run} %t.out +// Extra run to check for leaks in Level Zero using ZE_DEBUG +// RUN: %if ext_oneapi_level_zero %{env ZE_DEBUG=4 %{run} %t.out 2>&1 | FileCheck %s %} +// +// CHECK-NOT: LEAK + +#define GRAPH_E2E_EXPLICIT + +#include "../Inputs/buffer_fill.cpp" diff --git a/sycl/test-e2e/Graph/Explicit/usm_memset.cpp b/sycl/test-e2e/Graph/Explicit/usm_memset.cpp new file mode 100644 index 0000000000000..a65fb3ba836a2 --- /dev/null +++ b/sycl/test-e2e/Graph/Explicit/usm_memset.cpp @@ -0,0 +1,11 @@ +// REQUIRES: level_zero, gpu +// RUN: %{build} -o %t.out +// RUN: %{run} %t.out +// Extra run to check for leaks in Level Zero using ZE_DEBUG +// RUN: %if ext_oneapi_level_zero %{env ZE_DEBUG=4 %{run} %t.out 2>&1 | FileCheck %s %} +// +// CHECK-NOT: LEAK + +#define GRAPH_E2E_EXPLICIT + +#include "../Inputs/usm_memset.cpp" diff --git a/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp b/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp new file mode 100644 index 0000000000000..9496abdbd6389 --- /dev/null +++ b/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp @@ -0,0 +1,34 @@ +// Tests adding a Buffer fill operation as a graph node. + +#include "../graph_common.hpp" + +int main() { + + queue Queue; + const size_t N = 10; + const float Pattern = 3.14f; + std::vector Data(N); + buffer Buffer(Data); + Buffer.set_write_back(false); + { + exp_ext::command_graph Graph{ + Queue.get_context(), + Queue.get_device(), + {exp_ext::property::graph::assume_buffer_outlives_graph{}, + exp_ext::property::graph::assume_data_outlives_buffer{}}}; + + auto NodeA = add_node(Graph, Queue, [&](handler &CGH) { + auto Acc = Buffer.get_access(CGH); + CGH.fill(Acc, Pattern); + }); + + auto ExecGraph = Graph.finalize(); + + Queue.submit([&](handler &CGH) { CGH.ext_oneapi_graph(ExecGraph); }).wait(); + } + host_accessor HostData(Buffer); + for (int i = 0; i < N; i++) + assert(HostData[i] == Pattern); + + return 0; +} diff --git a/sycl/test-e2e/Graph/Inputs/usm_memset.cpp b/sycl/test-e2e/Graph/Inputs/usm_memset.cpp new file mode 100644 index 0000000000000..90212be27d37a --- /dev/null +++ b/sycl/test-e2e/Graph/Inputs/usm_memset.cpp @@ -0,0 +1,30 @@ +// Tests adding a USM memset operation as a graph node. + +#include "../graph_common.hpp" + +int main() { + + queue Queue; + + exp_ext::command_graph Graph{Queue.get_context(), Queue.get_device()}; + + const size_t N = 10; + unsigned char *Arr = malloc_device(N, Queue); + + int Value = 77; + auto NodeA = + add_node(Graph, Queue, [&](handler &CGH) { CGH.memset(Arr, Value, N); }); + + auto ExecGraph = Graph.finalize(); + + Queue.submit([&](handler &CGH) { CGH.ext_oneapi_graph(ExecGraph); }).wait(); + + std::vector Output(N); + Queue.memcpy(Output.data(), Arr, N).wait(); + for (int i = 0; i < N; i++) + assert(Output[i] == Value); + + sycl::free(Arr, Queue); + + return 0; +} diff --git a/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp b/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp new file mode 100644 index 0000000000000..770e2ad00184c --- /dev/null +++ b/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp @@ -0,0 +1,11 @@ +// REQUIRES: level_zero, gpu +// RUN: %{build} -o %t.out +// RUN: %{run} %t.out +// Extra run to check for leaks in Level Zero using ZE_DEBUG +// RUN: %if ext_oneapi_level_zero %{env ZE_DEBUG=4 %{run} %t.out 2>&1 | FileCheck %s %} +// +// CHECK-NOT: LEAK + +#define GRAPH_E2E_RECORD_REPLAY + +#include "../Inputs/buffer_fill.cpp" diff --git a/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp b/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp new file mode 100644 index 0000000000000..35049362b0d96 --- /dev/null +++ b/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp @@ -0,0 +1,11 @@ +// REQUIRES: level_zero, gpu +// RUN: %{build} -o %t.out +// RUN: %{run} %t.out +// Extra run to check for leaks in Level Zero using ZE_DEBUG +// RUN: %if ext_oneapi_level_zero %{env ZE_DEBUG=4 %{run} %t.out 2>&1 | FileCheck %s %} +// +// CHECK-NOT: LEAK + +#define GRAPH_E2E_RECORD_REPLAY + +#include "../Inputs/usm_memset.cpp" diff --git a/sycl/unittests/Extensions/CommandGraph.cpp b/sycl/unittests/Extensions/CommandGraph.cpp index f7b559d772686..26403e56b99c6 100644 --- a/sycl/unittests/Extensions/CommandGraph.cpp +++ b/sycl/unittests/Extensions/CommandGraph.cpp @@ -2274,3 +2274,65 @@ TEST_F(MultiThreadGraphTest, Finalize) { ASSERT_EQ(checkExecGraphSchedule(GraphExecImpl, GraphExecRefImpl), true); } } + +// Test adding fill and memset nodes to a graph +TEST_F(CommandGraphTest, FillMemsetNodes) { + const int Value = 7; + // Buffer fill + buffer Buffer{range<1>{1}}; + Buffer.set_write_back(false); + + { + ext::oneapi::experimental::command_graph Graph{ + Queue.get_context(), + Queue.get_device(), + {experimental::property::graph::assume_buffer_outlives_graph{}}}; + + auto NodeA = Graph.add([&](handler &CGH) { + auto Acc = Buffer.get_access(CGH); + CGH.fill(Acc, Value); + }); + auto NodeB = Graph.add([&](handler &CGH) { + auto Acc = Buffer.get_access(CGH); + CGH.fill(Acc, Value); + }); + + auto NodeAImpl = sycl::detail::getSyclObjImpl(NodeA); + auto NodeBImpl = sycl::detail::getSyclObjImpl(NodeB); + + // Check Operator== + EXPECT_EQ(NodeAImpl, NodeAImpl); + EXPECT_NE(NodeAImpl, NodeBImpl); + } + + // USM + { + int *USMPtr = malloc_device(1, Queue); + + // We need to create some differences between nodes because unlike buffer + // fills they are not differentiated on accessor ptr value. + auto FillNodeA = + Graph.add([&](handler &CGH) { CGH.fill(USMPtr, Value, 1); }); + auto FillNodeB = + Graph.add([&](handler &CGH) { CGH.fill(USMPtr, Value + 1, 1); }); + auto MemsetNodeA = + Graph.add([&](handler &CGH) { CGH.memset(USMPtr, Value, 1); }); + auto MemsetNodeB = + Graph.add([&](handler &CGH) { CGH.memset(USMPtr, Value, 2); }); + + auto FillNodeAImpl = sycl::detail::getSyclObjImpl(FillNodeA); + auto FillNodeBImpl = sycl::detail::getSyclObjImpl(FillNodeB); + auto MemsetNodeAImpl = sycl::detail::getSyclObjImpl(MemsetNodeA); + auto MemsetNodeBImpl = sycl::detail::getSyclObjImpl(MemsetNodeB); + + // Check Operator== + EXPECT_EQ(FillNodeAImpl, FillNodeAImpl); + EXPECT_EQ(FillNodeBImpl, FillNodeBImpl); + EXPECT_NE(FillNodeAImpl, FillNodeBImpl); + + EXPECT_EQ(MemsetNodeAImpl, MemsetNodeAImpl); + EXPECT_EQ(MemsetNodeBImpl, MemsetNodeBImpl); + EXPECT_NE(MemsetNodeAImpl, MemsetNodeBImpl); + sycl::free(USMPtr, Queue); + } +} diff --git a/sycl/unittests/helpers/PiMockPlugin.hpp b/sycl/unittests/helpers/PiMockPlugin.hpp index f12917b1e70b9..decc1a7e309ee 100644 --- a/sycl/unittests/helpers/PiMockPlugin.hpp +++ b/sycl/unittests/helpers/PiMockPlugin.hpp @@ -1376,6 +1376,23 @@ inline pi_result mock_piextCommandBufferMemBufferCopyRect( return PI_SUCCESS; } +inline pi_result mock_piextCommandBufferMemBufferFill( + pi_ext_command_buffer command_buffer, pi_mem buffer, const void *pattern, + size_t pattern_size, size_t offset, size_t size, + pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point) { + return PI_SUCCESS; +} + +inline pi_result mock_piextCommandBufferFillUSM( + pi_ext_command_buffer command_buffer, void *ptr, const void *pattern, + size_t pattern_size, size_t size, pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point) { + return PI_SUCCESS; +} + inline pi_result mock_piTearDown(void *PluginParameter) { return PI_SUCCESS; } inline pi_result mock_piPluginGetLastError(char **message) { From 254ade7e43793531adcc84f0ffc9c98f1f69a5d4 Mon Sep 17 00:00:00 2001 From: Ben Tracy Date: Wed, 30 Aug 2023 13:03:05 +0100 Subject: [PATCH 02/23] [SYCL][Graph] Add missing fill stubs and abi symbol checks (#315) --- sycl/plugins/cuda/pi_cuda.cpp | 21 +++++++ sycl/plugins/hip/pi_hip.cpp | 21 +++++++ sycl/plugins/opencl/pi_opencl.cpp | 60 ++++++++++++++++--- .../unified_runtime/pi_unified_runtime.cpp | 21 +++++++ sycl/test/abi/pi_cuda_symbol_check.dump | 2 + sycl/test/abi/pi_hip_symbol_check.dump | 2 + sycl/test/abi/pi_level_zero_symbol_check.dump | 2 + sycl/test/abi/pi_opencl_symbol_check.dump | 2 + sycl/test/abi/sycl_symbols_linux.dump | 2 + sycl/test/abi/sycl_symbols_windows.dump | 2 + 10 files changed, 128 insertions(+), 7 deletions(-) diff --git a/sycl/plugins/cuda/pi_cuda.cpp b/sycl/plugins/cuda/pi_cuda.cpp index 94a39137ec4f7..5eb06f37b2237 100644 --- a/sycl/plugins/cuda/pi_cuda.cpp +++ b/sycl/plugins/cuda/pi_cuda.cpp @@ -1137,6 +1137,27 @@ pi_result piextCommandBufferMemBufferWriteRect( NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); } +pi_result piextCommandBufferMemBufferFill( + pi_ext_command_buffer CommandBuffer, pi_mem Buffer, const void *Pattern, + size_t PatternSize, size_t Offset, size_t Size, + pi_uint32 NumSyncPointsInWaitList, + const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint) { + return pi2ur::piextCommandBufferMemBufferFill( + CommandBuffer, Buffer, Pattern, PatternSize, Offset, Size, + NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); +} + +pi_result piextCommandBufferFillUSM(pi_ext_command_buffer CommandBuffer, + void *Ptr, const void *Pattern, + size_t PatternSize, size_t Size, + pi_uint32 NumSyncPointsInWaitList, + const pi_ext_sync_point *SyncPointWaitList, + pi_ext_sync_point *SyncPoint) { + return pi2ur::piextCommandBufferFillUSM( + CommandBuffer, Ptr, Pattern, PatternSize, Size, NumSyncPointsInWaitList, + SyncPointWaitList, SyncPoint); +} + pi_result piextEnqueueCommandBuffer(pi_ext_command_buffer CommandBuffer, pi_queue Queue, pi_uint32 NumEventsInWaitList, diff --git a/sycl/plugins/hip/pi_hip.cpp b/sycl/plugins/hip/pi_hip.cpp index 7095526dc1d34..775183d82d239 100644 --- a/sycl/plugins/hip/pi_hip.cpp +++ b/sycl/plugins/hip/pi_hip.cpp @@ -1145,6 +1145,27 @@ pi_result piextCommandBufferMemBufferWriteRect( NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); } +pi_result piextCommandBufferMemBufferFill( + pi_ext_command_buffer CommandBuffer, pi_mem Buffer, const void *Pattern, + size_t PatternSize, size_t Offset, size_t Size, + pi_uint32 NumSyncPointsInWaitList, + const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint) { + return pi2ur::piextCommandBufferMemBufferFill( + CommandBuffer, Buffer, Pattern, PatternSize, Offset, Size, + NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); +} + +pi_result piextCommandBufferFillUSM(pi_ext_command_buffer CommandBuffer, + void *Ptr, const void *Pattern, + size_t PatternSize, size_t Size, + pi_uint32 NumSyncPointsInWaitList, + const pi_ext_sync_point *SyncPointWaitList, + pi_ext_sync_point *SyncPoint) { + return pi2ur::piextCommandBufferFillUSM( + CommandBuffer, Ptr, Pattern, PatternSize, Size, NumSyncPointsInWaitList, + SyncPointWaitList, SyncPoint); +} + pi_result piextEnqueueCommandBuffer(pi_ext_command_buffer CommandBuffer, pi_queue Queue, pi_uint32 NumEventsInWaitList, diff --git a/sycl/plugins/opencl/pi_opencl.cpp b/sycl/plugins/opencl/pi_opencl.cpp index 6cc6a325af923..251255bdf48c2 100644 --- a/sycl/plugins/opencl/pi_opencl.cpp +++ b/sycl/plugins/opencl/pi_opencl.cpp @@ -1081,13 +1081,59 @@ pi_result piextCommandBufferMemBufferWriteRect( NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); } -pi_result piextEnqueueCommandBuffer(pi_ext_command_buffer CommandBuffer, - pi_queue Queue, - pi_uint32 NumEventsInWaitList, - const pi_event *EventWaitList, - pi_event *Event) { - return pi2ur::piextEnqueueCommandBuffer( - CommandBuffer, Queue, NumEventsInWaitList, EventWaitList, Event); +pi_result +piextCommandBufferMemBufferFill(pi_ext_command_buffer command_buffer, + pi_mem buffer, const void *pattern, + size_t pattern_size, size_t offset, size_t size, + pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point) { + (void)command_buffer; + (void)buffer; + (void)pattern; + (void)pattern_size; + (void)offset; + (void)size; + (void)num_sync_points_in_wait_list; + (void)sync_point_wait_list; + (void)sync_point; + + // Not implemented + return PI_ERROR_INVALID_OPERATION; +} + +pi_result +piextCommandBufferFillUSM(pi_ext_command_buffer command_buffer, void *ptr, + const void *pattern, size_t pattern_size, size_t size, + pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point) { + (void)command_buffer; + (void)ptr; + (void)pattern; + (void)pattern_size; + (void)size; + (void)num_sync_points_in_wait_list; + (void)sync_point_wait_list; + (void)sync_point; + + // Not implemented + return PI_ERROR_INVALID_OPERATION; +} + +pi_result piextEnqueueCommandBuffer(pi_ext_command_buffer command_buffer, + pi_queue queue, + pi_uint32 num_events_in_wait_list, + const pi_event *event_wait_list, + pi_event *event) { + (void)command_buffer; + (void)queue; + (void)num_events_in_wait_list; + (void)event_wait_list; + (void)event; + + // Not implemented + return PI_ERROR_INVALID_OPERATION; } pi_result piextPluginGetOpaqueData(void *opaque_data_param, diff --git a/sycl/plugins/unified_runtime/pi_unified_runtime.cpp b/sycl/plugins/unified_runtime/pi_unified_runtime.cpp index 2dd31640afb5d..0dc003c87e005 100644 --- a/sycl/plugins/unified_runtime/pi_unified_runtime.cpp +++ b/sycl/plugins/unified_runtime/pi_unified_runtime.cpp @@ -1102,6 +1102,27 @@ pi_result piextCommandBufferMemBufferWriteRect( NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); } +pi_result piextCommandBufferMemBufferFill( + pi_ext_command_buffer CommandBuffer, pi_mem Buffer, const void *Pattern, + size_t PatternSize, size_t Offset, size_t Size, + pi_uint32 NumSyncPointsInWaitList, + const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint) { + return pi2ur::piextCommandBufferMemBufferFill( + CommandBuffer, Buffer, Pattern, PatternSize, Offset, Size, + NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); +} + +pi_result piextCommandBufferFillUSM(pi_ext_command_buffer CommandBuffer, + void *Ptr, const void *Pattern, + size_t PatternSize, size_t Size, + pi_uint32 NumSyncPointsInWaitList, + const pi_ext_sync_point *SyncPointWaitList, + pi_ext_sync_point *SyncPoint) { + return pi2ur::piextCommandBufferFillUSM( + CommandBuffer, Ptr, Pattern, PatternSize, Size, NumSyncPointsInWaitList, + SyncPointWaitList, SyncPoint); +} + pi_result piextEnqueueCommandBuffer(pi_ext_command_buffer CommandBuffer, pi_queue Queue, pi_uint32 NumEventsInWaitList, diff --git a/sycl/test/abi/pi_cuda_symbol_check.dump b/sycl/test/abi/pi_cuda_symbol_check.dump index abf73cce97bd0..fcdf008702292 100644 --- a/sycl/test/abi/pi_cuda_symbol_check.dump +++ b/sycl/test/abi/pi_cuda_symbol_check.dump @@ -84,9 +84,11 @@ piSamplerRetain piTearDown piextBindlessImageSamplerCreate piextCommandBufferCreate +piextCommandBufferFillUSM piextCommandBufferFinalize piextCommandBufferMemBufferCopy piextCommandBufferMemBufferCopyRect +piextCommandBufferMemBufferFill piextCommandBufferMemBufferRead piextCommandBufferMemBufferReadRect piextCommandBufferMemBufferWrite diff --git a/sycl/test/abi/pi_hip_symbol_check.dump b/sycl/test/abi/pi_hip_symbol_check.dump index 3940b6d80677a..c0dacf2632e9b 100644 --- a/sycl/test/abi/pi_hip_symbol_check.dump +++ b/sycl/test/abi/pi_hip_symbol_check.dump @@ -84,9 +84,11 @@ piSamplerRetain piTearDown piextBindlessImageSamplerCreate piextCommandBufferCreate +piextCommandBufferFillUSM piextCommandBufferFinalize piextCommandBufferMemBufferCopy piextCommandBufferMemBufferCopyRect +piextCommandBufferMemBufferFill piextCommandBufferMemBufferRead piextCommandBufferMemBufferReadRect piextCommandBufferMemBufferWrite diff --git a/sycl/test/abi/pi_level_zero_symbol_check.dump b/sycl/test/abi/pi_level_zero_symbol_check.dump index 38b3a420b2e71..a2bd23cbf26ce 100644 --- a/sycl/test/abi/pi_level_zero_symbol_check.dump +++ b/sycl/test/abi/pi_level_zero_symbol_check.dump @@ -83,9 +83,11 @@ piSamplerRetain piTearDown piextBindlessImageSamplerCreate piextCommandBufferCreate +piextCommandBufferFillUSM piextCommandBufferFinalize piextCommandBufferMemBufferCopy piextCommandBufferMemBufferCopyRect +piextCommandBufferMemBufferFill piextCommandBufferMemBufferRead piextCommandBufferMemBufferReadRect piextCommandBufferMemBufferWrite diff --git a/sycl/test/abi/pi_opencl_symbol_check.dump b/sycl/test/abi/pi_opencl_symbol_check.dump index 11ee74902849b..8bece2c54db32 100644 --- a/sycl/test/abi/pi_opencl_symbol_check.dump +++ b/sycl/test/abi/pi_opencl_symbol_check.dump @@ -83,9 +83,11 @@ piSamplerRetain piTearDown piextBindlessImageSamplerCreate piextCommandBufferCreate +piextCommandBufferFillUSM piextCommandBufferFinalize piextCommandBufferMemBufferCopy piextCommandBufferMemBufferCopyRect +piextCommandBufferMemBufferFill piextCommandBufferMemBufferRead piextCommandBufferMemBufferReadRect piextCommandBufferMemBufferWrite diff --git a/sycl/test/abi/sycl_symbols_linux.dump b/sycl/test/abi/sycl_symbols_linux.dump index 5d1ca2b883caa..b53dad69f83ea 100644 --- a/sycl/test/abi/sycl_symbols_linux.dump +++ b/sycl/test/abi/sycl_symbols_linux.dump @@ -3925,10 +3925,12 @@ _ZN4sycl3_V16detail13MemoryManager21copy_to_device_globalEPKvbSt10shared_ptrINS1 _ZN4sycl3_V16detail13MemoryManager23copy_from_device_globalEPKvbSt10shared_ptrINS1_10queue_implEEmmPvRKSt6vectorIP9_pi_eventSaISB_EEPSB_ _ZN4sycl3_V16detail13MemoryManager23copy_from_device_globalEPKvbSt10shared_ptrINS1_10queue_implEEmmPvRKSt6vectorIP9_pi_eventSaISB_EEPSB_RKS5_INS1_10event_implEE _ZN4sycl3_V16detail13MemoryManager24allocateInteropMemObjectESt10shared_ptrINS1_12context_implEEPvRKS3_INS1_10event_implEERKS5_RKNS0_13property_listERP9_pi_event +_ZN4sycl3_V16detail13MemoryManager26ext_oneapi_fill_cmd_bufferESt10shared_ptrINS1_12context_implEEP22_pi_ext_command_bufferPNS1_11SYCLMemObjIEPvmPKcjNS0_5rangeILi3EEESE_NS0_2idILi3EEEjSt6vectorIjSaIjEEPj _ZN4sycl3_V16detail13MemoryManager29ext_oneapi_copyD2D_cmd_bufferESt10shared_ptrINS1_12context_implEEP22_pi_ext_command_bufferPNS1_11SYCLMemObjIEPvjNS0_5rangeILi3EEESC_NS0_2idILi3EEEjSA_jSC_SC_SE_jSt6vectorIjSaIjEEPj _ZN4sycl3_V16detail13MemoryManager29ext_oneapi_copyD2H_cmd_bufferESt10shared_ptrINS1_12context_implEEP22_pi_ext_command_bufferPNS1_11SYCLMemObjIEPvjNS0_5rangeILi3EEESC_NS0_2idILi3EEEjPcjSC_SE_jSt6vectorIjSaIjEEPj _ZN4sycl3_V16detail13MemoryManager29ext_oneapi_copyH2D_cmd_bufferESt10shared_ptrINS1_12context_implEEP22_pi_ext_command_bufferPNS1_11SYCLMemObjIEPcjNS0_5rangeILi3EEENS0_2idILi3EEEjPvjSC_SC_SE_jSt6vectorIjSaIjEEPj _ZN4sycl3_V16detail13MemoryManager30ext_oneapi_copy_usm_cmd_bufferESt10shared_ptrINS1_12context_implEEPKvP22_pi_ext_command_buffermPvSt6vectorIjSaIjEEPj +_ZN4sycl3_V16detail13MemoryManager30ext_oneapi_fill_usm_cmd_bufferESt10shared_ptrINS1_12context_implEEP22_pi_ext_command_bufferPvmiSt6vectorIjSaIjEEPj _ZN4sycl3_V16detail13MemoryManager3mapEPNS1_11SYCLMemObjIEPvSt10shared_ptrINS1_10queue_implEENS0_6access4modeEjNS0_5rangeILi3EEESC_NS0_2idILi3EEEjSt6vectorIP9_pi_eventSaISH_EERSH_ _ZN4sycl3_V16detail13MemoryManager4copyEPNS1_11SYCLMemObjIEPvSt10shared_ptrINS1_10queue_implEEjNS0_5rangeILi3EEESA_NS0_2idILi3EEEjS5_S8_jSA_SA_SC_jSt6vectorIP9_pi_eventSaISF_EERSF_ _ZN4sycl3_V16detail13MemoryManager4copyEPNS1_11SYCLMemObjIEPvSt10shared_ptrINS1_10queue_implEEjNS0_5rangeILi3EEESA_NS0_2idILi3EEEjS5_S8_jSA_SA_SC_jSt6vectorIP9_pi_eventSaISF_EERSF_RKS6_INS1_10event_implEE diff --git a/sycl/test/abi/sycl_symbols_windows.dump b/sycl/test/abi/sycl_symbols_windows.dump index 7e28aa4f96bbe..0b392b2a70ea8 100644 --- a/sycl/test/abi/sycl_symbols_windows.dump +++ b/sycl/test/abi/sycl_symbols_windows.dump @@ -1041,6 +1041,8 @@ ?ext_oneapi_empty@queue@_V1@sycl@@QEBA_NXZ ?ext_oneapi_enable_peer_access@device@_V1@sycl@@QEAAXAEBV123@@Z ?ext_oneapi_fill2d_impl@handler@_V1@sycl@@AEAAXPEAX_KPEBX111@Z +?ext_oneapi_fill_cmd_buffer@MemoryManager@detail@_V1@sycl@@SAXV?$shared_ptr@Vcontext_impl@detail@_V1@sycl@@@std@@PEAU_pi_ext_command_buffer@@PEAVSYCLMemObjI@234@PEAX_KPEBDIV?$range@$02@34@6V?$id@$02@34@IV?$vector@IV?$allocator@I@std@@@6@PEAI@Z +?ext_oneapi_fill_usm_cmd_buffer@MemoryManager@detail@_V1@sycl@@SAXV?$shared_ptr@Vcontext_impl@detail@_V1@sycl@@@std@@PEAU_pi_ext_command_buffer@@PEAX_KHV?$vector@IV?$allocator@I@std@@@6@PEAI@Z ?ext_oneapi_get_default_context@platform@_V1@sycl@@QEBA?AVcontext@23@XZ ?ext_oneapi_get_kernel@kernel_bundle_plain@detail@_V1@sycl@@QEAA?AVkernel@34@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z ?ext_oneapi_get_state@queue@_V1@sycl@@QEBA?AW4queue_state@experimental@oneapi@ext@23@XZ From bd096bb0946d6a77c69c19af2b4998a65e842fb8 Mon Sep 17 00:00:00 2001 From: Ben Tracy Date: Mon, 9 Oct 2023 16:13:35 +0100 Subject: [PATCH 03/23] Fix buffer_fill test, rework new node operator= checks --- sycl/test-e2e/Graph/Inputs/buffer_fill.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp b/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp index 9496abdbd6389..f6c084838011e 100644 --- a/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp +++ b/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp @@ -14,8 +14,7 @@ int main() { exp_ext::command_graph Graph{ Queue.get_context(), Queue.get_device(), - {exp_ext::property::graph::assume_buffer_outlives_graph{}, - exp_ext::property::graph::assume_data_outlives_buffer{}}}; + {exp_ext::property::graph::assume_buffer_outlives_graph{}}}; auto NodeA = add_node(Graph, Queue, [&](handler &CGH) { auto Acc = Buffer.get_access(CGH); From 3e6d3210ea352234af05e9612c25bc715da0582d Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Tue, 31 Oct 2023 16:03:28 +0000 Subject: [PATCH 04/23] Adds missing instructions for storing SyncPoint in events returned by enqueuing commands to a command-buffer. --- sycl/source/detail/scheduler/commands.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sycl/source/detail/scheduler/commands.cpp b/sycl/source/detail/scheduler/commands.cpp index a6e6aa0756262..06e4607e2d97f 100644 --- a/sycl/source/detail/scheduler/commands.cpp +++ b/sycl/source/detail/scheduler/commands.cpp @@ -2778,7 +2778,7 @@ pi_int32 ExecCGCommand::enqueueImpCommandBuffer() { AllocaCmd->getMemAllocation(), Fill->MPattern.size(), Fill->MPattern.data(), Req->MDims, Req->MMemoryRange, Req->MAccessRange, Req->MOffset, Req->MElemSize, std::move(MSyncPointDeps), &OutSyncPoint); - + MEvent->setSyncPoint(OutSyncPoint); return PI_SUCCESS; } case CG::CGTYPE::FillUSM: { @@ -2787,7 +2787,7 @@ pi_int32 ExecCGCommand::enqueueImpCommandBuffer() { MQueue->getContextImplPtr(), MCommandBuffer, Fill->getDst(), Fill->getLength(), Fill->getFill(), std::move(MSyncPointDeps), &OutSyncPoint); - + MEvent->setSyncPoint(OutSyncPoint); return PI_SUCCESS; } default: From f51fc3529268220791518837a7ad69dc5f817060 Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Mon, 4 Dec 2023 11:43:03 +0000 Subject: [PATCH 05/23] Updates tests --- sycl/test-e2e/Graph/Explicit/buffer_fill.cpp | 3 +- sycl/test-e2e/Graph/Explicit/usm_memset.cpp | 3 +- sycl/test-e2e/Graph/Inputs/buffer_fill.cpp | 61 ++++++++++++++++++- sycl/test-e2e/Graph/Inputs/usm_memset.cpp | 4 ++ .../Graph/RecordReplay/buffer_fill.cpp | 3 +- .../Graph/RecordReplay/usm_memset.cpp | 3 +- 6 files changed, 66 insertions(+), 11 deletions(-) diff --git a/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp b/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp index 8a13e4487d929..47e56d8e9db7a 100644 --- a/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp +++ b/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp @@ -1,8 +1,7 @@ -// REQUIRES: level_zero, gpu // RUN: %{build} -o %t.out // RUN: %{run} %t.out // Extra run to check for leaks in Level Zero using ZE_DEBUG -// RUN: %if ext_oneapi_level_zero %{env ZE_DEBUG=4 %{run} %t.out 2>&1 | FileCheck %s %} +// RUN: %if ext_oneapi_level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} // // CHECK-NOT: LEAK diff --git a/sycl/test-e2e/Graph/Explicit/usm_memset.cpp b/sycl/test-e2e/Graph/Explicit/usm_memset.cpp index a65fb3ba836a2..a468ece6ec886 100644 --- a/sycl/test-e2e/Graph/Explicit/usm_memset.cpp +++ b/sycl/test-e2e/Graph/Explicit/usm_memset.cpp @@ -1,8 +1,7 @@ -// REQUIRES: level_zero, gpu // RUN: %{build} -o %t.out // RUN: %{run} %t.out // Extra run to check for leaks in Level Zero using ZE_DEBUG -// RUN: %if ext_oneapi_level_zero %{env ZE_DEBUG=4 %{run} %t.out 2>&1 | FileCheck %s %} +// RUN: %if ext_oneapi_level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} // // CHECK-NOT: LEAK diff --git a/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp b/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp index f6c084838011e..d4194bdc4c77c 100644 --- a/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp +++ b/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp @@ -5,29 +5,84 @@ int main() { queue Queue; + + if (!are_graphs_supported(Queue)) { + return 0; + } + const size_t N = 10; const float Pattern = 3.14f; std::vector Data(N); - buffer Buffer(Data); + buffer Buffer{Data}; + + const uint64_t PatternI64 = 0x3333333355555555; + std::vector DataI64(N); + buffer BufferI64{DataI64}; + + const uint32_t PatternI32 = 888; + std::vector DataI32(N); + buffer BufferI32{DataI32}; + + const uint16_t PatternI16 = 777; + std::vector DataI16(N); + buffer BufferI16{DataI16}; + + const uint8_t PatternI8 = 33; + std::vector DataI8(N); + buffer BufferI8{DataI8}; + Buffer.set_write_back(false); + BufferI64.set_write_back(false); + BufferI32.set_write_back(false); + BufferI16.set_write_back(false); + BufferI8.set_write_back(false); { exp_ext::command_graph Graph{ Queue.get_context(), Queue.get_device(), {exp_ext::property::graph::assume_buffer_outlives_graph{}}}; - auto NodeA = add_node(Graph, Queue, [&](handler &CGH) { + add_node(Graph, Queue, [&](handler &CGH) { auto Acc = Buffer.get_access(CGH); CGH.fill(Acc, Pattern); }); + add_node(Graph, Queue, [&](handler &CGH) { + auto Acc = BufferI64.get_access(CGH); + CGH.fill(Acc, PatternI64); + }); + + add_node(Graph, Queue, [&](handler &CGH) { + auto Acc = BufferI32.get_access(CGH); + CGH.fill(Acc, PatternI32); + }); + + add_node(Graph, Queue, [&](handler &CGH) { + auto Acc = BufferI16.get_access(CGH); + CGH.fill(Acc, PatternI16); + }); + + add_node(Graph, Queue, [&](handler &CGH) { + auto Acc = BufferI8.get_access(CGH); + CGH.fill(Acc, PatternI8); + }); + auto ExecGraph = Graph.finalize(); Queue.submit([&](handler &CGH) { CGH.ext_oneapi_graph(ExecGraph); }).wait(); } host_accessor HostData(Buffer); - for (int i = 0; i < N; i++) + host_accessor HostDataI64(BufferI64); + host_accessor HostDataI32(BufferI32); + host_accessor HostDataI16(BufferI16); + host_accessor HostDataI8(BufferI8); + for (int i = 0; i < N; i++) { assert(HostData[i] == Pattern); + assert(HostDataI64[i] == PatternI64); + assert(HostDataI32[i] == PatternI32); + assert(HostDataI16[i] == PatternI16); + assert(HostDataI8[i] == PatternI8); + } return 0; } diff --git a/sycl/test-e2e/Graph/Inputs/usm_memset.cpp b/sycl/test-e2e/Graph/Inputs/usm_memset.cpp index 90212be27d37a..d823599921522 100644 --- a/sycl/test-e2e/Graph/Inputs/usm_memset.cpp +++ b/sycl/test-e2e/Graph/Inputs/usm_memset.cpp @@ -6,6 +6,10 @@ int main() { queue Queue; + if (!are_graphs_supported(Queue)) { + return 0; + } + exp_ext::command_graph Graph{Queue.get_context(), Queue.get_device()}; const size_t N = 10; diff --git a/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp b/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp index 770e2ad00184c..f240b7f941684 100644 --- a/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp +++ b/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp @@ -1,8 +1,7 @@ -// REQUIRES: level_zero, gpu // RUN: %{build} -o %t.out // RUN: %{run} %t.out // Extra run to check for leaks in Level Zero using ZE_DEBUG -// RUN: %if ext_oneapi_level_zero %{env ZE_DEBUG=4 %{run} %t.out 2>&1 | FileCheck %s %} +// RUN: %if ext_oneapi_level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} // // CHECK-NOT: LEAK diff --git a/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp b/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp index 35049362b0d96..0e9f49de34b2b 100644 --- a/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp +++ b/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp @@ -1,8 +1,7 @@ -// REQUIRES: level_zero, gpu // RUN: %{build} -o %t.out // RUN: %{run} %t.out // Extra run to check for leaks in Level Zero using ZE_DEBUG -// RUN: %if ext_oneapi_level_zero %{env ZE_DEBUG=4 %{run} %t.out 2>&1 | FileCheck %s %} +// RUN: %if ext_oneapi_level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} // // CHECK-NOT: LEAK From 4a1b0cb0324bf8a7aa422fe028ed87377c368b62 Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Mon, 4 Dec 2023 14:38:19 +0000 Subject: [PATCH 06/23] clang-format --- sycl/include/sycl/detail/pi.h | 24 ++++++++++++---------- sycl/test-e2e/Graph/Inputs/buffer_fill.cpp | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/sycl/include/sycl/detail/pi.h b/sycl/include/sycl/detail/pi.h index ef8249b629714..99d5048e09414 100644 --- a/sycl/include/sycl/detail/pi.h +++ b/sycl/include/sycl/detail/pi.h @@ -2475,12 +2475,13 @@ __SYCL_EXPORT pi_result piextCommandBufferMemBufferWriteRect( /// \param sync_point_wait_list A list of sync points that this command must /// wait on. /// \param sync_point The sync_point associated with this memory operation. -__SYCL_EXPORT pi_result piextCommandBufferMemBufferFill( - pi_ext_command_buffer command_buffer, pi_mem buffer, const void *pattern, - size_t pattern_size, size_t offset, size_t size, - pi_uint32 num_sync_points_in_wait_list, - const pi_ext_sync_point *sync_point_wait_list, - pi_ext_sync_point *sync_point); +__SYCL_EXPORT pi_result +piextCommandBufferMemBufferFill(pi_ext_command_buffer command_buffer, + pi_mem buffer, const void *pattern, + size_t pattern_size, size_t offset, size_t size, + pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point); /// API to append a USM fill command to the command-buffer. /// \param command_buffer The command-buffer to append onto. @@ -2493,11 +2494,12 @@ __SYCL_EXPORT pi_result piextCommandBufferMemBufferFill( /// \param sync_point_wait_list A list of sync points that this command must /// wait on. /// \param sync_point The sync_point associated with this memory operation. -__SYCL_EXPORT pi_result piextCommandBufferFillUSM( - pi_ext_command_buffer command_buffer, void *ptr, const void *pattern, - size_t pattern_size, size_t size, pi_uint32 num_sync_points_in_wait_list, - const pi_ext_sync_point *sync_point_wait_list, - pi_ext_sync_point *sync_point); +__SYCL_EXPORT pi_result +piextCommandBufferFillUSM(pi_ext_command_buffer command_buffer, void *ptr, + const void *pattern, size_t pattern_size, size_t size, + pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point); /// API to submit the command-buffer to queue for execution, returns an error if /// the command-buffer is not finalized or another instance of the same diff --git a/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp b/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp index d4194bdc4c77c..d386f7310ef6a 100644 --- a/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp +++ b/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp @@ -9,7 +9,7 @@ int main() { if (!are_graphs_supported(Queue)) { return 0; } - + const size_t N = 10; const float Pattern = 3.14f; std::vector Data(N); From d95596de6da662381c6278200ec8bf3d7e80f49f Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Mon, 4 Dec 2023 17:04:55 +0000 Subject: [PATCH 07/23] clang-format --- sycl/include/sycl/detail/pi.h | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/sycl/include/sycl/detail/pi.h b/sycl/include/sycl/detail/pi.h index 99d5048e09414..ef8249b629714 100644 --- a/sycl/include/sycl/detail/pi.h +++ b/sycl/include/sycl/detail/pi.h @@ -2475,13 +2475,12 @@ __SYCL_EXPORT pi_result piextCommandBufferMemBufferWriteRect( /// \param sync_point_wait_list A list of sync points that this command must /// wait on. /// \param sync_point The sync_point associated with this memory operation. -__SYCL_EXPORT pi_result -piextCommandBufferMemBufferFill(pi_ext_command_buffer command_buffer, - pi_mem buffer, const void *pattern, - size_t pattern_size, size_t offset, size_t size, - pi_uint32 num_sync_points_in_wait_list, - const pi_ext_sync_point *sync_point_wait_list, - pi_ext_sync_point *sync_point); +__SYCL_EXPORT pi_result piextCommandBufferMemBufferFill( + pi_ext_command_buffer command_buffer, pi_mem buffer, const void *pattern, + size_t pattern_size, size_t offset, size_t size, + pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point); /// API to append a USM fill command to the command-buffer. /// \param command_buffer The command-buffer to append onto. @@ -2494,12 +2493,11 @@ piextCommandBufferMemBufferFill(pi_ext_command_buffer command_buffer, /// \param sync_point_wait_list A list of sync points that this command must /// wait on. /// \param sync_point The sync_point associated with this memory operation. -__SYCL_EXPORT pi_result -piextCommandBufferFillUSM(pi_ext_command_buffer command_buffer, void *ptr, - const void *pattern, size_t pattern_size, size_t size, - pi_uint32 num_sync_points_in_wait_list, - const pi_ext_sync_point *sync_point_wait_list, - pi_ext_sync_point *sync_point); +__SYCL_EXPORT pi_result piextCommandBufferFillUSM( + pi_ext_command_buffer command_buffer, void *ptr, const void *pattern, + size_t pattern_size, size_t size, pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point); /// API to submit the command-buffer to queue for execution, returns an error if /// the command-buffer is not finalized or another instance of the same From 0ecb9e3276f1de9185ca9810d616d2d6bb17bb3a Mon Sep 17 00:00:00 2001 From: Ewan Crawford Date: Tue, 5 Dec 2023 12:06:53 +0000 Subject: [PATCH 08/23] Clang-format --- sycl/include/sycl/detail/pi.h | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/sycl/include/sycl/detail/pi.h b/sycl/include/sycl/detail/pi.h index 9ded674ed66f7..d045823fddb90 100644 --- a/sycl/include/sycl/detail/pi.h +++ b/sycl/include/sycl/detail/pi.h @@ -2475,12 +2475,13 @@ __SYCL_EXPORT pi_result piextCommandBufferMemBufferWriteRect( /// \param sync_point_wait_list A list of sync points that this command must /// wait on. /// \param sync_point The sync_point associated with this memory operation. -__SYCL_EXPORT pi_result piextCommandBufferMemBufferFill( - pi_ext_command_buffer command_buffer, pi_mem buffer, const void *pattern, - size_t pattern_size, size_t offset, size_t size, - pi_uint32 num_sync_points_in_wait_list, - const pi_ext_sync_point *sync_point_wait_list, - pi_ext_sync_point *sync_point); +__SYCL_EXPORT pi_result +piextCommandBufferMemBufferFill(pi_ext_command_buffer command_buffer, + pi_mem buffer, const void *pattern, + size_t pattern_size, size_t offset, size_t size, + pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point); /// API to append a USM fill command to the command-buffer. /// \param command_buffer The command-buffer to append onto. @@ -2493,11 +2494,12 @@ __SYCL_EXPORT pi_result piextCommandBufferMemBufferFill( /// \param sync_point_wait_list A list of sync points that this command must /// wait on. /// \param sync_point The sync_point associated with this memory operation. -__SYCL_EXPORT pi_result piextCommandBufferFillUSM( - pi_ext_command_buffer command_buffer, void *ptr, const void *pattern, - size_t pattern_size, size_t size, pi_uint32 num_sync_points_in_wait_list, - const pi_ext_sync_point *sync_point_wait_list, - pi_ext_sync_point *sync_point); +__SYCL_EXPORT pi_result +piextCommandBufferFillUSM(pi_ext_command_buffer command_buffer, void *ptr, + const void *pattern, size_t pattern_size, size_t size, + pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point); /// API to submit the command-buffer to queue for execution, returns an error if /// the command-buffer is not finalized or another instance of the same From f5d2a958a51fd08100c46be7b61fb94eea230e09 Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Tue, 5 Dec 2023 14:10:57 +0000 Subject: [PATCH 09/23] Adds OpenCL limitation --- sycl/doc/design/CommandGraph.md | 2 ++ sycl/test-e2e/Graph/Explicit/usm_memset.cpp | 3 +++ sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp | 3 +++ 3 files changed, 8 insertions(+) diff --git a/sycl/doc/design/CommandGraph.md b/sycl/doc/design/CommandGraph.md index b6b1876696c7e..a7e7f44c67ce2 100644 --- a/sycl/doc/design/CommandGraph.md +++ b/sycl/doc/design/CommandGraph.md @@ -284,6 +284,8 @@ The types of commands which are unsupported, and lead to this exception are: This corresponds to a memory buffer write command. * `handler::copy(src, dest)` or `handler::memcpy(dest, src)` - Where both `src` and `dest` are USM pointers. This corresponds to a USM copy command. +* handler::memset(ptr, value, numBytes) - This corresponds to a memory USM + fill command. Note that `handler::copy(src, dest)` where both `src` and `dest` are an accessor is supported, as a memory buffer copy command exists in the OpenCL extension. diff --git a/sycl/test-e2e/Graph/Explicit/usm_memset.cpp b/sycl/test-e2e/Graph/Explicit/usm_memset.cpp index a468ece6ec886..819c31d9154a3 100644 --- a/sycl/test-e2e/Graph/Explicit/usm_memset.cpp +++ b/sycl/test-e2e/Graph/Explicit/usm_memset.cpp @@ -5,6 +5,9 @@ // // CHECK-NOT: LEAK +// USM memset command not supported for OpenCL +// UNSUPPORTED: opencl + #define GRAPH_E2E_EXPLICIT #include "../Inputs/usm_memset.cpp" diff --git a/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp b/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp index 0e9f49de34b2b..c201c3cbfd0d4 100644 --- a/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp +++ b/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp @@ -5,6 +5,9 @@ // // CHECK-NOT: LEAK +// USM memset command not supported for OpenCL +// UNSUPPORTED: opencl + #define GRAPH_E2E_RECORD_REPLAY #include "../Inputs/usm_memset.cpp" From d129579cc21aeca6c1106a22a818d84513af5d92 Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Wed, 6 Dec 2023 15:34:14 +0000 Subject: [PATCH 10/23] Update sycl/doc/design/CommandGraph.md Co-authored-by: Ewan Crawford --- sycl/doc/design/CommandGraph.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/doc/design/CommandGraph.md b/sycl/doc/design/CommandGraph.md index a7e7f44c67ce2..45e3a4ba03ff9 100644 --- a/sycl/doc/design/CommandGraph.md +++ b/sycl/doc/design/CommandGraph.md @@ -284,7 +284,7 @@ The types of commands which are unsupported, and lead to this exception are: This corresponds to a memory buffer write command. * `handler::copy(src, dest)` or `handler::memcpy(dest, src)` - Where both `src` and `dest` are USM pointers. This corresponds to a USM copy command. -* handler::memset(ptr, value, numBytes) - This corresponds to a memory USM +* `handler::memset(ptr, value, numBytes)` - This corresponds to a USM memory fill command. Note that `handler::copy(src, dest)` where both `src` and `dest` are an accessor From 44cb34c21006b076402866554afbf6a7a5f10ec0 Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Wed, 6 Dec 2023 16:52:30 +0000 Subject: [PATCH 11/23] Moves OpenCL stubs to UR --- sycl/plugins/opencl/pi_opencl.cpp | 77 +++++++++++-------------------- 1 file changed, 26 insertions(+), 51 deletions(-) diff --git a/sycl/plugins/opencl/pi_opencl.cpp b/sycl/plugins/opencl/pi_opencl.cpp index 251255bdf48c2..7512d411144ab 100644 --- a/sycl/plugins/opencl/pi_opencl.cpp +++ b/sycl/plugins/opencl/pi_opencl.cpp @@ -1081,59 +1081,34 @@ pi_result piextCommandBufferMemBufferWriteRect( NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); } -pi_result -piextCommandBufferMemBufferFill(pi_ext_command_buffer command_buffer, - pi_mem buffer, const void *pattern, - size_t pattern_size, size_t offset, size_t size, - pi_uint32 num_sync_points_in_wait_list, - const pi_ext_sync_point *sync_point_wait_list, - pi_ext_sync_point *sync_point) { - (void)command_buffer; - (void)buffer; - (void)pattern; - (void)pattern_size; - (void)offset; - (void)size; - (void)num_sync_points_in_wait_list; - (void)sync_point_wait_list; - (void)sync_point; - - // Not implemented - return PI_ERROR_INVALID_OPERATION; +pi_result piextCommandBufferMemBufferFill( + pi_ext_command_buffer CommandBuffer, pi_mem Buffer, const void *Pattern, + size_t PatternSize, size_t Offset, size_t Size, + pi_uint32 NumSyncPointsInWaitList, + const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint) { + return pi2ur::piextCommandBufferMemBufferFill( + CommandBuffer, Buffer, Pattern, PatternSize, Offset, Size, + NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); } -pi_result -piextCommandBufferFillUSM(pi_ext_command_buffer command_buffer, void *ptr, - const void *pattern, size_t pattern_size, size_t size, - pi_uint32 num_sync_points_in_wait_list, - const pi_ext_sync_point *sync_point_wait_list, - pi_ext_sync_point *sync_point) { - (void)command_buffer; - (void)ptr; - (void)pattern; - (void)pattern_size; - (void)size; - (void)num_sync_points_in_wait_list; - (void)sync_point_wait_list; - (void)sync_point; - - // Not implemented - return PI_ERROR_INVALID_OPERATION; -} - -pi_result piextEnqueueCommandBuffer(pi_ext_command_buffer command_buffer, - pi_queue queue, - pi_uint32 num_events_in_wait_list, - const pi_event *event_wait_list, - pi_event *event) { - (void)command_buffer; - (void)queue; - (void)num_events_in_wait_list; - (void)event_wait_list; - (void)event; - - // Not implemented - return PI_ERROR_INVALID_OPERATION; +pi_result piextCommandBufferFillUSM(pi_ext_command_buffer CommandBuffer, + void *Ptr, const void *Pattern, + size_t PatternSize, size_t Size, + pi_uint32 NumSyncPointsInWaitList, + const pi_ext_sync_point *SyncPointWaitList, + pi_ext_sync_point *SyncPoint) { + return pi2ur::piextCommandBufferFillUSM( + CommandBuffer, Ptr, Pattern, PatternSize, Size, NumSyncPointsInWaitList, + SyncPointWaitList, SyncPoint); +} + +pi_result piextEnqueueCommandBuffer(pi_ext_command_buffer CommandBuffer, + pi_queue Queue, + pi_uint32 NumEventsInWaitList, + const pi_event *EventWaitList, + pi_event *Event) { + return pi2ur::piextEnqueueCommandBuffer( + CommandBuffer, Queue, NumEventsInWaitList, EventWaitList, Event); } pi_result piextPluginGetOpaqueData(void *opaque_data_param, From b74eba08b6d74f6196aa19cbe895d3ce707ac75d Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Thu, 7 Dec 2023 09:41:53 +0000 Subject: [PATCH 12/23] Update sycl/test-e2e/Graph/Explicit/usm_memset.cpp Co-authored-by: Ewan Crawford --- sycl/test-e2e/Graph/Explicit/usm_memset.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/test-e2e/Graph/Explicit/usm_memset.cpp b/sycl/test-e2e/Graph/Explicit/usm_memset.cpp index 819c31d9154a3..735963f3c50e7 100644 --- a/sycl/test-e2e/Graph/Explicit/usm_memset.cpp +++ b/sycl/test-e2e/Graph/Explicit/usm_memset.cpp @@ -1,6 +1,6 @@ // RUN: %{build} -o %t.out // RUN: %{run} %t.out -// Extra run to check for leaks in Level Zero using ZE_DEBUG +// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG // RUN: %if ext_oneapi_level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} // // CHECK-NOT: LEAK From 6918b83d6e537678355e45d6b72bc3755276c53a Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Thu, 7 Dec 2023 09:42:01 +0000 Subject: [PATCH 13/23] Update sycl/test-e2e/Graph/Explicit/buffer_fill.cpp Co-authored-by: Ewan Crawford --- sycl/test-e2e/Graph/Explicit/buffer_fill.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp b/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp index 47e56d8e9db7a..1893f9cbde707 100644 --- a/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp +++ b/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp @@ -1,6 +1,6 @@ // RUN: %{build} -o %t.out // RUN: %{run} %t.out -// Extra run to check for leaks in Level Zero using ZE_DEBUG +// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG // RUN: %if ext_oneapi_level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} // // CHECK-NOT: LEAK From e8c3407a373879a4d766583ee1c38d8d9a9725d1 Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Thu, 7 Dec 2023 09:42:09 +0000 Subject: [PATCH 14/23] Update sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp Co-authored-by: Ewan Crawford --- sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp b/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp index c201c3cbfd0d4..064068762ed38 100644 --- a/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp +++ b/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp @@ -1,6 +1,6 @@ // RUN: %{build} -o %t.out // RUN: %{run} %t.out -// Extra run to check for leaks in Level Zero using ZE_DEBUG +// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG // RUN: %if ext_oneapi_level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} // // CHECK-NOT: LEAK From aa28d33179938d64c13e7841b6846cceb0a2e46e Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Thu, 7 Dec 2023 09:42:15 +0000 Subject: [PATCH 15/23] Update sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp Co-authored-by: Ewan Crawford --- sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp b/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp index f240b7f941684..215846d28481a 100644 --- a/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp +++ b/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp @@ -1,6 +1,6 @@ // RUN: %{build} -o %t.out // RUN: %{run} %t.out -// Extra run to check for leaks in Level Zero using ZE_DEBUG +// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG // RUN: %if ext_oneapi_level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} // // CHECK-NOT: LEAK From cb6c5c28fd854b1076ec7b921c8a52f0f5dc19a0 Mon Sep 17 00:00:00 2001 From: Ewan Crawford Date: Thu, 4 Jan 2024 07:16:26 +0000 Subject: [PATCH 16/23] Fix clang-format and increment PI minor version --- sycl/include/sycl/detail/pi.h | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/sycl/include/sycl/detail/pi.h b/sycl/include/sycl/detail/pi.h index d045823fddb90..c5c2dcf4fb186 100644 --- a/sycl/include/sycl/detail/pi.h +++ b/sycl/include/sycl/detail/pi.h @@ -146,9 +146,10 @@ // 14.37 Added piextUSMImportExternalPointer and piextUSMReleaseImportedPointer. // 14.38 Change PI_MEM_ADVICE_* values to flags for use in bitwise operations. // 14.39 Added PI_EXT_INTEL_DEVICE_INFO_ESIMD_SUPPORT device info query. +// 14.40 Added piextCommandBufferMemBufferFill & piextCommandBufferFillUSM #define _PI_H_VERSION_MAJOR 14 -#define _PI_H_VERSION_MINOR 39 +#define _PI_H_VERSION_MINOR 40 #define _PI_STRING_HELPER(a) #a #define _PI_CONCAT(a, b) _PI_STRING_HELPER(a.b) @@ -2475,13 +2476,12 @@ __SYCL_EXPORT pi_result piextCommandBufferMemBufferWriteRect( /// \param sync_point_wait_list A list of sync points that this command must /// wait on. /// \param sync_point The sync_point associated with this memory operation. -__SYCL_EXPORT pi_result -piextCommandBufferMemBufferFill(pi_ext_command_buffer command_buffer, - pi_mem buffer, const void *pattern, - size_t pattern_size, size_t offset, size_t size, - pi_uint32 num_sync_points_in_wait_list, - const pi_ext_sync_point *sync_point_wait_list, - pi_ext_sync_point *sync_point); +__SYCL_EXPORT pi_result piextCommandBufferMemBufferFill( + pi_ext_command_buffer command_buffer, pi_mem buffer, const void *pattern, + size_t pattern_size, size_t offset, size_t size, + pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point); /// API to append a USM fill command to the command-buffer. /// \param command_buffer The command-buffer to append onto. @@ -2494,12 +2494,11 @@ piextCommandBufferMemBufferFill(pi_ext_command_buffer command_buffer, /// \param sync_point_wait_list A list of sync points that this command must /// wait on. /// \param sync_point The sync_point associated with this memory operation. -__SYCL_EXPORT pi_result -piextCommandBufferFillUSM(pi_ext_command_buffer command_buffer, void *ptr, - const void *pattern, size_t pattern_size, size_t size, - pi_uint32 num_sync_points_in_wait_list, - const pi_ext_sync_point *sync_point_wait_list, - pi_ext_sync_point *sync_point); +__SYCL_EXPORT pi_result piextCommandBufferFillUSM( + pi_ext_command_buffer command_buffer, void *ptr, const void *pattern, + size_t pattern_size, size_t size, pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point); /// API to submit the command-buffer to queue for execution, returns an error if /// the command-buffer is not finalized or another instance of the same From 602ffe76d23107972f37ced82ad9421a31fd3ddf Mon Sep 17 00:00:00 2001 From: Ewan Crawford Date: Thu, 4 Jan 2024 09:41:42 +0000 Subject: [PATCH 17/23] Revert formatting change --- sycl/include/sycl/detail/pi.h | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/sycl/include/sycl/detail/pi.h b/sycl/include/sycl/detail/pi.h index c5c2dcf4fb186..89ee5735c23d1 100644 --- a/sycl/include/sycl/detail/pi.h +++ b/sycl/include/sycl/detail/pi.h @@ -2476,12 +2476,13 @@ __SYCL_EXPORT pi_result piextCommandBufferMemBufferWriteRect( /// \param sync_point_wait_list A list of sync points that this command must /// wait on. /// \param sync_point The sync_point associated with this memory operation. -__SYCL_EXPORT pi_result piextCommandBufferMemBufferFill( - pi_ext_command_buffer command_buffer, pi_mem buffer, const void *pattern, - size_t pattern_size, size_t offset, size_t size, - pi_uint32 num_sync_points_in_wait_list, - const pi_ext_sync_point *sync_point_wait_list, - pi_ext_sync_point *sync_point); +__SYCL_EXPORT pi_result +piextCommandBufferMemBufferFill(pi_ext_command_buffer command_buffer, + pi_mem buffer, const void *pattern, + size_t pattern_size, size_t offset, size_t size, + pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point); /// API to append a USM fill command to the command-buffer. /// \param command_buffer The command-buffer to append onto. @@ -2494,11 +2495,12 @@ __SYCL_EXPORT pi_result piextCommandBufferMemBufferFill( /// \param sync_point_wait_list A list of sync points that this command must /// wait on. /// \param sync_point The sync_point associated with this memory operation. -__SYCL_EXPORT pi_result piextCommandBufferFillUSM( - pi_ext_command_buffer command_buffer, void *ptr, const void *pattern, - size_t pattern_size, size_t size, pi_uint32 num_sync_points_in_wait_list, - const pi_ext_sync_point *sync_point_wait_list, - pi_ext_sync_point *sync_point); +__SYCL_EXPORT pi_result +piextCommandBufferFillUSM(pi_ext_command_buffer command_buffer, void *ptr, + const void *pattern, size_t pattern_size, size_t size, + pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point); /// API to submit the command-buffer to queue for execution, returns an error if /// the command-buffer is not finalized or another instance of the same From 246af5e2cdf2039e3319ec9b499d3e27341f7a03 Mon Sep 17 00:00:00 2001 From: Ewan Crawford Date: Thu, 4 Jan 2024 14:22:49 +0000 Subject: [PATCH 18/23] Update tests --- sycl/test-e2e/Graph/Explicit/buffer_fill.cpp | 5 ++++- sycl/test-e2e/Graph/Explicit/usm_memset.cpp | 2 +- sycl/test-e2e/Graph/Inputs/buffer_fill.cpp | 2 +- sycl/test-e2e/Graph/Inputs/usm_memset.cpp | 2 +- sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp | 5 ++++- sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp b/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp index 1893f9cbde707..039c4557ebf36 100644 --- a/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp +++ b/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp @@ -1,9 +1,12 @@ // RUN: %{build} -o %t.out // RUN: %{run} %t.out // Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG -// RUN: %if ext_oneapi_level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} +// RUN: %if level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} // // CHECK-NOT: LEAK +// +// TODO enable cuda once buffer issue investigated and fixed +// UNSUPPORTED: cuda #define GRAPH_E2E_EXPLICIT diff --git a/sycl/test-e2e/Graph/Explicit/usm_memset.cpp b/sycl/test-e2e/Graph/Explicit/usm_memset.cpp index 735963f3c50e7..87bf1ef4ba5c5 100644 --- a/sycl/test-e2e/Graph/Explicit/usm_memset.cpp +++ b/sycl/test-e2e/Graph/Explicit/usm_memset.cpp @@ -1,7 +1,7 @@ // RUN: %{build} -o %t.out // RUN: %{run} %t.out // Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG -// RUN: %if ext_oneapi_level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} +// RUN: %if level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} // // CHECK-NOT: LEAK diff --git a/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp b/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp index d386f7310ef6a..351194dadda0f 100644 --- a/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp +++ b/sycl/test-e2e/Graph/Inputs/buffer_fill.cpp @@ -4,7 +4,7 @@ int main() { - queue Queue; + queue Queue{{sycl::ext::intel::property::queue::no_immediate_command_list{}}}; if (!are_graphs_supported(Queue)) { return 0; diff --git a/sycl/test-e2e/Graph/Inputs/usm_memset.cpp b/sycl/test-e2e/Graph/Inputs/usm_memset.cpp index d823599921522..f357b9b3a5adf 100644 --- a/sycl/test-e2e/Graph/Inputs/usm_memset.cpp +++ b/sycl/test-e2e/Graph/Inputs/usm_memset.cpp @@ -4,7 +4,7 @@ int main() { - queue Queue; + queue Queue{{sycl::ext::intel::property::queue::no_immediate_command_list{}}}; if (!are_graphs_supported(Queue)) { return 0; diff --git a/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp b/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp index 215846d28481a..f402dcb6015a7 100644 --- a/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp +++ b/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp @@ -1,9 +1,12 @@ // RUN: %{build} -o %t.out // RUN: %{run} %t.out // Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG -// RUN: %if ext_oneapi_level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} +// RUN: %if level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} // // CHECK-NOT: LEAK +// +// TODO enable cuda once buffer issue investigated and fixed +// UNSUPPORTED: cuda #define GRAPH_E2E_RECORD_REPLAY diff --git a/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp b/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp index 064068762ed38..68214c5ec3339 100644 --- a/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp +++ b/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp @@ -1,7 +1,7 @@ // RUN: %{build} -o %t.out // RUN: %{run} %t.out // Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG -// RUN: %if ext_oneapi_level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} +// RUN: %if level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} // // CHECK-NOT: LEAK From 1441e220b5be2b93eee78424e8472843ad6f0240 Mon Sep 17 00:00:00 2001 From: Ewan Crawford Date: Thu, 4 Jan 2024 18:26:32 +0000 Subject: [PATCH 19/23] another clang-format attempt --- sycl/include/sycl/detail/pi.h | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/sycl/include/sycl/detail/pi.h b/sycl/include/sycl/detail/pi.h index 89ee5735c23d1..c5c2dcf4fb186 100644 --- a/sycl/include/sycl/detail/pi.h +++ b/sycl/include/sycl/detail/pi.h @@ -2476,13 +2476,12 @@ __SYCL_EXPORT pi_result piextCommandBufferMemBufferWriteRect( /// \param sync_point_wait_list A list of sync points that this command must /// wait on. /// \param sync_point The sync_point associated with this memory operation. -__SYCL_EXPORT pi_result -piextCommandBufferMemBufferFill(pi_ext_command_buffer command_buffer, - pi_mem buffer, const void *pattern, - size_t pattern_size, size_t offset, size_t size, - pi_uint32 num_sync_points_in_wait_list, - const pi_ext_sync_point *sync_point_wait_list, - pi_ext_sync_point *sync_point); +__SYCL_EXPORT pi_result piextCommandBufferMemBufferFill( + pi_ext_command_buffer command_buffer, pi_mem buffer, const void *pattern, + size_t pattern_size, size_t offset, size_t size, + pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point); /// API to append a USM fill command to the command-buffer. /// \param command_buffer The command-buffer to append onto. @@ -2495,12 +2494,11 @@ piextCommandBufferMemBufferFill(pi_ext_command_buffer command_buffer, /// \param sync_point_wait_list A list of sync points that this command must /// wait on. /// \param sync_point The sync_point associated with this memory operation. -__SYCL_EXPORT pi_result -piextCommandBufferFillUSM(pi_ext_command_buffer command_buffer, void *ptr, - const void *pattern, size_t pattern_size, size_t size, - pi_uint32 num_sync_points_in_wait_list, - const pi_ext_sync_point *sync_point_wait_list, - pi_ext_sync_point *sync_point); +__SYCL_EXPORT pi_result piextCommandBufferFillUSM( + pi_ext_command_buffer command_buffer, void *ptr, const void *pattern, + size_t pattern_size, size_t size, pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point); /// API to submit the command-buffer to queue for execution, returns an error if /// the command-buffer is not finalized or another instance of the same From e01b237670fb2546b46e5ea192a723213874b179 Mon Sep 17 00:00:00 2001 From: Ewan Crawford Date: Fri, 5 Jan 2024 11:10:41 +0000 Subject: [PATCH 20/23] Use old formatting style --- sycl/include/sycl/detail/pi.h | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/sycl/include/sycl/detail/pi.h b/sycl/include/sycl/detail/pi.h index c5c2dcf4fb186..89ee5735c23d1 100644 --- a/sycl/include/sycl/detail/pi.h +++ b/sycl/include/sycl/detail/pi.h @@ -2476,12 +2476,13 @@ __SYCL_EXPORT pi_result piextCommandBufferMemBufferWriteRect( /// \param sync_point_wait_list A list of sync points that this command must /// wait on. /// \param sync_point The sync_point associated with this memory operation. -__SYCL_EXPORT pi_result piextCommandBufferMemBufferFill( - pi_ext_command_buffer command_buffer, pi_mem buffer, const void *pattern, - size_t pattern_size, size_t offset, size_t size, - pi_uint32 num_sync_points_in_wait_list, - const pi_ext_sync_point *sync_point_wait_list, - pi_ext_sync_point *sync_point); +__SYCL_EXPORT pi_result +piextCommandBufferMemBufferFill(pi_ext_command_buffer command_buffer, + pi_mem buffer, const void *pattern, + size_t pattern_size, size_t offset, size_t size, + pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point); /// API to append a USM fill command to the command-buffer. /// \param command_buffer The command-buffer to append onto. @@ -2494,11 +2495,12 @@ __SYCL_EXPORT pi_result piextCommandBufferMemBufferFill( /// \param sync_point_wait_list A list of sync points that this command must /// wait on. /// \param sync_point The sync_point associated with this memory operation. -__SYCL_EXPORT pi_result piextCommandBufferFillUSM( - pi_ext_command_buffer command_buffer, void *ptr, const void *pattern, - size_t pattern_size, size_t size, pi_uint32 num_sync_points_in_wait_list, - const pi_ext_sync_point *sync_point_wait_list, - pi_ext_sync_point *sync_point); +__SYCL_EXPORT pi_result +piextCommandBufferFillUSM(pi_ext_command_buffer command_buffer, void *ptr, + const void *pattern, size_t pattern_size, size_t size, + pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point); /// API to submit the command-buffer to queue for execution, returns an error if /// the command-buffer is not finalized or another instance of the same From a7ad2df7e6f7b8458c0e34b2f4d0de109a472a36 Mon Sep 17 00:00:00 2001 From: Ewan Crawford Date: Tue, 9 Jan 2024 10:52:32 +0000 Subject: [PATCH 21/23] Address PR review feedback --- sycl/doc/design/CommandGraph.md | 4 ++-- sycl/include/sycl/detail/pi.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sycl/doc/design/CommandGraph.md b/sycl/doc/design/CommandGraph.md index 8ad1b57c444d4..fed89532ff7ce 100644 --- a/sycl/doc/design/CommandGraph.md +++ b/sycl/doc/design/CommandGraph.md @@ -37,14 +37,14 @@ with the following entry-points: | `urCommandBufferFinalizeExp` | No more commands can be appended, makes command-buffer ready to enqueue on a command-queue. | | `urCommandBufferAppendKernelLaunchExp` | Append a kernel execution command to command-buffer. | | `urCommandBufferAppendUSMMemcpyExp` | Append a USM memcpy command to the command-buffer. | -| `urCommandBufferAppendUSMFillExp` | Append a USM fill command to the command-buffer. | +| `urCommandBufferAppendUSMFillExp` | Append a USM fill command to the command-buffer. | | `urCommandBufferAppendMemBufferCopyExp` | Append a mem buffer copy command to the command-buffer. | | `urCommandBufferAppendMemBufferWriteExp` | Append a memory write command to a command-buffer object. | | `urCommandBufferAppendMemBufferReadExp` | Append a memory read command to a command-buffer object. | | `urCommandBufferAppendMemBufferCopyRectExp` | Append a rectangular memory copy command to a command-buffer object. | | `urCommandBufferAppendMemBufferWriteRectExp` | Append a rectangular memory write command to a command-buffer object. | | `urCommandBufferAppendMemBufferReadRectExp` | Append a rectangular memory read command to a command-buffer object. | -| `urCommandBufferAppendMemBufferFillExp` | Append a memory fill command to a command-buffer object. | +| `urCommandBufferAppendMemBufferFillExp` | Append a memory fill command to a command-buffer object. | | `urCommandBufferEnqueueExp` | Submit command-buffer to a command-queue for execution. | See the [UR EXP-COMMAND-BUFFER](https://oneapi-src.github.io/unified-runtime/core/EXP-COMMAND-BUFFER.html) diff --git a/sycl/include/sycl/detail/pi.h b/sycl/include/sycl/detail/pi.h index 89ee5735c23d1..234897b1e9533 100644 --- a/sycl/include/sycl/detail/pi.h +++ b/sycl/include/sycl/detail/pi.h @@ -2466,7 +2466,7 @@ __SYCL_EXPORT pi_result piextCommandBufferMemBufferWriteRect( /// API to append a mem buffer fill command to the command-buffer. /// \param command_buffer The command-buffer to append onto. -/// \param buffer is the location to fill the data +/// \param buffer is the location to fill the data. /// \param pattern pointer to the pattern to fill the buffer with. /// \param pattern_size size of the pattern in bytes. /// \param offset Offset into the buffer to fill from. From ace26ed46fc685569cb530c9d2efd8f095ba98c6 Mon Sep 17 00:00:00 2001 From: Ewan Crawford Date: Tue, 9 Jan 2024 12:18:41 +0000 Subject: [PATCH 22/23] Use new clang-formatting --- sycl/include/sycl/detail/pi.h | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/sycl/include/sycl/detail/pi.h b/sycl/include/sycl/detail/pi.h index 234897b1e9533..655d92cfe5c49 100644 --- a/sycl/include/sycl/detail/pi.h +++ b/sycl/include/sycl/detail/pi.h @@ -2476,13 +2476,12 @@ __SYCL_EXPORT pi_result piextCommandBufferMemBufferWriteRect( /// \param sync_point_wait_list A list of sync points that this command must /// wait on. /// \param sync_point The sync_point associated with this memory operation. -__SYCL_EXPORT pi_result -piextCommandBufferMemBufferFill(pi_ext_command_buffer command_buffer, - pi_mem buffer, const void *pattern, - size_t pattern_size, size_t offset, size_t size, - pi_uint32 num_sync_points_in_wait_list, - const pi_ext_sync_point *sync_point_wait_list, - pi_ext_sync_point *sync_point); +__SYCL_EXPORT pi_result piextCommandBufferMemBufferFill( + pi_ext_command_buffer command_buffer, pi_mem buffer, const void *pattern, + size_t pattern_size, size_t offset, size_t size, + pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point); /// API to append a USM fill command to the command-buffer. /// \param command_buffer The command-buffer to append onto. @@ -2495,12 +2494,11 @@ piextCommandBufferMemBufferFill(pi_ext_command_buffer command_buffer, /// \param sync_point_wait_list A list of sync points that this command must /// wait on. /// \param sync_point The sync_point associated with this memory operation. -__SYCL_EXPORT pi_result -piextCommandBufferFillUSM(pi_ext_command_buffer command_buffer, void *ptr, - const void *pattern, size_t pattern_size, size_t size, - pi_uint32 num_sync_points_in_wait_list, - const pi_ext_sync_point *sync_point_wait_list, - pi_ext_sync_point *sync_point); +__SYCL_EXPORT pi_result piextCommandBufferFillUSM( + pi_ext_command_buffer command_buffer, void *ptr, const void *pattern, + size_t pattern_size, size_t size, pi_uint32 num_sync_points_in_wait_list, + const pi_ext_sync_point *sync_point_wait_list, + pi_ext_sync_point *sync_point); /// API to submit the command-buffer to queue for execution, returns an error if /// the command-buffer is not finalized or another instance of the same From 4cae6f2c59d097b26c2a07c8d24b366207a11060 Mon Sep 17 00:00:00 2001 From: Ewan Crawford Date: Tue, 9 Jan 2024 14:45:55 +0000 Subject: [PATCH 23/23] Use `FileCheck --implicit-check-not=LEAK` --- sycl/test-e2e/Graph/Explicit/buffer_fill.cpp | 4 +--- sycl/test-e2e/Graph/Explicit/usm_memset.cpp | 4 +--- sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp | 4 +--- sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp | 4 +--- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp b/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp index 039c4557ebf36..73b961994a72b 100644 --- a/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp +++ b/sycl/test-e2e/Graph/Explicit/buffer_fill.cpp @@ -1,9 +1,7 @@ // RUN: %{build} -o %t.out // RUN: %{run} %t.out // Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG -// RUN: %if level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} -// -// CHECK-NOT: LEAK +// RUN: %if level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck --implicit-check-not=LEAK %s %} // // TODO enable cuda once buffer issue investigated and fixed // UNSUPPORTED: cuda diff --git a/sycl/test-e2e/Graph/Explicit/usm_memset.cpp b/sycl/test-e2e/Graph/Explicit/usm_memset.cpp index 87bf1ef4ba5c5..a8a42abc1acd0 100644 --- a/sycl/test-e2e/Graph/Explicit/usm_memset.cpp +++ b/sycl/test-e2e/Graph/Explicit/usm_memset.cpp @@ -1,9 +1,7 @@ // RUN: %{build} -o %t.out // RUN: %{run} %t.out // Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG -// RUN: %if level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} -// -// CHECK-NOT: LEAK +// RUN: %if level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck --implicit-check-not=LEAK %s %} // USM memset command not supported for OpenCL // UNSUPPORTED: opencl diff --git a/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp b/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp index f402dcb6015a7..91729ace49742 100644 --- a/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp +++ b/sycl/test-e2e/Graph/RecordReplay/buffer_fill.cpp @@ -1,9 +1,7 @@ // RUN: %{build} -o %t.out // RUN: %{run} %t.out // Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG -// RUN: %if level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} -// -// CHECK-NOT: LEAK +// RUN: %if level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck --implicit-check-not=LEAK %s %} // // TODO enable cuda once buffer issue investigated and fixed // UNSUPPORTED: cuda diff --git a/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp b/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp index 68214c5ec3339..acbb0a502c67f 100644 --- a/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp +++ b/sycl/test-e2e/Graph/RecordReplay/usm_memset.cpp @@ -1,9 +1,7 @@ // RUN: %{build} -o %t.out // RUN: %{run} %t.out // Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG -// RUN: %if level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %} -// -// CHECK-NOT: LEAK +// RUN: %if level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck --implicit-check-not=LEAK %s %} // USM memset command not supported for OpenCL // UNSUPPORTED: opencl