You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
is_native_function_object proved too difficult to implement and use in a
practical way. Replacing it with constraints makes the behavior of group
algorithms more predictable and enables users to detect which type combinations
are supported at compile-time.
Replacing several usages of static_assert with constraints will also be useful in
ensuring that group algorithms are not considered during overload resolution
if the first argument is an execution policy rather than a group or sub_group.
While updating the traits to use is_pointer I realized that several functions
would only support multi_ptr because they used Ptr::element_type. This is now
fixed, by using remove_pointer instead.
Signed-off-by: John Pennycook <john.pennycook@intel.com>
Copy file name to clipboardexpand all lines: sycl/doc/extensions/GroupAlgorithms/SYCL_INTEL_group_algorithms.asciidoc
+8-2
Original file line number
Diff line number
Diff line change
@@ -131,8 +131,6 @@ New function objects without {cpp} standard library equivalents are defined in t
131
131
|+T operator(const T&, const T&) const+ applies +std::greater+ to its arguments, in the same order, then returns the greater argument unchanged.
132
132
|===
133
133
134
-
Function objects supported by the group algorithms library can be identified using the +cl::sycl::intel::is_native_function_object+ and +cl::sycl::intel::is_native_function_object_v+ traits classes.
135
-
136
134
=== Functions
137
135
138
136
The group algorithms library is based on the algorithms library described in Section 28 of the {cpp}17 standard. The syntax and restrictions are aligned, with two notable differences: the first argument to each function is a group of work-items, in place of an execution policy; and pointers are accepted in place of iterators in order to guarantee that address space information is visible to the compiler.
@@ -145,6 +143,8 @@ Using functions from the group algorithms library inside of a kernel may introdu
145
143
146
144
It is undefined behavior for any of these functions to be invoked within a +parallel_for_work_group+ or +parallel_for_work_item+ context, but this restriction may be lifted in a future version of the proposal.
147
145
146
+
A number of the restrictions regarding the types of parameters that are acceptable for each algorithm must implemented as constraints: group arguments must be of a supported group class type; binary operations must be one of the group algorithms function objects; pointer arguments must be pointers to fundamental data types; and value arguments must be scalar fundamental data types (or vectors of those types).
147
+
148
148
==== Vote
149
149
150
150
|===
@@ -262,6 +262,11 @@ None.
262
262
//*RESOLUTION*: Not resolved.
263
263
//--
264
264
265
+
. How should `is_native_function_object` work? Does it represent what is minimally required by the specification, or what the implementation really supports?
266
+
--
267
+
*RESOLUTION*: The `is_native_function_object` trait has been removed. It proved too difficult to implement something that returned sensible values for transparent function objects (e.g. `std::plus<void>`) that did not also require checking additional traits for each individual group algorithm. Requiring the user to implement their own checks based on type requirements outlined in the specification would make it significantly harder for implementers to extend the algorithms to types and function objects beyond what is specified. Using constrained forms of the algorithms instead allows a user to determine whether an implementation of a particular algorithm exists using the C++ detection idiom.
268
+
--
269
+
265
270
== Revision History
266
271
267
272
[cols="5,15,15,70"]
@@ -270,6 +275,7 @@ None.
270
275
|========================================
271
276
|Rev|Date|Author|Changes
272
277
|1|2020-01-30|John Pennycook|*Initial public working draft*
278
+
|2|2020-09-10|John Pennycook|*Remove is_native_function_object and clarify which requirements are constraints*
0 commit comments