diff --git a/sycl/source/detail/graph_impl.cpp b/sycl/source/detail/graph_impl.cpp index 0c9394045acfa..861ec2a883601 100644 --- a/sycl/source/detail/graph_impl.cpp +++ b/sycl/source/detail/graph_impl.cpp @@ -405,7 +405,7 @@ std::set> graph_impl::getCGEdges( } } - return std::move(UniqueDeps); + return UniqueDeps; } void graph_impl::markCGMemObjs( @@ -1563,7 +1563,7 @@ void exec_graph_impl::updateImpl(std::shared_ptr Node) { } } - UpdateDesc.hNewKernel = nullptr; + UpdateDesc.hNewKernel = UrKernel; UpdateDesc.numNewMemObjArgs = MemobjDescs.size(); UpdateDesc.pNewMemObjArgList = MemobjDescs.data(); UpdateDesc.numNewPointerArgs = PtrDescs.size(); @@ -1852,24 +1852,7 @@ void dynamic_parameter_impl::updateValue(const raw_kernel_arg *NewRawValue, size_t RawArgSize = NewRawValue->MArgSize; const void *RawArgData = NewRawValue->MArgData; - for (auto &[NodeWeak, ArgIndex] : MNodes) { - auto NodeShared = NodeWeak.lock(); - if (NodeShared) { - dynamic_parameter_impl::updateCGArgValue( - NodeShared->MCommandGroup, ArgIndex, RawArgData, RawArgSize); - } - } - - for (auto &DynCGInfo : MDynCGs) { - auto DynCG = DynCGInfo.DynCG.lock(); - if (DynCG) { - auto &CG = DynCG->MKernels[DynCGInfo.CGIndex]; - dynamic_parameter_impl::updateCGArgValue(CG, DynCGInfo.ArgIndex, - RawArgData, RawArgSize); - } - } - - std::memcpy(MValueStorage.data(), RawArgData, RawArgSize); + updateValue(RawArgData, RawArgSize); } void dynamic_parameter_impl::updateValue(const void *NewValue, size_t Size) { @@ -1987,7 +1970,6 @@ dynamic_command_group_impl::dynamic_command_group_impl( void dynamic_command_group_impl::finalizeCGFList( const std::vector> &CGFList) { - // True if kernels use sycl::nd_range, and false if using sycl::range for (size_t CGFIndex = 0; CGFIndex < CGFList.size(); CGFIndex++) { const auto &CGF = CGFList[CGFIndex]; // Handler defined inside the loop so it doesn't appear to the runtime diff --git a/sycl/source/detail/graph_impl.hpp b/sycl/source/detail/graph_impl.hpp index 11b432f208ea1..6144e3f51b9da 100644 --- a/sycl/source/detail/graph_impl.hpp +++ b/sycl/source/detail/graph_impl.hpp @@ -417,7 +417,7 @@ class node_impl : public std::enable_shared_from_this { throw sycl::exception(sycl::errc::invalid, "Cannot update execution range of a node with an " "execution range of different dimensions than what " - "the node was original created with."); + "the node was originally created with."); } NDRDesc = sycl::detail::NDRDescT{ExecutionRange}; @@ -438,7 +438,7 @@ class node_impl : public std::enable_shared_from_this { throw sycl::exception(sycl::errc::invalid, "Cannot update execution range of a node with an " "execution range of different dimensions than what " - "the node was original created with."); + "the node was originally created with."); } NDRDesc = sycl::detail::NDRDescT{ExecutionRange}; @@ -1173,11 +1173,6 @@ class graph_impl : public std::enable_shared_from_this { /// @param Deps List of dependent nodes void addDepsToNode(std::shared_ptr Node, std::vector> &Deps) { - // Remove empty shared pointers from the list - auto EmptyElementIter = - std::remove(Deps.begin(), Deps.end(), std::shared_ptr()); - Deps.erase(EmptyElementIter, Deps.end()); - if (!Deps.empty()) { for (auto &N : Deps) { N->registerSuccessor(Node); diff --git a/sycl/source/handler.cpp b/sycl/source/handler.cpp index adb1e2ee50796..a7ac73f9e4c34 100644 --- a/sycl/source/handler.cpp +++ b/sycl/source/handler.cpp @@ -556,7 +556,10 @@ event handler::finalize() { // node can set it as a predecessor. auto DependentNode = GraphImpl->getLastInorderNode(MQueue); std::vector> - Deps = {DependentNode}; + Deps; + if (DependentNode) { + Deps.push_back(DependentNode); + } NodeImpl = GraphImpl->add(NodeType, std::move(CommandGroup), Deps); // If we are recording an in-order queue remember the new node, so it @@ -566,7 +569,11 @@ event handler::finalize() { } else { auto LastBarrierRecordedFromQueue = GraphImpl->getBarrierDep(MQueue); std::vector> - Deps = {LastBarrierRecordedFromQueue}; + Deps; + + if (LastBarrierRecordedFromQueue) { + Deps.push_back(LastBarrierRecordedFromQueue); + } NodeImpl = GraphImpl->add(NodeType, std::move(CommandGroup), Deps); if (NodeImpl->MCGType == sycl::detail::CGType::Barrier) {