[SYCL RT][Coverity] Optimizing by moving instead of copy#22462
[SYCL RT][Coverity] Optimizing by moving instead of copy#22462Robertkq wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses Coverity findings in the SYCL runtime by eliminating unnecessary copies and enabling move semantics when forwarding temporaries (e.g., queue, std::shared_ptr, and std::string) into implementation/storage APIs.
Changes:
- Forward
queueparameters intokernel_impl::ext_oneapi_get_infoviastd::movefor several overloads. - Move event implementation pointers into
MEventsWaitWithBarrierto avoid refcounting/copies. - Move the final substring into the result vector in
split_stringto avoid an extra copy.
No control-flow changes were introduced beyond adding braces around an existing conditional; nothing here appears likely to impact profiling/debug info integrity.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| sycl/source/kernel.cpp | Move queue when delegating kernel::ext_oneapi_get_info overloads to the impl to avoid copies. |
| sycl/source/handler.cpp | Move EventImpl into MEventsWaitWithBarrier to avoid shared_ptr copies/refcount churn. |
| sycl/source/detail/split_string.hpp | Move LastSubStr into the result vector to avoid copying the last token. |
| sycl/source/detail/scheduler/commands.cpp | Move UnmapEventImpl into EventImpls to avoid copying shared_ptr. |
|
Moved to comment from PR body: For |

fixes #19234
This PR addresses the following CID:
490211, 490242, 490405, 512042. All of the otherCIDs that were specified by the issue #19234 have already been in the fixed state when I started working on this.