diff --git a/sycl/test-e2e/Graph/Threading/begin_end_recording.cpp b/sycl/test-e2e/Graph/Threading/begin_end_recording.cpp deleted file mode 100644 index 4626ca06e4f08..0000000000000 --- a/sycl/test-e2e/Graph/Threading/begin_end_recording.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// REQUIRES: level_zero, gpu, TEMPORARY_DISABLED -// Disabled as thread safety not yet implemented - -// RUN: %clangxx -pthread -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -// RUN: %{run} %t.out -// RUN: %if ext_oneapi_level_zero %{env ZE_DEBUG=4 %{run} %t.out 2>&1 | FileCheck %s %} -// -// CHECK-NOT: LEAK - -// Test each thread recording the same graph to a different queue. -// The second run is to check that there are no leaks reported with the embedded -// ZE_DEBUG=4 testing capability. - -#include "../graph_common.hpp" - -#include - -using namespace sycl; - -int main() { - queue Queue; - - using T = int; - - const size_t Elements = 1024; - const unsigned NumThreads = std::thread::hardware_concurrency(); - std::vector DataA(Elements), DataB(Elements), DataC(Elements); - - std::iota(DataA.begin(), DataA.end(), 1); - std::iota(DataB.begin(), DataB.end(), 10); - std::iota(DataC.begin(), DataC.end(), 1000); - - exp_ext::command_graph Graph{Queue.get_context(), Queue.get_device()}; - - T *PtrA = malloc_device(Elements, Queue); - T *PtrB = malloc_device(Elements, Queue); - T *PtrC = malloc_device(Elements, Queue); - - Queue.copy(DataA.data(), PtrA, Elements); - Queue.copy(DataB.data(), PtrB, Elements); - Queue.copy(DataC.data(), PtrC, Elements); - Queue.wait_and_throw(); - - auto RecordGraph = [&]() { - queue MyQueue; - - Graph.begin_recording(MyQueue); - run_kernels_usm(MyQueue, Elements, PtrA, PtrB, PtrC); - Graph.end_recording(MyQueue); - }; - - std::vector Threads; - Threads.reserve(NumThreads); - for (unsigned i = 0; i < NumThreads; ++i) { - Threads.emplace_back(RecordGraph); - } - - for (unsigned i = 0; i < NumThreads; ++i) { - Threads[i].join(); - } - - free(PtrA, Queue); - free(PtrB, Queue); - free(PtrC, Queue); - - return 0; -} diff --git a/sycl/test-e2e/Graph/Threading/explicit_add_nodes.cpp b/sycl/test-e2e/Graph/Threading/explicit_add_nodes.cpp deleted file mode 100644 index 13a46ae9429c4..0000000000000 --- a/sycl/test-e2e/Graph/Threading/explicit_add_nodes.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// REQUIRES: level_zero, gpu, TEMPORARY_DISABLED -// Disabled as thread safety not yet implemented - -// RUN: %clangxx -pthread -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -// RUN: %{run} %t.out -// RUN: %if ext_oneapi_level_zero %{env ZE_DEBUG=4 %{run} %t.out 2>&1 | FileCheck %s %} -// -// CHECK-NOT: LEAK - -// Test each thread adding of nodes to same graph. -// The second run is to check that there are no leaks reported with the embedded -// ZE_DEBUG=4 testing capability. - -#include "../graph_common.hpp" -#include - -int main() { - queue Queue; - - using T = int; - - const size_t Elements = 1024; - const unsigned NumThreads = std::thread::hardware_concurrency(); - std::vector DataA(Elements), DataB(Elements), DataC(Elements); - - std::iota(DataA.begin(), DataA.end(), 1); - std::iota(DataB.begin(), DataB.end(), 10); - std::iota(DataC.begin(), DataC.end(), 1000); - - exp_ext::command_graph Graph{Queue.get_context(), Queue.get_device()}; - - T *PtrA = malloc_device(Elements, Queue); - T *PtrB = malloc_device(Elements, Queue); - T *PtrC = malloc_device(Elements, Queue); - - Queue.copy(DataA.data(), PtrA, Elements); - Queue.copy(DataB.data(), PtrB, Elements); - Queue.copy(DataC.data(), PtrC, Elements); - Queue.wait_and_throw(); - - auto AddNodesToGraph = [&]() { - add_kernels_usm(Graph, Elements, PtrA, PtrB, PtrC); - }; - - std::vector Threads; - Threads.reserve(NumThreads); - for (unsigned i = 0; i < NumThreads; ++i) { - Threads.emplace_back(AddNodesToGraph); - } - - for (unsigned i = 0; i < NumThreads; ++i) { - Threads[i].join(); - } - - free(PtrA, Queue); - free(PtrB, Queue); - free(PtrC, Queue); - - return 0; -} diff --git a/sycl/test-e2e/Graph/Threading/finalize.cpp b/sycl/test-e2e/Graph/Threading/finalize.cpp deleted file mode 100644 index 749678c48be13..0000000000000 --- a/sycl/test-e2e/Graph/Threading/finalize.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// REQUIRES: level_zero, gpu, TEMPORARY_DISABLED -// Disabled as thread safety not yet implemented - -// RUN: %clangxx -pthread -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -// RUN: %{run} %t.out -// RUN: %if ext_oneapi_level_zero %{env ZE_DEBUG=4 %{run} %t.out 2>&1 | FileCheck %s %} -// -// CHECK-NOT: LEAK - -// Test finalizing and submitting a graph in a threaded situation. -// The second run is to check that there are no leaks reported with the embedded -// ZE_DEBUG=4 testing capability. - -#include "../graph_common.hpp" - -#include - -int main() { - queue Queue; - - using T = int; - - const unsigned NumThreads = std::thread::hardware_concurrency(); - std::vector DataA(Size), DataB(Size), DataC(Size); - - std::iota(DataA.begin(), DataA.end(), 1); - std::iota(DataB.begin(), DataB.end(), 10); - std::iota(DataC.begin(), DataC.end(), 1000); - - std::vector ReferenceA(DataA), ReferenceB(DataB), ReferenceC(DataC); - calculate_reference_data(NumThreads, Size, ReferenceA, ReferenceB, - ReferenceC); - - exp_ext::command_graph Graph{Queue.get_context(), Queue.get_device()}; - - T *PtrA = malloc_device(Size, Queue); - T *PtrB = malloc_device(Size, Queue); - T *PtrC = malloc_device(Size, Queue); - - Queue.copy(DataA.data(), PtrA, Size); - Queue.copy(DataB.data(), PtrB, Size); - Queue.copy(DataC.data(), PtrC, Size); - Queue.wait_and_throw(); - - Graph.begin_recording(Queue); - run_kernels_usm(Queue, Size, PtrA, PtrB, PtrC); - Graph.end_recording(); - - auto FinalizeGraph = [&]() { - auto GraphExec = Graph.finalize(); - Queue.submit([&](sycl::handler &CGH) { CGH.ext_oneapi_graph(GraphExec); }); - }; - - std::vector Threads; - Threads.reserve(NumThreads); - - for (unsigned i = 0; i < NumThreads; ++i) { - Threads.emplace_back(FinalizeGraph); - } - - for (unsigned i = 0; i < NumThreads; ++i) { - Threads[i].join(); - } - - Queue.wait_and_throw(); - - Queue.copy(PtrA, DataA.data(), Size); - Queue.copy(PtrB, DataB.data(), Size); - Queue.copy(PtrC, DataC.data(), Size); - Queue.wait_and_throw(); - - free(PtrA, Queue); - free(PtrB, Queue); - free(PtrC, Queue); - - assert(ReferenceA == DataA); - assert(ReferenceB == DataB); - assert(ReferenceC == DataC); - - return 0; -} diff --git a/sycl/test-e2e/Graph/Threading/queue_state.cpp b/sycl/test-e2e/Graph/Threading/queue_state.cpp deleted file mode 100644 index b1713d2e9b1dd..0000000000000 --- a/sycl/test-e2e/Graph/Threading/queue_state.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// REQUIRES: level_zero, gpu, TEMPORARY_DISABLED -// Disabled as thread safety not yet implemented - -// RUN: %clangxx -pthread -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -// RUN: %{run} %t.out -// RUN: %if ext_oneapi_level_zero %{env ZE_DEBUG=4 %{run} %t.out 2>&1 | FileCheck %s %} -// -// CHECK-NOT: LEAK - -// Test finalizing and submitting a graph in a threaded situation. -// The second run is to check that there are no leaks reported with the embedded -// ZE_DEBUG=4 testing capability. - -#include "../graph_common.hpp" - -#include - -int main() { - queue Queue; - - const unsigned NumThreads = std::thread::hardware_concurrency(); - - auto RecordGraph = [&]() { - exp_ext::command_graph Graph{Queue.get_context(), Queue.get_device()}; - try { - Graph.begin_recording(Queue); - } catch (sycl::exception &E) { - // Can throw if graph is already being recorded to - } - Graph.end_recording(); - }; - - std::vector Threads; - Threads.reserve(NumThreads); - for (unsigned i = 0; i < NumThreads; ++i) { - Threads.emplace_back(RecordGraph); - } - - for (unsigned i = 0; i < NumThreads; ++i) { - Threads[i].join(); - } - - return 0; -} diff --git a/sycl/test-e2e/Graph/Threading/record_add_nodes.cpp b/sycl/test-e2e/Graph/Threading/record_add_nodes.cpp deleted file mode 100644 index 1d30947d3dd43..0000000000000 --- a/sycl/test-e2e/Graph/Threading/record_add_nodes.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// REQUIRES: level_zero, gpu, TEMPORARY_DISABLED -// Disabled as thread safety not yet implemented - -// RUN: %clangxx -pthread -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -// RUN: %{run} %t.out -// RUN: %if ext_oneapi_level_zero %{env ZE_DEBUG=4 %{run} %t.out 2>&1 | FileCheck %s %} -// -// CHECK-NOT: LEAK - -// Test recording commands to a queue in a threaded situation. We don't -// submit the graph to verify the results as ordering of graph nodes isn't -// defined. -// The second run is to check that there are no leaks reported with the embedded -// ZE_DEBUG=4 testing capability. - -#include "../graph_common.hpp" -#include - -int main() { - queue Queue; - - using T = int; - - const unsigned NumThreads = std::thread::hardware_concurrency(); - std::vector DataA(Size), DataB(Size), DataC(Size); - - std::iota(DataA.begin(), DataA.end(), 1); - std::iota(DataB.begin(), DataB.end(), 10); - std::iota(DataC.begin(), DataC.end(), 1000); - - exp_ext::command_graph Graph{Queue.get_context(), Queue.get_device()}; - - T *PtrA = malloc_device(Size, Queue); - T *PtrB = malloc_device(Size, Queue); - T *PtrC = malloc_device(Size, Queue); - - Queue.copy(DataA.data(), PtrA, Size); - Queue.copy(DataB.data(), PtrB, Size); - Queue.copy(DataC.data(), PtrC, Size); - Queue.wait_and_throw(); - - Graph.begin_recording(Queue); - auto recordGraph = [&]() { - // Record commands to graph - run_kernels_usm(Queue, Size, PtrA, PtrB, PtrC); - }; - Graph.end_recording(); - - std::vector Threads; - Threads.reserve(NumThreads); - for (unsigned i = 0; i < NumThreads; ++i) { - Threads.emplace_back(recordGraph); - } - - for (unsigned i = 0; i < NumThreads; ++i) { - Threads[i].join(); - } - - free(PtrA, Queue); - free(PtrB, Queue); - free(PtrC, Queue); - - return 0; -} diff --git a/sycl/test-e2e/Graph/Threading/submit.cpp b/sycl/test-e2e/Graph/Threading/submit.cpp deleted file mode 100644 index f1ade3ab96994..0000000000000 --- a/sycl/test-e2e/Graph/Threading/submit.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// REQUIRES: level_zero, gpu, TEMPORARY_DISABLED -// Disabled as thread safety not yet implemented - -// RUN: %clangxx -pthread -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -// RUN: %{run} %t.out -// RUN: %if ext_oneapi_level_zero %{env ZE_DEBUG=4 %{run} %t.out 2>&1 | FileCheck %s %} -// -// CHECK-NOT: LEAK - -// Test calling queue::submit(graph) in a threaded situation. -// The second run is to check that there are no leaks reported with the embedded -// ZE_DEBUG=4 testing capability. - -#include "../graph_common.hpp" - -#include - -int main() { - queue Queue; - - using T = int; - - const unsigned NumThreads = std::thread::hardware_concurrency(); - std::vector DataA(Size), DataB(Size), DataC(Size); - - std::iota(DataA.begin(), DataA.end(), 1); - std::iota(DataB.begin(), DataB.end(), 10); - std::iota(DataC.begin(), DataC.end(), 1000); - - std::vector ReferenceA(DataA), ReferenceB(DataB), ReferenceC(DataC); - calculate_reference_data(NumThreads, Size, ReferenceA, ReferenceB, - ReferenceC); - - exp_ext::command_graph Graph{Queue.get_context(), Queue.get_device()}; - - T *PtrA = malloc_device(Size, Queue); - T *PtrB = malloc_device(Size, Queue); - T *PtrC = malloc_device(Size, Queue); - - Queue.copy(DataA.data(), PtrA, Size); - Queue.copy(DataB.data(), PtrB, Size); - Queue.copy(DataC.data(), PtrC, Size); - Queue.wait_and_throw(); - - Graph.begin_recording(Queue); - run_kernels_usm(Queue, Size, PtrA, PtrB, PtrC); - Graph.end_recording(); - - auto GraphExec = Graph.finalize(); - auto SubmitGraph = [&]() { - Queue.submit([&](handler &CGH) { CGH.ext_oneapi_graph(GraphExec); }); - }; - - std::vector Threads; - Threads.reserve(NumThreads); - - for (unsigned i = 0; i < NumThreads; ++i) { - Threads.emplace_back(SubmitGraph); - } - - for (unsigned i = 0; i < NumThreads; ++i) { - Threads[i].join(); - } - - Queue.wait_and_throw(); - - Queue.copy(PtrA, DataA.data(), Size); - Queue.copy(PtrB, DataB.data(), Size); - Queue.copy(PtrC, DataC.data(), Size); - Queue.wait_and_throw(); - - free(PtrA, Queue); - free(PtrB, Queue); - free(PtrC, Queue); - - assert(ReferenceA == DataA); - assert(ReferenceB == DataB); - assert(ReferenceC == DataC); - - return 0; -} diff --git a/sycl/test-e2e/Graph/Threading/update.cpp b/sycl/test-e2e/Graph/Threading/update.cpp deleted file mode 100644 index 95dddf66aa085..0000000000000 --- a/sycl/test-e2e/Graph/Threading/update.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// REQUIRES: level_zero, gpu, TEMPORARY_DISABLED -// Disabled as thread safety not yet implemented - -// RUN: %clangxx -pthread -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -// RUN: %{run} %t.out -// RUN: %if ext_oneapi_level_zero %{env ZE_DEBUG=4 %{run} %t.out 2>&1 | FileCheck %s %} -// -// CHECK-NOT: LEAK - -// Test updating a graph in a threaded situation. -// The second run is to check that there are no leaks reported with the embedded -// ZE_DEBUG=4 testing capability. - -#include "../graph_common.hpp" - -#include - -int main() { - queue Queue; - - using T = int; - - const unsigned NumThreads = std::thread::hardware_concurrency(); - std::vector DataA(Size), DataB(Size), DataC(Size); - - std::iota(DataA.begin(), DataA.end(), 1); - std::iota(DataB.begin(), DataB.end(), 10); - std::iota(DataC.begin(), DataC.end(), 1000); - - auto DataA2 = DataA; - auto DataB2 = DataB; - auto DataC2 = DataC; - - exp_ext::command_graph GraphA{Queue.get_context(), Queue.get_device()}; - - T *PtrA = malloc_device(Size, Queue); - T *PtrB = malloc_device(Size, Queue); - T *PtrC = malloc_device(Size, Queue); - - Queue.copy(DataA.data(), PtrA, Size); - Queue.copy(DataB.data(), PtrB, Size); - Queue.copy(DataC.data(), PtrC, Size); - Queue.wait_and_throw(); - - GraphA.begin_recording(Queue); - run_kernels_usm(Queue, Size, PtrA, PtrB, PtrC); - GraphA.end_recording(); - - auto GraphExec = GraphA.finalize(); - - exp_ext::command_graph GraphB{Queue.get_context(), Queue.get_device()}; - - T *PtrA2 = malloc_device(Size, Queue); - T *PtrB2 = malloc_device(Size, Queue); - T *PtrC2 = malloc_device(Size, Queue); - - Queue.copy(DataA2.data(), PtrA2, Size); - Queue.copy(DataB2.data(), PtrB2, Size); - Queue.copy(DataC2.data(), PtrC2, Size); - Queue.wait_and_throw(); - - GraphB.begin_recording(Queue); - run_kernels_usm(Queue, Size, PtrA2, PtrB2, PtrC2); - GraphB.end_recording(); - - auto UpdateGraph = [&]() { GraphExec.update(GraphB); }; - - std::vector Threads; - Threads.reserve(NumThreads); - - for (unsigned i = 0; i < NumThreads; ++i) { - Threads.emplace_back(UpdateGraph); - } - - for (unsigned i = 0; i < NumThreads; ++i) { - Threads[i].join(); - } - - free(PtrA, Queue); - free(PtrB, Queue); - free(PtrC, Queue); - - return 0; -}