From 48b70e8952494870c87f2dfd3f65991f24a1a5c9 Mon Sep 17 00:00:00 2001 From: Konrad Kusiak Date: Mon, 6 May 2024 09:21:39 +0100 Subject: [PATCH 01/12] Copied PR changes --- .github/workflows/sycl-linux-run-tests.yml | 7 ++++++- devops/dependencies-igc-dev.json | 8 ++++---- devops/scripts/install_drivers.sh | 2 ++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sycl-linux-run-tests.yml b/.github/workflows/sycl-linux-run-tests.yml index 82e4493222ec3..ee3701d338527 100644 --- a/.github/workflows/sycl-linux-run-tests.yml +++ b/.github/workflows/sycl-linux-run-tests.yml @@ -192,7 +192,8 @@ jobs: GITHUB_TOKEN: ${{ github.token }} run: | if [ "${{ inputs.use_dev_igc }}" = "true" ]; then - sudo apt-get install -yqq libllvm14; + # If libllvm14 is already installed (dev igc docker), still return true. + sudo apt-get install -yqq libllvm14 || true; fi sudo -E bash devops/scripts/install_drivers.sh llvm/devops/dependencies.json ${{ inputs.use_dev_igc == 'true' && 'llvm/devops/dependencies-igc-dev.json --use-dev-igc' || '' }} --all - name: Source OneAPI TBB vars.sh @@ -261,6 +262,10 @@ jobs: - run: which clang++ sycl-ls - run: sycl-ls --verbose - run: SYCL_PI_TRACE=-1 sycl-ls + - run: | + if [ -f /usr/local/lib/igc/IGCTAG.txt ]; then + cat /usr/local/lib/igc/IGCTAG.txt + fi - name: Deduce E2E CMake options if: inputs.tests_selector == 'e2e' diff --git a/devops/dependencies-igc-dev.json b/devops/dependencies-igc-dev.json index d49b3bedfa16a..d3f3e2b083534 100644 --- a/devops/dependencies-igc-dev.json +++ b/devops/dependencies-igc-dev.json @@ -1,10 +1,10 @@ { "linux": { "igc_dev": { - "github_tag": "igc-dev-41e87ac", - "version": "41e87ac", - "updated_at": "2024-05-02T11:47:42Z", - "url": "https://api.github.com/repos/intel/intel-graphics-compiler/actions/artifacts/1466894014/zip", + "github_tag": "igc-dev-b906329", + "version": "b906329", + "updated_at": "2024-05-04T22:39:56Z", + "url": "https://api.github.com/repos/intel/intel-graphics-compiler/actions/artifacts/1473544965/zip", "root": "{DEPS_ROOT}/opencl/runtime/linux/oclgpu" } } diff --git a/devops/scripts/install_drivers.sh b/devops/scripts/install_drivers.sh index 81ec1f69c4115..2b73abc7056af 100755 --- a/devops/scripts/install_drivers.sh +++ b/devops/scripts/install_drivers.sh @@ -132,6 +132,7 @@ InstallIGFX () { | wget -qi - dpkg -i *.deb && rm *.deb *.sum IS_IGC_DEV=$(CheckIGCdevTag $IGCTAG) + echo "$IGC_TAG" > /usr/local/lib/igc/IGCTAG.txt if [ "$IS_IGC_DEV" == "Yes" ]; then # Dev IGC deb package did not include libopencl-clang # opencl-clang repo does not provide release deb package either. @@ -148,6 +149,7 @@ InstallIGFX () { cp -d libopencl-clang.so.14* /usr/local/lib/ echo "Clean up" rm *.deb libopencl-clang.so.14* + echo "$IGC_DEV_TAG" > /usr/local/lib/igc/IGCTAG.txt fi } From d5565da684f70dbb1157fd17d51f079d12aced5f Mon Sep 17 00:00:00 2001 From: Konrad Kusiak Date: Mon, 6 May 2024 11:56:20 +0100 Subject: [PATCH 02/12] Fixed pattern vector in fill_usm overload --- sycl/source/detail/memory_manager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sycl/source/detail/memory_manager.cpp b/sycl/source/detail/memory_manager.cpp index ef09a809e025e..19afb3fd31d28 100644 --- a/sycl/source/detail/memory_manager.cpp +++ b/sycl/source/detail/memory_manager.cpp @@ -1017,8 +1017,8 @@ void MemoryManager::fill_usm(void *Mem, QueueImplPtr Queue, size_t Length, std::vector DepEvents, sycl::detail::pi::PiEvent *OutEvent, const detail::EventImplPtr &OutEventImpl) { - std::vector vecPattern(sizeof(Pattern)); - std::memcpy(vecPattern.data(), &Pattern, sizeof(Pattern)); + std::vector vecPattern(Length); + std::memcpy(vecPattern.data(), &Pattern, Length); MemoryManager::fill_usm(Mem, Queue, Length, vecPattern, DepEvents, OutEvent, OutEventImpl); } @@ -1028,8 +1028,8 @@ void MemoryManager::fill_usm(void *Mem, QueueImplPtr Queue, size_t Length, int Pattern, std::vector DepEvents, sycl::detail::pi::PiEvent *OutEvent) { - std::vector vecPattern(sizeof(Pattern)); - std::memcpy(vecPattern.data(), &Pattern, sizeof(Pattern)); + std::vector vecPattern(Length); + std::memcpy(vecPattern.data(), &Pattern, Length); MemoryManager::fill_usm(Mem, Queue, Length, vecPattern, DepEvents, OutEvent, nullptr); // OutEventImpl); } From 75f94004d1c42bdf80fdea08a6aaa84df605daf3 Mon Sep 17 00:00:00 2001 From: Konrad Kusiak Date: Mon, 6 May 2024 12:13:33 +0100 Subject: [PATCH 03/12] Fixed bug in fill_usm overloads --- sycl/source/detail/memory_manager.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sycl/source/detail/memory_manager.cpp b/sycl/source/detail/memory_manager.cpp index 19afb3fd31d28..b0b1d38c0eb9e 100644 --- a/sycl/source/detail/memory_manager.cpp +++ b/sycl/source/detail/memory_manager.cpp @@ -1017,8 +1017,9 @@ void MemoryManager::fill_usm(void *Mem, QueueImplPtr Queue, size_t Length, std::vector DepEvents, sycl::detail::pi::PiEvent *OutEvent, const detail::EventImplPtr &OutEventImpl) { - std::vector vecPattern(Length); - std::memcpy(vecPattern.data(), &Pattern, Length); + // This overload with 32 bit pattern can be used only for memset + std::vector vecPattern(1); + std::memcpy(vecPattern.data(), &Pattern, 1); MemoryManager::fill_usm(Mem, Queue, Length, vecPattern, DepEvents, OutEvent, OutEventImpl); } @@ -1028,8 +1029,9 @@ void MemoryManager::fill_usm(void *Mem, QueueImplPtr Queue, size_t Length, int Pattern, std::vector DepEvents, sycl::detail::pi::PiEvent *OutEvent) { - std::vector vecPattern(Length); - std::memcpy(vecPattern.data(), &Pattern, Length); + // This overload with 32 bit pattern can be used only for memset + std::vector vecPattern(1); + std::memcpy(vecPattern.data(), &Pattern, 1); MemoryManager::fill_usm(Mem, Queue, Length, vecPattern, DepEvents, OutEvent, nullptr); // OutEventImpl); } From cde0ccb11561a244db027dbe89851a6dd5987ac5 Mon Sep 17 00:00:00 2001 From: Konrad Kusiak Date: Mon, 6 May 2024 15:39:46 +0100 Subject: [PATCH 04/12] Called fill through submitMemOpHelper --- sycl/include/sycl/queue.hpp | 40 ++++++++----------------------- sycl/source/detail/queue_impl.cpp | 37 +++++++++++++++++++++++++++- sycl/source/detail/queue_impl.hpp | 14 +++++++++++ sycl/source/queue.cpp | 22 +++++++++++++++++ 4 files changed, 82 insertions(+), 31 deletions(-) diff --git a/sycl/include/sycl/queue.hpp b/sycl/include/sycl/queue.hpp index 79d58bc859818..91c2d4d281191 100644 --- a/sycl/include/sycl/queue.hpp +++ b/sycl/include/sycl/queue.hpp @@ -477,13 +477,9 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase { /// \param Count is the number of times to fill Pattern into Ptr. /// \return an event representing fill operation. template - event fill( - void *Ptr, const T &Pattern, size_t Count, - const detail::code_location &CodeLoc = detail::code_location::current()) { - detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc); - return submit([&](handler &CGH) { CGH.fill(Ptr, Pattern, Count); }, - CodeLoc); - } + event + fill(void *Ptr, const T &Pattern, size_t Count, + const detail::code_location &CodeLoc = detail::code_location::current()); /// Fills the specified memory with the specified pattern. /// @@ -494,17 +490,9 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase { /// \param DepEvent is an event that specifies the kernel dependencies. /// \return an event representing fill operation. template - event fill( - void *Ptr, const T &Pattern, size_t Count, event DepEvent, - const detail::code_location &CodeLoc = detail::code_location::current()) { - detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc); - return submit( - [&](handler &CGH) { - CGH.depends_on(DepEvent); - CGH.fill(Ptr, Pattern, Count); - }, - CodeLoc); - } + event + fill(void *Ptr, const T &Pattern, size_t Count, event DepEvent, + const detail::code_location &CodeLoc = detail::code_location::current()); /// Fills the specified memory with the specified pattern. /// @@ -516,18 +504,10 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase { /// dependencies. /// \return an event representing fill operation. template - event fill( - void *Ptr, const T &Pattern, size_t Count, - const std::vector &DepEvents, - const detail::code_location &CodeLoc = detail::code_location::current()) { - detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc); - return submit( - [&](handler &CGH) { - CGH.depends_on(DepEvents); - CGH.fill(Ptr, Pattern, Count); - }, - CodeLoc); - } + event + fill(void *Ptr, const T &Pattern, size_t Count, + const std::vector &DepEvents, + const detail::code_location &CodeLoc = detail::code_location::current()); /// Fills the memory pointed by a USM pointer with the value specified. /// No operations is done if \param Count is zero. An exception is thrown diff --git a/sycl/source/detail/queue_impl.cpp b/sycl/source/detail/queue_impl.cpp index d3adabe185802..a89fb069b9a58 100644 --- a/sycl/source/detail/queue_impl.cpp +++ b/sycl/source/detail/queue_impl.cpp @@ -130,6 +130,41 @@ queue_impl::getExtendDependencyList(const std::vector &DepEvents, return MutableVec; } +template +event queue_impl::fill(const std::shared_ptr &Self, + void *Ptr, const T &Pattern, size_t Count, + const std::vector &DepEvents) { +#if XPTI_ENABLE_INSTRUMENTATION + // We need a code pointer value and we use the object ptr; if code location + // information is available, we will have function name and source file + // information + XPTIScope PrepareNotify((void *)this, + (uint16_t)xpti::trace_point_type_t::node_create, + SYCL_STREAM_NAME, "memory_transfer_node"); + PrepareNotify.addMetadata([&](auto TEvent) { + xpti::addMetadata(TEvent, "sycl_device", + reinterpret_cast( + MDevice->is_host() ? 0 : MDevice->getHandleRef())); + xpti::addMetadata(TEvent, "memory_ptr", reinterpret_cast(Ptr)); + xpti::addMetadata(TEvent, "memory_size", Count); + xpti::addMetadata(TEvent, "queue_id", MQueueID); + }); + // Before we notifiy the subscribers, we broadcast the 'queue_id', which was a + // metadata entry to TLS for use by callback handlers + xpti::framework::stash_tuple(XPTI_QUEUE_INSTANCE_ID_KEY, MQueueID); + // Notify XPTI about the fill submission + PrepareNotify.notify(); + // Emit a begin/end scope for this call + PrepareNotify.scopedNotify((uint16_t)xpti::trace_point_type_t::task_begin); +#endif + std::vector VecPattern(sizeof(Pattern)); + std::memcpy(VecPattern.data(), &Pattern, sizeof(Pattern)); + return submitMemOpHelper( + Self, DepEvents, [&](handler &CGH) { CGH.fill(Ptr, Pattern, Count); }, + [](const auto &...Args) { MemoryManager::fill_usm(Args...); }, Ptr, Self, + Count * sizeof(Pattern), VecPattern); +} + event queue_impl::memset(const std::shared_ptr &Self, void *Ptr, int Value, size_t Count, const std::vector &DepEvents) { @@ -199,7 +234,7 @@ event queue_impl::memcpy(const std::shared_ptr &Self, xpti::addMetadata(TEvent, "queue_id", MQueueID); }); xpti::framework::stash_tuple(XPTI_QUEUE_INSTANCE_ID_KEY, MQueueID); - // Notify XPTI about the memset submission + // Notify XPTI about the memcpy submission PrepareNotify.notify(); // Emit a begin/end scope for this call PrepareNotify.scopedNotify((uint16_t)xpti::trace_point_type_t::task_begin); diff --git a/sycl/source/detail/queue_impl.hpp b/sycl/source/detail/queue_impl.hpp index 231437cd67f19..e0713efa89e67 100644 --- a/sycl/source/detail/queue_impl.hpp +++ b/sycl/source/detail/queue_impl.hpp @@ -629,6 +629,20 @@ class queue_impl { return MPropList.get_property(); } + /// Fills the specified memory with the specified pattern. + /// + /// \param Ptr is the pointer to the memory to fill. + /// \param Pattern is the pattern to fill into the memory. T should be + /// trivially copyable. + /// \param Count is the number of times to fill Pattern into Ptr. + /// \param DepEvents is a vector of events that specifies the kernel + /// dependencies. + /// \return an event representing fill operation. + template + event fill(const std::shared_ptr &Self, void *Ptr, + const T &Pattern, size_t Count, + const std::vector &DepEvents); + /// Fills the memory pointed by a USM pointer with the value specified. /// /// \param Self is a shared_ptr to this queue. diff --git a/sycl/source/queue.cpp b/sycl/source/queue.cpp index 71ada4a1c5863..4cae826ec5ada 100644 --- a/sycl/source/queue.cpp +++ b/sycl/source/queue.cpp @@ -103,6 +103,28 @@ bool queue::is_host() const { void queue::throw_asynchronous() { impl->throw_asynchronous(); } +template +event queue::fill(void *Ptr, const T &Pattern, size_t Count, + const detail::code_location &CodeLoc) { + detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc); + return impl->fill(impl, Ptr, Pattern, Count, {}); +} + +template +event queue::fill(void *Ptr, const T &Pattern, size_t Count, event DepEvents, + const detail::code_location &CodeLoc) { + detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc); + return impl->fill(impl, Ptr, Pattern, Count, {DepEvents}); +} + +template +event queue::fill(void *Ptr, const T &Pattern, size_t Count, + const std::vector &DepEvents, + const detail::code_location &CodeLoc) { + detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc); + return impl->fill(impl, Ptr, Pattern, Count, DepEvents); +} + event queue::memset(void *Ptr, int Value, size_t Count, const detail::code_location &CodeLoc) { detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc); From 9aee1b22b03547af7cc68caf1fb1ac6cc1afd4f7 Mon Sep 17 00:00:00 2001 From: Konrad Kusiak Date: Mon, 6 May 2024 18:40:19 +0100 Subject: [PATCH 05/12] Checking this --- sycl/include/sycl/queue.hpp | 40 +++++++++++++++------ sycl/plugins/unified_runtime/CMakeLists.txt | 4 +-- sycl/source/detail/queue_impl.cpp | 35 ------------------ sycl/source/detail/queue_impl.hpp | 14 -------- sycl/source/queue.cpp | 22 ------------ 5 files changed, 32 insertions(+), 83 deletions(-) diff --git a/sycl/include/sycl/queue.hpp b/sycl/include/sycl/queue.hpp index 91c2d4d281191..79d58bc859818 100644 --- a/sycl/include/sycl/queue.hpp +++ b/sycl/include/sycl/queue.hpp @@ -477,9 +477,13 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase { /// \param Count is the number of times to fill Pattern into Ptr. /// \return an event representing fill operation. template - event - fill(void *Ptr, const T &Pattern, size_t Count, - const detail::code_location &CodeLoc = detail::code_location::current()); + event fill( + void *Ptr, const T &Pattern, size_t Count, + const detail::code_location &CodeLoc = detail::code_location::current()) { + detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc); + return submit([&](handler &CGH) { CGH.fill(Ptr, Pattern, Count); }, + CodeLoc); + } /// Fills the specified memory with the specified pattern. /// @@ -490,9 +494,17 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase { /// \param DepEvent is an event that specifies the kernel dependencies. /// \return an event representing fill operation. template - event - fill(void *Ptr, const T &Pattern, size_t Count, event DepEvent, - const detail::code_location &CodeLoc = detail::code_location::current()); + event fill( + void *Ptr, const T &Pattern, size_t Count, event DepEvent, + const detail::code_location &CodeLoc = detail::code_location::current()) { + detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc); + return submit( + [&](handler &CGH) { + CGH.depends_on(DepEvent); + CGH.fill(Ptr, Pattern, Count); + }, + CodeLoc); + } /// Fills the specified memory with the specified pattern. /// @@ -504,10 +516,18 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase { /// dependencies. /// \return an event representing fill operation. template - event - fill(void *Ptr, const T &Pattern, size_t Count, - const std::vector &DepEvents, - const detail::code_location &CodeLoc = detail::code_location::current()); + event fill( + void *Ptr, const T &Pattern, size_t Count, + const std::vector &DepEvents, + const detail::code_location &CodeLoc = detail::code_location::current()) { + detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc); + return submit( + [&](handler &CGH) { + CGH.depends_on(DepEvents); + CGH.fill(Ptr, Pattern, Count); + }, + CodeLoc); + } /// Fills the memory pointed by a USM pointer with the value specified. /// No operations is done if \param Count is zero. An exception is thrown diff --git a/sycl/plugins/unified_runtime/CMakeLists.txt b/sycl/plugins/unified_runtime/CMakeLists.txt index a4aa203f05365..b142d6929d9d4 100644 --- a/sycl/plugins/unified_runtime/CMakeLists.txt +++ b/sycl/plugins/unified_runtime/CMakeLists.txt @@ -94,14 +94,14 @@ if(SYCL_PI_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") + set(UNIFIED_RUNTIME_REPO "https://github.com/konradkusiak97/unified-runtime.git") # commit ebf873fb5996c9ddca32bbb7c9330d3ffe15473c # Merge: 633ec408 8f375039 # Author: Kenneth Benzie (Benie) # Date: Thu May 2 10:56:55 2024 +0100 # Merge pull request #1535 from przemektmalon/przemek/sampled-image-fetch # [Bindless][Exp] Add device queries for sampled image fetch - set(UNIFIED_RUNTIME_TAG ebf873fb5996c9ddca32bbb7c9330d3ffe15473c) + set(UNIFIED_RUNTIME_TAG URFixPostCommitFailure) fetch_adapter_source(level_zero "https://github.com/oneapi-src/unified-runtime.git" diff --git a/sycl/source/detail/queue_impl.cpp b/sycl/source/detail/queue_impl.cpp index a89fb069b9a58..14d2ad1b94834 100644 --- a/sycl/source/detail/queue_impl.cpp +++ b/sycl/source/detail/queue_impl.cpp @@ -130,41 +130,6 @@ queue_impl::getExtendDependencyList(const std::vector &DepEvents, return MutableVec; } -template -event queue_impl::fill(const std::shared_ptr &Self, - void *Ptr, const T &Pattern, size_t Count, - const std::vector &DepEvents) { -#if XPTI_ENABLE_INSTRUMENTATION - // We need a code pointer value and we use the object ptr; if code location - // information is available, we will have function name and source file - // information - XPTIScope PrepareNotify((void *)this, - (uint16_t)xpti::trace_point_type_t::node_create, - SYCL_STREAM_NAME, "memory_transfer_node"); - PrepareNotify.addMetadata([&](auto TEvent) { - xpti::addMetadata(TEvent, "sycl_device", - reinterpret_cast( - MDevice->is_host() ? 0 : MDevice->getHandleRef())); - xpti::addMetadata(TEvent, "memory_ptr", reinterpret_cast(Ptr)); - xpti::addMetadata(TEvent, "memory_size", Count); - xpti::addMetadata(TEvent, "queue_id", MQueueID); - }); - // Before we notifiy the subscribers, we broadcast the 'queue_id', which was a - // metadata entry to TLS for use by callback handlers - xpti::framework::stash_tuple(XPTI_QUEUE_INSTANCE_ID_KEY, MQueueID); - // Notify XPTI about the fill submission - PrepareNotify.notify(); - // Emit a begin/end scope for this call - PrepareNotify.scopedNotify((uint16_t)xpti::trace_point_type_t::task_begin); -#endif - std::vector VecPattern(sizeof(Pattern)); - std::memcpy(VecPattern.data(), &Pattern, sizeof(Pattern)); - return submitMemOpHelper( - Self, DepEvents, [&](handler &CGH) { CGH.fill(Ptr, Pattern, Count); }, - [](const auto &...Args) { MemoryManager::fill_usm(Args...); }, Ptr, Self, - Count * sizeof(Pattern), VecPattern); -} - event queue_impl::memset(const std::shared_ptr &Self, void *Ptr, int Value, size_t Count, const std::vector &DepEvents) { diff --git a/sycl/source/detail/queue_impl.hpp b/sycl/source/detail/queue_impl.hpp index e0713efa89e67..231437cd67f19 100644 --- a/sycl/source/detail/queue_impl.hpp +++ b/sycl/source/detail/queue_impl.hpp @@ -629,20 +629,6 @@ class queue_impl { return MPropList.get_property(); } - /// Fills the specified memory with the specified pattern. - /// - /// \param Ptr is the pointer to the memory to fill. - /// \param Pattern is the pattern to fill into the memory. T should be - /// trivially copyable. - /// \param Count is the number of times to fill Pattern into Ptr. - /// \param DepEvents is a vector of events that specifies the kernel - /// dependencies. - /// \return an event representing fill operation. - template - event fill(const std::shared_ptr &Self, void *Ptr, - const T &Pattern, size_t Count, - const std::vector &DepEvents); - /// Fills the memory pointed by a USM pointer with the value specified. /// /// \param Self is a shared_ptr to this queue. diff --git a/sycl/source/queue.cpp b/sycl/source/queue.cpp index 4cae826ec5ada..71ada4a1c5863 100644 --- a/sycl/source/queue.cpp +++ b/sycl/source/queue.cpp @@ -103,28 +103,6 @@ bool queue::is_host() const { void queue::throw_asynchronous() { impl->throw_asynchronous(); } -template -event queue::fill(void *Ptr, const T &Pattern, size_t Count, - const detail::code_location &CodeLoc) { - detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc); - return impl->fill(impl, Ptr, Pattern, Count, {}); -} - -template -event queue::fill(void *Ptr, const T &Pattern, size_t Count, event DepEvents, - const detail::code_location &CodeLoc) { - detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc); - return impl->fill(impl, Ptr, Pattern, Count, {DepEvents}); -} - -template -event queue::fill(void *Ptr, const T &Pattern, size_t Count, - const std::vector &DepEvents, - const detail::code_location &CodeLoc) { - detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc); - return impl->fill(impl, Ptr, Pattern, Count, DepEvents); -} - event queue::memset(void *Ptr, int Value, size_t Count, const detail::code_location &CodeLoc) { detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc); From cb460b84cfa4995f3ef13cf382d42049a65af4fb Mon Sep 17 00:00:00 2001 From: Konrad Kusiak Date: Mon, 6 May 2024 20:19:00 +0100 Subject: [PATCH 06/12] Fixed lvl zero UR fetch --- sycl/plugins/unified_runtime/CMakeLists.txt | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sycl/plugins/unified_runtime/CMakeLists.txt b/sycl/plugins/unified_runtime/CMakeLists.txt index b142d6929d9d4..88ac6a99118f6 100644 --- a/sycl/plugins/unified_runtime/CMakeLists.txt +++ b/sycl/plugins/unified_runtime/CMakeLists.txt @@ -103,15 +103,19 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT) # [Bindless][Exp] Add device queries for sampled image fetch set(UNIFIED_RUNTIME_TAG URFixPostCommitFailure) + # fetch_adapter_source(level_zero + # "https://github.com/oneapi-src/unified-runtime.git" + # # commit fb342f06e1ac244c5995b7be458d0c32a1ba17ab + # # Merge: a44e81b5 7186d6ce + # # Author: Kenneth Benzie (Benie) + # # Date: Fri May 3 11:55:26 2024 +0100 + # # Merge pull request #1549 from igchor/event_fix + # # Fix adding event to queue cache + # fb342f06e1ac244c5995b7be458d0c32a1ba17ab + # ) fetch_adapter_source(level_zero - "https://github.com/oneapi-src/unified-runtime.git" - # commit fb342f06e1ac244c5995b7be458d0c32a1ba17ab - # Merge: a44e81b5 7186d6ce - # Author: Kenneth Benzie (Benie) - # Date: Fri May 3 11:55:26 2024 +0100 - # Merge pull request #1549 from igchor/event_fix - # Fix adding event to queue cache - fb342f06e1ac244c5995b7be458d0c32a1ba17ab + ${UNIFIED_RUNTIME_REPO} + ${UNIFIED_RUNTIME_TAG} ) fetch_adapter_source(opencl From 0d7074aab3d7ca87bad37d35e590e764556ad6e4 Mon Sep 17 00:00:00 2001 From: Konrad Kusiak Date: Tue, 7 May 2024 09:50:35 +0100 Subject: [PATCH 07/12] Check sth --- sycl/test-e2e/Basic/out_of_order_queue_status.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sycl/test-e2e/Basic/out_of_order_queue_status.cpp b/sycl/test-e2e/Basic/out_of_order_queue_status.cpp index c9da9facd0294..13bb8ef1735fd 100644 --- a/sycl/test-e2e/Basic/out_of_order_queue_status.cpp +++ b/sycl/test-e2e/Basic/out_of_order_queue_status.cpp @@ -49,10 +49,10 @@ void TestFunc(queue &Q) { // We expect that all submitted tasks are finished if ext_oneapi_empty is // true. - if (Q.ext_oneapi_empty()) - CheckArray(Y, Size, 200); + // if (Q.ext_oneapi_empty()) + // CheckArray(Y, Size, 200); - Q.wait(); + Q.wait_and_throw(); // After synchronization queue must be empty. assert(Q.ext_oneapi_empty() && "Queue is expected to be empty"); From 36b2228770fc93e38ec8f63ed2243c9ae2f3757e Mon Sep 17 00:00:00 2001 From: Konrad Kusiak Date: Tue, 7 May 2024 14:04:17 +0100 Subject: [PATCH 08/12] Checking if takes correct UR tag --- sycl/test-e2e/Basic/out_of_order_queue_status.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sycl/test-e2e/Basic/out_of_order_queue_status.cpp b/sycl/test-e2e/Basic/out_of_order_queue_status.cpp index 8d58fa131e41f..c9da9facd0294 100644 --- a/sycl/test-e2e/Basic/out_of_order_queue_status.cpp +++ b/sycl/test-e2e/Basic/out_of_order_queue_status.cpp @@ -49,14 +49,14 @@ void TestFunc(queue &Q) { // We expect that all submitted tasks are finished if ext_oneapi_empty is // true. + if (Q.ext_oneapi_empty()) + CheckArray(Y, Size, 200); - Q.wait_and_throw(); + Q.wait(); // After synchronization queue must be empty. assert(Q.ext_oneapi_empty() && "Queue is expected to be empty"); - CheckArray(Y, Size, 200); - free(X, Q); free(Y, Q); } From 666ab27a752e35b88fa5e795fe1635ebbb7c2b6d Mon Sep 17 00:00:00 2001 From: Konrad Kusiak Date: Tue, 7 May 2024 14:51:57 +0100 Subject: [PATCH 09/12] Pointed UR to correct L0 branch with assert --- sycl/plugins/unified_runtime/CMakeLists.txt | 37 +++++++++------------ 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/sycl/plugins/unified_runtime/CMakeLists.txt b/sycl/plugins/unified_runtime/CMakeLists.txt index 88ac6a99118f6..f5491808b8edd 100644 --- a/sycl/plugins/unified_runtime/CMakeLists.txt +++ b/sycl/plugins/unified_runtime/CMakeLists.txt @@ -94,28 +94,23 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT) CACHE PATH "Path to external '${name}' adapter source dir" FORCE) endfunction() - set(UNIFIED_RUNTIME_REPO "https://github.com/konradkusiak97/unified-runtime.git") - # commit ebf873fb5996c9ddca32bbb7c9330d3ffe15473c - # Merge: 633ec408 8f375039 - # Author: Kenneth Benzie (Benie) - # Date: Thu May 2 10:56:55 2024 +0100 - # Merge pull request #1535 from przemektmalon/przemek/sampled-image-fetch - # [Bindless][Exp] Add device queries for sampled image fetch - set(UNIFIED_RUNTIME_TAG URFixPostCommitFailure) - - # fetch_adapter_source(level_zero - # "https://github.com/oneapi-src/unified-runtime.git" - # # commit fb342f06e1ac244c5995b7be458d0c32a1ba17ab - # # Merge: a44e81b5 7186d6ce - # # Author: Kenneth Benzie (Benie) - # # Date: Fri May 3 11:55:26 2024 +0100 - # # Merge pull request #1549 from igchor/event_fix - # # Fix adding event to queue cache - # fb342f06e1ac244c5995b7be458d0c32a1ba17ab - # ) + set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git") + # commit fcd3693d1b54ddad1fcbe9e2c749c01628739346 + # Merge: c8a0d84b 5d51c9a1 + # Date: Fri May 3 19:12:25 2024 +0100 + # Merge pull request #1513 from aarongreig/aaron/minorL0DeviceInfoFixes + # Fix some minor bugs in L0 urDeviceGetInfo revealed by PI->UR port + set(UNIFIED_RUNTIME_TAG fcd3693d1b54ddad1fcbe9e2c749c01628739346) + fetch_adapter_source(level_zero - ${UNIFIED_RUNTIME_REPO} - ${UNIFIED_RUNTIME_TAG} + "https://github.com/konradkusiak97/unified-runtime.git" + # commit fb342f06e1ac244c5995b7be458d0c32a1ba17ab + # Merge: a44e81b5 7186d6ce + # Author: Kenneth Benzie (Benie) + # Date: Fri May 3 11:55:26 2024 +0100 + # Merge pull request #1549 from igchor/event_fix + # Fix adding event to queue cache + d5718275657c548b3360643e366538594f1f6101 ) fetch_adapter_source(opencl From 193fb32bbc8e6eb2cc99584a495fb7882bd5b0b2 Mon Sep 17 00:00:00 2001 From: Konrad Kusiak Date: Tue, 7 May 2024 16:46:39 +0100 Subject: [PATCH 10/12] Changed UR fill to run synchronously --- sycl/plugins/unified_runtime/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/plugins/unified_runtime/CMakeLists.txt b/sycl/plugins/unified_runtime/CMakeLists.txt index f5491808b8edd..22a45e15e6b59 100644 --- a/sycl/plugins/unified_runtime/CMakeLists.txt +++ b/sycl/plugins/unified_runtime/CMakeLists.txt @@ -110,7 +110,7 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT) # Date: Fri May 3 11:55:26 2024 +0100 # Merge pull request #1549 from igchor/event_fix # Fix adding event to queue cache - d5718275657c548b3360643e366538594f1f6101 + e06e467705cd575bd1326ad400283d0877a9cdaa ) fetch_adapter_source(opencl From 4bc318327309eeaee4cde50f54a217c1d8f84f04 Mon Sep 17 00:00:00 2001 From: Konrad Kusiak Date: Wed, 8 May 2024 21:39:50 +0100 Subject: [PATCH 11/12] Moved UR tag back to place --- sycl/plugins/unified_runtime/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sycl/plugins/unified_runtime/CMakeLists.txt b/sycl/plugins/unified_runtime/CMakeLists.txt index 22a45e15e6b59..23683d2bd3d7d 100644 --- a/sycl/plugins/unified_runtime/CMakeLists.txt +++ b/sycl/plugins/unified_runtime/CMakeLists.txt @@ -97,20 +97,21 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT) set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git") # commit fcd3693d1b54ddad1fcbe9e2c749c01628739346 # Merge: c8a0d84b 5d51c9a1 + # Author: Kenneth Benzie (Benie) # Date: Fri May 3 19:12:25 2024 +0100 # Merge pull request #1513 from aarongreig/aaron/minorL0DeviceInfoFixes # Fix some minor bugs in L0 urDeviceGetInfo revealed by PI->UR port set(UNIFIED_RUNTIME_TAG fcd3693d1b54ddad1fcbe9e2c749c01628739346) fetch_adapter_source(level_zero - "https://github.com/konradkusiak97/unified-runtime.git" + ${UNIFIED_RUNTIME_REPO} # commit fb342f06e1ac244c5995b7be458d0c32a1ba17ab # Merge: a44e81b5 7186d6ce # Author: Kenneth Benzie (Benie) # Date: Fri May 3 11:55:26 2024 +0100 # Merge pull request #1549 from igchor/event_fix # Fix adding event to queue cache - e06e467705cd575bd1326ad400283d0877a9cdaa + fb342f06e1ac244c5995b7be458d0c32a1ba17ab ) fetch_adapter_source(opencl From b1b44e6e773d84017ef72b6bebf2d47c5c0328e1 Mon Sep 17 00:00:00 2001 From: Konrad Kusiak Date: Wed, 8 May 2024 21:53:21 +0100 Subject: [PATCH 12/12] Added new test --- .../out_of_order_queue_status_memset.cpp | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 sycl/test-e2e/Basic/out_of_order_queue_status_memset.cpp diff --git a/sycl/test-e2e/Basic/out_of_order_queue_status_memset.cpp b/sycl/test-e2e/Basic/out_of_order_queue_status_memset.cpp new file mode 100644 index 0000000000000..ca2f9e861711e --- /dev/null +++ b/sycl/test-e2e/Basic/out_of_order_queue_status_memset.cpp @@ -0,0 +1,79 @@ +// RUN: %{build} -o %t.out +// RUN: %{run} %t.out + +// Test checks that queue::ext_oneapi_empty() returns status of the out-of-order +// queue. + +#include +#include +#include + +static void CheckArray(int *x, size_t buffer_size, int expected) { + for (size_t i = 0; i < buffer_size; ++i) { + assert(x[i] == expected); + } +} + +using namespace sycl; + +void TestFunc(queue &Q) { + static constexpr int Size = 100; + + assert(Q.ext_oneapi_empty() && "Queue is expected to be empty"); + + int *X = malloc_host(Size, Q); + int *Y = malloc_host(Size, Q); + + auto FillEv = Q.memset(X, 0, Size); + auto HostEv = Q.submit([&](handler &CGH) { + CGH.depends_on(FillEv); + auto HostTask = [=] { + for (int I = 0; I < Size; I++) + X[I] += 1; + }; + CGH.host_task(HostTask); + }); + auto MemCpyEv = Q.copy(X, Y, Size, {HostEv}); + constexpr int NumIter = 5; + for (int I = 0; I < NumIter; I++) { + Q.submit([&](handler &CGH) { + CGH.depends_on(MemCpyEv); + CGH.parallel_for( + sycl::range<1>(Size / NumIter), + [=](sycl::id<1> WI) { Y[WI + I * Size / NumIter] *= 2; }); + }); + } + + // Wait a bit to give a chance for tasks to complete. + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + + // We expect that all submitted tasks are finished if ext_oneapi_empty is + // true. + if (Q.ext_oneapi_empty()) + CheckArray(Y, Size, 2); + + Q.wait(); + + // After synchronization queue must be empty. + assert(Q.ext_oneapi_empty() && "Queue is expected to be empty"); + + free(X, Q); + free(Y, Q); +} + +int main() { + queue Q; + + bool ExceptionThrown = false; + try { + TestFunc(Q); + } catch (sycl::exception &E) { + ExceptionThrown = true; + } + + // Feature is not supported for OpenCL, exception must be thrown. + if (Q.get_device().get_backend() == backend::opencl) + return ExceptionThrown ? 0 : -1; + + return 0; +}