Skip to content

Commit 7796057

Browse files
authored
[SYCL][Doc] Move uniform extension spec (#11259)
The uniform extension was implemented in #5871. Move the extension specification document to the "experimental" directory, and update to the latest specification template. Also fix a small bug in the implementation. The `sycl::id` type should not be disallowed for use in `uniform`. Although, it is invalid to pass the work-item's ID to `uniform` (because that value is not uniform across all work-items), the user could construct their own `id` that does have a uniform value.
1 parent 2c53815 commit 7796057

File tree

2 files changed

+53
-67
lines changed

2 files changed

+53
-67
lines changed

sycl/doc/extensions/proposed/sycl_ext_oneapi_uniform.asciidoc renamed to sycl/doc/extensions/experimental/sycl_ext_oneapi_uniform.asciidoc

Lines changed: 52 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
= sycl_ext_oneapi_uniform
2+
23
:source-highlighter: coderay
34
:coderay-linenums-mode: table
45

@@ -8,69 +9,60 @@
89
:toc: left
910
:encoding: utf-8
1011
:lang: en
11-
12-
:blank: pass:[ +]
12+
:dpcpp: pass:[DPC++]
1313

1414
// Set the default source code type in this document to C++,
1515
// for syntax highlighting purposes. This is needed because
1616
// docbook uses c++ and html5 uses cpp.
1717
:language: {basebackend@docbook:c++:cpp}
1818

19-
== Introduction
20-
IMPORTANT: This specification is a draft.
21-
22-
NOTE: Khronos(R) is a registered trademark and SYCL(TM) and SPIR(TM) are trademarks of The Khronos Group Inc. OpenCL(TM) is a trademark of Apple Inc. used by permission by Khronos.
23-
24-
NOTE: This document is better viewed when rendered as html with asciidoctor. GitHub does not render image icons.
25-
26-
This extension introduces a mechanism to assert that the value of a variable is
27-
the same for all work-items in a sub-group.
2819

2920
== Notice
3021

31-
Copyright (c) 2021 Intel Corporation. All rights reserved.
22+
[%hardbreaks]
23+
Copyright (C) 2021-2023 Intel Corporation. All rights reserved.
3224

33-
== Status
25+
Khronos(R) is a registered trademark and SYCL(TM) and SPIR(TM) are trademarks
26+
of The Khronos Group Inc. OpenCL(TM) is a trademark of Apple Inc. used by
27+
permission by Khronos.
3428

35-
Working Draft
3629

37-
This is a preview extension specification, intended to provide early access to a feature for review and community feedback. When the feature matures, this specification may be released as a formal extension.
30+
== Contact
3831

39-
Because the interfaces defined by this specification are not final and are subject to change they are not intended to be used by shipping software products.
32+
To report problems with this extension, please open a new issue at:
4033

41-
== Version
34+
https://github.com/intel/llvm/issues
4235

43-
Built On: {docdate} +
44-
Revision: 1
4536

46-
== Contacts
37+
== Contributors
4738

4839
John Pennycook, Intel (john 'dot' pennycook 'at' intel 'dot' com) +
4940
Roland Schulz, Intel (roland 'dot' schulz 'at' intel 'dot' com) +
5041
Jason Sewall, Intel (jason 'dot' sewall 'at' intel 'dot' com) +
5142

43+
5244
== Dependencies
5345

54-
This extension is written against the SYCL 2020 specification, Revision 2.
46+
This extension is written against the SYCL 2020 revision 7 specification. All
47+
references below to the "core SYCL specification" or to section numbers in the
48+
SYCL specification refer to that revision.
5549

56-
== Feature Test Macro
5750

58-
This extension provides a feature-test macro as described in the core SYCL
59-
specification section 6.3.3 "Feature test macros". Therefore, an
60-
implementation supporting this extension must predefine the macro
61-
`SYCL_EXT_ONEAPI_UNIFORM` to one of the values defined in the table below.
62-
Applications can test for the existence of this macro to determine if the
63-
implementation supports this feature, or applications can test the macro's
64-
value to determine which of the extension's APIs the implementation supports.
51+
== Status
52+
53+
This is an experimental extension specification, intended to provide early
54+
access to features and gather community feedback. Interfaces defined in this
55+
specification are implemented in {dpcpp}, but they are not finalized and may
56+
change incompatibly in future versions of {dpcpp} without prior notice.
57+
*Shipping software products should not rely on APIs defined in this
58+
specification.*
6559

66-
[%header,cols="1,5"]
67-
|===
68-
|Value |Description
69-
|1 |Initial extension version. Base features are supported.
70-
|===
7160

7261
== Overview
7362

63+
This extension introduces a mechanism to assert that the value of a variable is
64+
the same for all work-items in a sub-group.
65+
7466
Some implementations of SYCL map work-items in the same sub-group to SIMD
7567
hardware. The performance of such implementations can be improved by knowledge
7668
of how the values held by each work-item relate to one another. In the general
@@ -84,7 +76,30 @@ These concepts are already exposed in other SPMD programming models:
8476
- OpenMP's `declare simd` directive has a `uniform` clause
8577
- ISPC's `uniform` qualifier makes uniformity part of the type system
8678

87-
== Defining Uniform Values
79+
80+
== Specification
81+
82+
=== Feature test macro
83+
84+
This extension provides a feature-test macro as described in the core SYCL
85+
specification. An implementation supporting this extension must predefine the
86+
macro `SYCL_EXT_ONEAPI_UNIFORM` to one of the values defined in the table
87+
below. Applications can test for the existence of this macro to determine if
88+
the implementation supports this feature, or applications can test the macro's
89+
value to determine which of the extension's features the implementation
90+
supports.
91+
92+
[%header,cols="1,5"]
93+
|===
94+
|Value
95+
|Description
96+
97+
|1
98+
|The APIs of this experimental extension are not versioned, so the
99+
feature-test macro always has this value.
100+
|===
101+
102+
=== Defining uniform values
88103

89104
The `sycl::ext::oneapi::experimental::uniform` wrapper type can be used to assert that
90105
the value of a variable is the same for all work-items in a sub-group.
@@ -150,7 +165,8 @@ a value taken from any work-item in the sub-group; if the input to the
150165
constructor was not uniform, or the constructor was not encountered in
151166
converged control flow, then the resulting value is undefined.
152167

153-
== Example Usage
168+
169+
== Example usage
154170

155171
This non-normative section shows some example usages of the extension.
156172

@@ -183,32 +199,3 @@ if (sycl::ext::oneapi::experimental::uniform(condition)) {
183199
Asserting that all work-items in the sub-group access the same memory location:
184200
```c++
185201
float x = array[sycl::ext::oneapi::experimental::uniform(index)];
186-
```
187-
188-
== Issues
189-
190-
//. asd
191-
//+
192-
//--
193-
//*RESOLUTION*: Not resolved.
194-
//--
195-
196-
== Revision History
197-
198-
[cols="5,15,15,70"]
199-
[grid="rows"]
200-
[options="header"]
201-
|========================================
202-
|Rev|Date|Author|Changes
203-
|1|2021-04-23|John Pennycook|*Initial public working draft*
204-
|2|2021-08-03|John Pennycook|*Add const and deleted operators*
205-
|========================================
206-
207-
//************************************************************************
208-
//Other formatting suggestions:
209-
//
210-
//* Use *bold* text for host APIs, or [source] syntax highlighting.
211-
//* Use +mono+ text for device APIs, or [source] syntax highlighting.
212-
//* Use +mono+ text for extension names, types, or enum values.
213-
//* Use _italics_ for parameters.
214-
//************************************************************************

sycl/include/sycl/ext/oneapi/experimental/uniform.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ static inline constexpr bool is_instance_of_tmpl_int_bool_v =
5757

5858
template <class T> class uniform {
5959
template <class U> static constexpr bool can_be_uniform() {
60-
return !detail::is_instance_of_tmpl_int_v<U, sycl::id> &&
61-
!detail::is_instance_of_tmpl_int_bool_v<U, sycl::item> &&
60+
return !detail::is_instance_of_tmpl_int_bool_v<U, sycl::item> &&
6261
!detail::is_instance_of_tmpl_int_v<U, sycl::nd_item> &&
6362
!detail::is_instance_of_tmpl_int_v<U, sycl::h_item> &&
6463
!detail::is_instance_of_tmpl_int_v<U, sycl::group> &&

0 commit comments

Comments
 (0)