From 0a997a5ced7c05dc803dd063a19e59bbc34bb34b Mon Sep 17 00:00:00 2001 From: "Ptak, Slawomir" Date: Thu, 15 Jan 2026 10:43:19 +0000 Subject: [PATCH] [SYCL] Wait for host task execution in host-task-failure test. The host-task-failure test used to test the behavior of a buffer desctructor, if the last access to the buffer was made in a host task. That code path has been changed, so the host task was not executed at all in most of the test runs. It also created a race condition in the test. This change introduces a synchronization mechanism to execute the host task on every test run. --- .../HostInteropTask/host-task-failure.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/sycl/test-e2e/HostInteropTask/host-task-failure.cpp b/sycl/test-e2e/HostInteropTask/host-task-failure.cpp index 97a57e645a972..fe40c083ea4ac 100644 --- a/sycl/test-e2e/HostInteropTask/host-task-failure.cpp +++ b/sycl/test-e2e/HostInteropTask/host-task-failure.cpp @@ -1,9 +1,7 @@ // RUN: %{build} -o %t.out // RUN: %{run} %t.out -// UNSUPPORTED: linux && arch-intel_gpu_pvc -// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/20961 - +#include #include using namespace sycl; @@ -15,6 +13,10 @@ template class Modifier; template class Init; +std::mutex cvMutex; +std::condition_variable cv; +bool ready = false; + template void copy(buffer &Src, buffer &Dst, queue &Q) { Q.submit([&](handler &CGH) { @@ -24,6 +26,11 @@ void copy(buffer &Src, buffer &Dst, queue &Q) { CGH.host_task([=]() { for (size_t Idx = 0; Idx < SrcA.size(); ++Idx) DstA[Idx] = SrcA[Idx]; + { + std::unique_lock lk(cvMutex); + ready = true; + } + cv.notify_one(); }); }); } @@ -49,6 +56,9 @@ void test() { init(Buffer1, Buffer2, Q); copy(Buffer1, Buffer2, Q); + + std::unique_lock lk(cvMutex); + cv.wait(lk, [&] { return ready; }); } int main() {