diff --git a/.github/workflows/sycl-linux-run-tests.yml b/.github/workflows/sycl-linux-run-tests.yml index 178ede511387d..ee3701d338527 100644 --- a/.github/workflows/sycl-linux-run-tests.yml +++ b/.github/workflows/sycl-linux-run-tests.yml @@ -263,9 +263,9 @@ jobs: - 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 + 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/sycl/source/detail/queue_impl.cpp b/sycl/source/detail/queue_impl.cpp index 5592619b2316b..5cd840b6c957b 100644 --- a/sycl/source/detail/queue_impl.cpp +++ b/sycl/source/detail/queue_impl.cpp @@ -199,7 +199,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/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; +}