Skip to content
Merged
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
11 changes: 8 additions & 3 deletions sycl/source/detail/device_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,16 @@ device_impl::get_device_info_string(ur_device_info_t InfoCode) const {
if (resultSize == 0) {
return std::string();
}
std::unique_ptr<char[]> result(new char[resultSize]);
std::string result;
// C++23's `resize_and_overwrite` would be better...
//
// UR counts null terminator in the size, std::string doesn't. Adjust by "-1"
// for that.
result.resize(resultSize - 1);
getAdapter()->call<UrApiKind::urDeviceGetInfo>(
getHandleRef(), InfoCode, resultSize, result.get(), nullptr);
getHandleRef(), InfoCode, resultSize, result.data(), nullptr);

return std::string(result.get());
return result;
}

// Specialization for string return type, variable return size
Expand Down