Skip to content

Conversation

@Alexandr-Konovalov
Copy link
Contributor

This allows us to pass size of kernel name that is known in compile time, not compute the size in run time.

This allows us to pass size of kernel name that is known in compile
time, not compute the size in run time.
Signed-off-by: Alexandr Konovalov <[email protected]>
@frasercrmck
Copy link
Contributor

FYI I see the same sort of Arc A-Series failures, tracked in #18668.

Signed-off-by: Alexandr Konovalov <[email protected]>
Signed-off-by: Alexandr Konovalov <[email protected]>
@jbrodman
Copy link
Contributor

So the basic idea here is that we compute the string length once at the start then can reuse the length every time we create a new view of it?

@Alexandr-Konovalov
Copy link
Contributor Author

So the basic idea here is that we compute the string length once at the start then can reuse the length every time we create a new view of it?

Actually, KernelNameStr is constexpr and I see no string length computation at run time.

Signed-off-by: Alexandr Konovalov <[email protected]>
@Alexandr-Konovalov Alexandr-Konovalov marked this pull request as ready for review June 2, 2025 06:27
@Alexandr-Konovalov Alexandr-Konovalov requested review from a team as code owners June 2, 2025 06:27
@Alexandr-Konovalov Alexandr-Konovalov requested a review from Bensuo June 2, 2025 06:27
Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

Overall LGTM! One smallish suggestion.

using KernelNameStrRefT = std::string_view;
using ABINeutralKernelNameStrT = detail::string_view;

inline KernelNameStrT toKernelNameStrT(ABINeutralKernelNameStrT str) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do the str argument constness need to differ between the definitions? I would prefer we keep them the same, even if it means removing const in the variant below. If it gets removed with breaking changes, I would argue it's better to have it the same and avoid the potential hidden faulty const use-cases we could have.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, probably I do not understand. Are you for passing detail::string_view by const reference, like this?

inline KernelNameStrT toKernelNameStrT(const ABINeutralKernelNameStrT &str) {
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
  return std::string_view(str);
#else
  return str.data();
#endif
}

Copy link
Contributor

Choose a reason for hiding this comment

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

If that is an option, that would be good! My point is just to avoid differing constness of the reference argument in the function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, let's unify.

@hvdijk
Copy link
Contributor

hvdijk commented Jun 2, 2025

As in #18565, this PR shows sycl/test/native_cpu/multiple_definitions.cpp being added but that doesn't belong in this PR, that came from #18726 and something went wrong in updating this PR.

@Alexandr-Konovalov
Copy link
Contributor Author

As in #18565, this PR shows sycl/test/native_cpu/multiple_definitions.cpp being added but that doesn't belong in this PR, that came from #18726 and something went wrong in updating this PR.

Thank you, removed form this PR as well.

@Alexandr-Konovalov
Copy link
Contributor Author

Colleagues @steffenlarsen , @Bensuo , could it be merged or not yet?

@steffenlarsen
Copy link
Contributor

Definitely!

@steffenlarsen steffenlarsen merged commit 73ff319 into intel:sycl Jun 3, 2025
23 checks passed
@Alexandr-Konovalov Alexandr-Konovalov deleted the Alexandr-Konovalov/string_view-size branch August 20, 2025 14:48
Comment on lines +71 to +77
explicit operator std::string_view() const noexcept {
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
return std::string_view(str, len);
#else
return std::string_view(str);
#endif
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we pass data() instead of str here?

Copy link
Contributor

Choose a reason for hiding this comment

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

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.

7 participants