-
Notifications
You must be signed in to change notification settings - Fork 795
[NFC][SYCL] Add sycl::detail::sycl_obj_hash helper
#19812
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
Conversation
Unfortunately, can't simplify further in C++17.
In C++20 that could be changed to
```
template <class T>
requires(is_sycl_common_reference_semantics_class_v<T>)
struct std::hash<T> {
// sycl_obj_hash impl inlined here.
};
```
But even in C++17 this PR removes copy-paste and places the
implementation in a single place.
| return createSyclObjFromImpl<T>(ImplRef.shared_from_this()); | ||
| } | ||
|
|
||
| template <typename T, bool UnsupportedOnDevice = false> struct sycl_obj_hash { |
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.
Please consider bool SupportedOnDevice = true, instead of double negation.
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.
I'm optimizing for the readability on the invocation here. IMO,
template std::hash<type> : sycl_obj_has<type, true /* UnsupportedOnDevice */> {}
reads better. @intel/llvm-reviewers-runtime , is there anybody who prefers @slawekptak's version more?
|
@intel/bindless-images-reviewers , ping. |
Ping x2 |
Unfortunately, can't simplify further in C++17.
In C++20 that could be changed to
But even in C++17 this PR removes copy-paste and places the implementation in a single place.