Skip to content

Conversation

@aelovikov-intel
Copy link
Contributor

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.

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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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?

@aelovikov-intel
Copy link
Contributor Author

@intel/bindless-images-reviewers , ping.

@aelovikov-intel
Copy link
Contributor Author

@intel/bindless-images-reviewers , ping.

Ping x2

@aelovikov-intel aelovikov-intel merged commit 665516d into intel:sycl Aug 20, 2025
42 of 44 checks passed
@aelovikov-intel aelovikov-intel deleted the sycl_obj_hash branch August 20, 2025 14:11
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