-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL] Add size to detail::string_view #18661
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
[SYCL] Add size to detail::string_view #18661
Conversation
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]>
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]>
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, |
Signed-off-by: Alexandr Konovalov <[email protected]>
There was a problem hiding this 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.
@@ -17,10 +18,19 @@ namespace detail { | |||
using KernelNameStrT = std::string_view; | |||
using KernelNameStrRefT = std::string_view; | |||
using ABINeutralKernelNameStrT = detail::string_view; | |||
|
|||
inline KernelNameStrT toKernelNameStrT(ABINeutralKernelNameStrT str) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
}
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, let's unify.
Colleagues @steffenlarsen , @Bensuo , could it be merged or not yet? |
Definitely! |
This allows us to pass size of kernel name that is known in compile time, not compute the size in run time.