From 2332aedc8ffe24f755c4b8e5c69dcb408059ae67 Mon Sep 17 00:00:00 2001 From: John Pennycook Date: Thu, 12 Mar 2020 09:49:02 -0700 Subject: [PATCH 1/2] [SYCL][Doc] Add leader to GroupAlgorithms Signed-off-by: John Pennycook --- .../SYCL_INTEL_group_algorithms.asciidoc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sycl/doc/extensions/GroupAlgorithms/SYCL_INTEL_group_algorithms.asciidoc b/sycl/doc/extensions/GroupAlgorithms/SYCL_INTEL_group_algorithms.asciidoc index 8e0f68b001e39..60402a343cd5d 100755 --- a/sycl/doc/extensions/GroupAlgorithms/SYCL_INTEL_group_algorithms.asciidoc +++ b/sycl/doc/extensions/GroupAlgorithms/SYCL_INTEL_group_algorithms.asciidoc @@ -62,6 +62,7 @@ The extension introduces the following functions: - +any_of+ - +all_of+ - +none_of+ +- +leader+ - +broadcast+ - +reduce+ - +exclusive_scan+ @@ -181,6 +182,15 @@ It is undefined behavior for any of these functions to be invoked within a +para |Return +true+ if _pred_ returns +true+ for no element in the range [_first_, _last_). _first_, _last_ and _pred_ must be the same for all work-items in the group. |=== +==== Elect + +|=== +|Function|Description + +|+template bool leader(Group g);+ +|Return +true+ if the calling work-item is the elected leader of the group. +|=== + ==== Collectives In this section, the meaning of "exclusive scan" and "inclusive scan" are as defined in Sections 29.8.7 and 29.8.8 of the {cpp}17 specification, respectively. From 16b75967096b6786019ace72f15a18de74a0b6a4 Mon Sep 17 00:00:00 2001 From: John Pennycook Date: Thu, 12 Mar 2020 14:20:16 -0700 Subject: [PATCH 2/2] [SYCL][Doc] Clarify behavior of leader algorithm Signed-off-by: John Pennycook --- .../GroupAlgorithms/SYCL_INTEL_group_algorithms.asciidoc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sycl/doc/extensions/GroupAlgorithms/SYCL_INTEL_group_algorithms.asciidoc b/sycl/doc/extensions/GroupAlgorithms/SYCL_INTEL_group_algorithms.asciidoc index 60402a343cd5d..31392cd740a82 100755 --- a/sycl/doc/extensions/GroupAlgorithms/SYCL_INTEL_group_algorithms.asciidoc +++ b/sycl/doc/extensions/GroupAlgorithms/SYCL_INTEL_group_algorithms.asciidoc @@ -184,11 +184,13 @@ It is undefined behavior for any of these functions to be invoked within a +para ==== Elect +The +leader+ function provides a mechanism to _elect_ a single work-item as the leader of the group, commonly in order to execute a task once per group. + |=== |Function|Description |+template bool leader(Group g);+ -|Return +true+ if the calling work-item is the elected leader of the group. +|Return +true+ for exactly one work-item in the group, if the calling work-item is the elected leader of the group. Every call to +leader+ with the same group _g_ must elect the same work-item. |=== ==== Collectives