-
Notifications
You must be signed in to change notification settings - Fork 109
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
[oneDPL] Create a subsection for is_execution_policy type trait #567
base: main
Are you sure you want to change the base?
Conversation
source/elements/oneDPL/source/parallel_api/execution_policies.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Dan Hoeflinger <[email protected]>
source/elements/oneDPL/source/parallel_api/execution_policies.rst
Outdated
Show resolved
Hide resolved
source/elements/oneDPL/source/parallel_api/execution_policies.rst
Outdated
Show resolved
Hide resolved
source/elements/oneDPL/source/parallel_api/execution_policies.rst
Outdated
Show resolved
Hide resolved
source/elements/oneDPL/source/parallel_api/execution_policies.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Ruslan Arutyunyan <[email protected]>
source/elements/oneDPL/source/parallel_api/execution_policies.rst
Outdated
Show resolved
Hide resolved
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.
Generally LGTM, optional comment about the decay note.
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.
LGTM
b672405
to
0c955d7
Compare
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, looks good to me. I left some small comments that do look as improvements to me. But you might disagree
struct is_execution_policy { /*see below*/ }; | ||
|
||
template <class T> | ||
constexpr bool is_execution_policy_v = oneapi::dpl::is_execution_policy<T>::value; |
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.
constexpr bool is_execution_policy_v = oneapi::dpl::is_execution_policy<T>::value; | |
inline constexpr bool is_execution_policy_v = oneapi::dpl::is_execution_policy<T>::value; |
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.
It's a template, inline
should not be needed. See the standard (https://eel.is/c++draft/execution.syn):
namespace std {
// [execpol.type], execution policy type trait
template<class T> struct is_execution_policy;
template<class T> constexpr bool is_execution_policy_v = is_execution_policy<T>::value;
}
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.
OK, seems inline
is necessary for C++17/20. Thanks, I will get it back.
struct is_execution_policy { /*see below*/ }; | ||
|
||
template <class T> | ||
constexpr bool is_execution_policy_v = oneapi::dpl::execution::is_execution_policy<T>::value; |
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.
constexpr bool is_execution_policy_v = oneapi::dpl::execution::is_execution_policy<T>::value; | |
inline constexpr bool is_execution_policy_v = oneapi::dpl::execution::is_execution_policy<T>::value; |
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.
Same here.
to the same class template. It is unspecified in which namespace the underlying class template and its specializations | ||
are defined. |
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.
to the same class template. It is unspecified in which namespace the underlying class template and its specializations | |
are defined. | |
to the same class template. It is unspecified, which namespace the underlying class template and its specializations | |
are defined in. |
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.
Spellcheckers do not complain :), so I will keep this intact.
The ``oneapi::dpl::execution::is_execution_policy`` class originated in the oneDPL specification version 1.0, | ||
while ``oneapi::dpl::is_execution_policy`` has been added later to better align with the C++ standard. | ||
|
||
For writing new code, use of the type trait utilities in ``namespace oneapi::dpl`` is strongly recommended. Those |
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.
For writing new code, use of the type trait utilities in ``namespace oneapi::dpl`` is strongly recommended. Those | |
For a new code, use of the type trait utilities in ``namespace oneapi::dpl`` is highly encouraged. Those |
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.
Made a similar change.
``is_execution_policy<T>`` must have the characteristics of ``std::true_type`` if ``T`` is one of the above specified or | ||
implementation-defined oneDPL execution policy types, otherwise it must have the characteristics of ``std::false_type``. |
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.
What's the point of this super generic and kind of vague wording?
I specifically mean "is one of the above specified or implementation-defined oneDPL execution policy types".
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.
Compare with the C++ standard wording:
is_execution_policy<T>
is a Cpp17UnaryTypeTrait with a base characteristic oftrue_type
ifT
is the type of a standard or implementation-defined execution policy, otherwisefalse_type
.
It is assumed that an implementation can define additional policy types, for which the trait also resolves to true_type
.
This PR describes oneDPL
is_execution_policy
trait in more detail, and also addresses #558.