Skip to content

Conversation

@KseniyaTikhomirova
Copy link
Contributor

@KseniyaTikhomirova KseniyaTikhomirova commented Dec 11, 2024

Fixes places with copy instead of usage by reference or move.
Protected potential but unlikely constant overflow with exception.

Signed-off-by: Tikhomirova, Kseniya <[email protected]>
Signed-off-by: Tikhomirova, Kseniya <[email protected]>
Signed-off-by: Tikhomirova, Kseniya <[email protected]>
PersistentDeviceCodeCache::getCompiledKernelFromDisc(
const std::vector<device> &Devices, const std::string &BuildOptionsString,
const std::string SourceStr) {
const std::string &SourceStr) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think more idiomatic fix would be to use std::string_view.

Copy link
Contributor Author

@KseniyaTikhomirova KseniyaTikhomirova Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am eliminating extra copy here, no intention to change types.


if (URDevicesSet.size() > 1) {
// emplace all subsets of the current set of devices into the cache.
// Set of all devices is not included in the loop as it was already added
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment ("Set of all devices is not included...") needs to be moved to the line 832, if I understand the logic correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed 19983fe

// emplace all subsets of the current set of devices into the cache.
// Set of all devices is not included in the loop as it was already added
// into the cache.
for (int Mask = 1; Mask < (1 << URDevicesSet.size()) - 1; ++Mask) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is much more maintainable than the new one. Also, if the problem is the "overflow" here, then it's inherent part of the problem. We'll have that many entries in the resulting set anyway (and likely OOM regardless).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed in person, fixed in 19983fe

Signed-off-by: Tikhomirova, Kseniya <[email protected]>
Copy link
Contributor

@aelovikov-intel aelovikov-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once the description is updated.

@KseniyaTikhomirova
Copy link
Contributor Author

LGTM once the description is updated.

description is updated now, thanks

@aelovikov-intel aelovikov-intel merged commit 12134d7 into intel:sycl Dec 13, 2024
14 checks passed
KornevNikita pushed a commit that referenced this pull request Feb 25, 2025
Fixes places with copy instead of usage by reference or move.
Protected potential but unlikely constant overflow with exception.

---------

Signed-off-by: Tikhomirova, Kseniya <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants