From 5167d7202b1e43418ecb2928841dff51cb011221 Mon Sep 17 00:00:00 2001 From: Michael Rizkalla Date: Wed, 5 Mar 2025 00:51:18 +0000 Subject: [PATCH] Fix signalling and waiting on semaphore from two queues (#2271) `semaphores_ooo_ops_cross_queue` uses two OOO command queues to run the test. In one queue, a semaphore is signalled and the semahpore is waited on in the other queue. The CL specification requires the application to synchronize the queues if objects are shared. Signed-off-by: Michael Rizkalla --- .../cl_khr_semaphore/test_semaphores_cross_queue.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test_conformance/extensions/cl_khr_semaphore/test_semaphores_cross_queue.cpp b/test_conformance/extensions/cl_khr_semaphore/test_semaphores_cross_queue.cpp index 0a86d5aa..4067fd4e 100644 --- a/test_conformance/extensions/cl_khr_semaphore/test_semaphores_cross_queue.cpp +++ b/test_conformance/extensions/cl_khr_semaphore/test_semaphores_cross_queue.cpp @@ -266,6 +266,15 @@ struct SemaphoreOutOfOrderOps : public SemaphoreTestBase err = clEnqueueBarrierWithWaitList(consumer_queue, 0, nullptr, nullptr); test_error(err, " clEnqueueBarrierWithWaitList "); + if (!single_queue) + { + // Both producer and consumer queues run independently. + // A blocking call to clEnqueueReadBuffer in consumer_queue will not + // flush the producer queue. + err = clFlush(producer_queue); + test_error(err, "clFlush failed"); + } + std::vector host_buffer(num_elems, 0); auto verify_result = [&](const cl_mem &out_mem, const cl_int pattern) { err = clEnqueueReadBuffer(consumer_queue, out_mem, CL_TRUE, 0,