Skip to content

[Coverity] Variable copied when it could be moved #18412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AlexeySachkov opened this issue May 12, 2025 · 0 comments · Fixed by #18473
Closed

[Coverity] Variable copied when it could be moved #18412

AlexeySachkov opened this issue May 12, 2025 · 0 comments · Fixed by #18473
Labels
bug Something isn't working sycl-graph

Comments

@AlexeySachkov
Copy link
Contributor

intel/llvm Coverity scan reports a bunch of issues about missing opportunities to use std::move in graph implementation:

CID 489935:

if (Node->MCGType == sycl::detail::CGType::CodeplayHostTask) {
if (Node->MPartitionNum != -1) {
HostTaskList.push_front(Node);
}
return;
}

CID 489937: CGData.MEvents.push_back(Event);

if (CommandBuffer) {
for (std::vector<sycl::detail::EventImplPtr>::iterator It =
MExecutionEvents.begin();
It != MExecutionEvents.end();) {
auto Event = *It;
if (!Event->isCompleted()) {
auto &AttachedEventsList = Event->getPostCompleteEvents();
CGData.MEvents.reserve(CGData.MEvents.size() +
AttachedEventsList.size() + 1);
CGData.MEvents.push_back(Event);
// Add events of the previous execution of all graph partitions.
CGData.MEvents.insert(CGData.MEvents.end(),
AttachedEventsList.begin(),
AttachedEventsList.end());
++It;
} else {
// Remove completed events
It = MExecutionEvents.erase(It);
}
}

CID 490022:

impl->beginRecording(QueueImpl);

CID 490343:

void addEventForNode(std::shared_ptr<sycl::detail::event_impl> EventImpl,
std::shared_ptr<node_impl> NodeImpl) {
if (!(EventImpl->hasCommandGraph()))
EventImpl->setCommandGraph(shared_from_this());
MEventsMap[EventImpl] = NodeImpl;

@AlexeySachkov AlexeySachkov added bug Something isn't working sycl-graph labels May 12, 2025
fabiomestre added a commit to reble/llvm that referenced this issue May 14, 2025
fabiomestre added a commit to reble/llvm that referenced this issue May 14, 2025
fabiomestre added a commit to reble/llvm that referenced this issue May 14, 2025
fabiomestre added a commit to reble/llvm that referenced this issue May 14, 2025
fabiomestre added a commit to reble/llvm that referenced this issue May 16, 2025
kbenzie pushed a commit that referenced this issue May 19, 2025
…ce. (#18473)

Changes some functions in the sycl graph implementation to pass shared
pointers by reference instead of by value.

Fixes: #18412
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sycl-graph
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant