Skip to content

Commit

Permalink
Refactor raw arg update
Browse files Browse the repository at this point in the history
  • Loading branch information
EwanC committed Oct 31, 2024
1 parent 9bd9cee commit 288324b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
24 changes: 3 additions & 21 deletions sycl/source/detail/graph_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ std::set<std::shared_ptr<node_impl>> graph_impl::getCGEdges(
}
}

return std::move(UniqueDeps);
return UniqueDeps;
}

void graph_impl::markCGMemObjs(
Expand Down Expand Up @@ -1563,7 +1563,7 @@ void exec_graph_impl::updateImpl(std::shared_ptr<node_impl> Node) {
}
}

UpdateDesc.hNewKernel = nullptr;
UpdateDesc.hNewKernel = UrKernel;
UpdateDesc.numNewMemObjArgs = MemobjDescs.size();
UpdateDesc.pNewMemObjArgList = MemobjDescs.data();
UpdateDesc.numNewPointerArgs = PtrDescs.size();
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -1987,7 +1970,6 @@ dynamic_command_group_impl::dynamic_command_group_impl(

void dynamic_command_group_impl::finalizeCGFList(
const std::vector<std::function<void(handler &)>> &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
Expand Down
4 changes: 2 additions & 2 deletions sycl/source/detail/graph_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ class node_impl : public std::enable_shared_from_this<node_impl> {
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};
Expand All @@ -438,7 +438,7 @@ class node_impl : public std::enable_shared_from_this<node_impl> {
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};
Expand Down

0 comments on commit 288324b

Please sign in to comment.