Skip to content

[SYCL][NFC] Minor Coverity fixes #19460

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

Merged
merged 2 commits into from
Jul 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sycl/source/detail/context_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ namespace detail {
context_impl::context_impl(const std::vector<sycl::device> Devices,
async_handler AsyncHandler,
const property_list &PropList, private_tag)
: MOwnedByRuntime(true), MAsyncHandler(AsyncHandler), MDevices(Devices),
MContext(nullptr),
: MOwnedByRuntime(true), MAsyncHandler(std::move(AsyncHandler)),
MDevices(std::move(Devices)), MContext(nullptr),
MPlatform(detail::getSyclObjImpl(MDevices[0].get_platform())),
MPropList(PropList), MSupportBufferLocationByDevices(NotChecked) {
verifyProps(PropList);
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const RTDeviceBinaryImage *retrieveKernelBinary(queue_impl &Queue,
bool isHIP = Dev.getBackend() == backend::ext_oneapi_hip;
if (isNvidia || isHIP) {
auto KernelID = ProgramManager::getInstance().getSYCLKernelID(KernelName);
std::vector<kernel_id> KernelIds{KernelID};
std::vector<kernel_id> KernelIds{std::move(KernelID)};
auto DeviceImages =
ProgramManager::getInstance().getRawDeviceImages(KernelIds);
auto DeviceImage = std::find_if(
Expand Down
24 changes: 22 additions & 2 deletions xptifw/src/xpti_trace_framework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2256,7 +2256,17 @@ class Framework {
}

uint8_t registerStream(const char *StreamName) {
return (uint8_t)MStreamStringTable.add(StreamName);
xpti::string_id_t StreamID = MStreamStringTable.add(StreamName);

// string_id_t is uint32_t while return type is uint8_t, so we need to
// check if the ID is valid and fits into uint8_t.
if (StreamID == xpti::invalid_id<xpti::string_id_t>)
return xpti::invalid_id<uint8_t>;
else {
assert(StreamID < std::numeric_limits<uint8_t>::max() &&
"StreamID exceeds the maximum value for uint8_t");
return static_cast<uint8_t>(StreamID);
}
}

///
Expand Down Expand Up @@ -2284,7 +2294,17 @@ class Framework {
}

uint8_t registerVendor(const char *StreamName) {
return (uint8_t)MVendorStringTable.add(StreamName);
xpti::string_id_t StreamID = MVendorStringTable.add(StreamName);

// string_id_t is uint32_t while return type is uint8_t, so we need to
// check if the ID is valid and fits into uint8_t.
if (StreamID == xpti::invalid_id<xpti::string_id_t>)
return xpti::invalid_id<uint8_t>;
else {
assert(StreamID < std::numeric_limits<uint8_t>::max() &&
"StreamID exceeds the maximum value for uint8_t");
return static_cast<uint8_t>(StreamID);
}
}

string_id_t registerString(const char *String, char **TableString) {
Expand Down
Loading