diff --git a/sycl/unittests/Extensions/CommandGraph.cpp b/sycl/unittests/Extensions/CommandGraph.cpp index b4746e1e745b8..bac29f791436d 100644 --- a/sycl/unittests/Extensions/CommandGraph.cpp +++ b/sycl/unittests/Extensions/CommandGraph.cpp @@ -1931,18 +1931,21 @@ TEST_F(MultiThreadGraphTest, RecordAddNodesInOrderQueue) { TEST_F(MultiThreadGraphTest, Finalize) { addKernels(Graph); + std::mutex MutexMap; + std::map> GraphsExecMap; auto FinalizeGraph = [&](int ThreadNum) { SyncPoint.wait(); auto GraphExec = Graph.finalize(); + Queue.submit([&](sycl::handler &CGH) { CGH.ext_oneapi_graph(GraphExec); }); + std::lock_guard Guard(MutexMap); GraphsExecMap.insert( std::map>:: value_type(ThreadNum, GraphExec)); - Queue.submit([&](sycl::handler &CGH) { CGH.ext_oneapi_graph(GraphExec); }); }; for (unsigned i = 0; i < NumThreads; ++i) {