Skip to content

Commit 2fb6362

Browse files
committed
[SYCL] Align some extensions with SYCL 2020
This patch 1. aligns these extensions with SYCL 2020 [section #6 in the spec]: - Enqueue barrier [SYCL_EXT_INTEL_ENQUEUE_BARRIER] - Level Zero backend [SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO] - Local memory [SYCL_EXT_ONEAPI_LOCAL_MEMORY] - mem_channel property [SYCL_EXT_INTEL_MEM_CHANNEL_PROPERTY] - USM address spaces [SYCL_EXT_INTEL_USM_ADDRESS_SPACES] 2. deprecates these extensions: - sycl::detail::bit_cast [SYCL_INTEL_bitcast] 3. changes the location of these extensions: - sycl::ext::intel::online_compiler moves to sycl::ext::intel::experimental. sycl::ext::intel::online_compiler is deprecated.
1 parent 8075463 commit 2fb6362

File tree

23 files changed

+454
-418
lines changed

23 files changed

+454
-418
lines changed

sycl/doc/CompilerAndRuntimeDesign.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -918,8 +918,8 @@ space attributes in SYCL mode:
918918
| Address space attribute | SYCL address_space enumeration |
919919
|-------------------------|--------------------------------|
920920
| `__attribute__((opencl_global))` | global_space, constant_space |
921-
| `__attribute__((opencl_global_host))` | global_host_space |
922-
| `__attribute__((opencl_global_device))` | global_device_space |
921+
| `__attribute__((opencl_global_host))` | ext_intel_global_host_space |
922+
| `__attribute__((opencl_global_device))` | ext_intel_global_device_space |
923923
| `__attribute__((opencl_local))` | local_space |
924924
| `__attribute__((opencl_private))` | private_space |
925925
| `__attribute__((opencl_constant))` | N/A

sycl/doc/extensions/EnqueueBarrier/enqueue_barrier.asciidoc

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= SYCL_INTEL_enqueue_barrier
1+
= SYCL_EXT_INTEL_ENQUEUE_BARRIER
22
:source-highlighter: coderay
33
:coderay-linenums-mode: table
44

@@ -50,6 +50,22 @@ Revision: 1
5050
== Contact
5151
Please open an issue in the https://github.com/intel/llvm/tree/sycl/sycl/doc/extensions/[extensions repository]
5252

53+
== Feature Test Macro
54+
55+
This extension provides a feature-test macro as described in the core SYCL
56+
specification section 6.3.3 "Feature test macros". Therefore, an
57+
implementation supporting this extension must predefine the macro
58+
`SYCL_EXT_INTEL_ENQUEUE_BARRIER` to one of the values defined in the table below.
59+
Applications can test for the existence of this macro to determine if the
60+
implementation supports this feature, or applications can test the macro's
61+
value to determine which of the extension's APIs the implementation supports.
62+
63+
[%header,cols="1,5"]
64+
|===
65+
|Value |Description
66+
|1 |Initial extension version. Base features are supported.
67+
|===
68+
5369
== Dependencies
5470

5571
This extension is written against the SYCL 1.2.1 specification, Revision v1.2.1-6.
@@ -75,9 +91,9 @@ two new members to the `queue` class:
7591
[grid="rows"]
7692
[options="header"]
7793
|========================================
78-
|*handler::barrier*|*queue::submit_barrier*
79-
|`void barrier()` | `event submit_barrier()`
80-
|`void barrier( const vector_class<event> &waitList )` | `event submit_barrier( const vector_class<event> &waitList )`
94+
|*handler::ext_intel_barrier*|*queue::ext_intel_submit_barrier*
95+
|`void ext_intel_barrier()` | `event ext_intel_submit_barrier()`
96+
|`void ext_intel_barrier( const vector_class<event> &waitList )` | `event ext_intel_submit_barrier( const vector_class<event> &waitList )`
8197
|========================================
8298

8399
The first variant of the barrier takes no parameters, and waits for all previously submitted commands to the queue to enter the `info::event_command_status::complete` state before any command later submitted to the same queue is allowed to execute. A second variant of the barrier accepts a list of events, with the behavior that no commands submitted to the same queue after barrier submission may execute until all events in the `waitList` have entered the `info::event_command_status::complete` state. Both variants are non-blocking from the host program perspective, in that they do not wait for the barrier conditions to have been met before returning.
@@ -93,7 +109,7 @@ Some forms of the new barrier methods return an `event`, which can be used to pe
93109

94110
CG4 doesn't execute until all previous command groups submitted to the same queue (CG1, CG2, CG3) have entered the completed state.
95111

96-
==== 1. Using `handler::barrier()`:
112+
==== 1. Using `handler::ext_intel_barrier()`:
97113

98114
[source,c++,NoName,linenums]
99115
----
@@ -109,7 +125,7 @@ Queue.submit([&](cl::sycl::handler& cgh) {
109125
});
110126
111127
Queue.submit([&](cl::sycl::handler& cgh) {
112-
cgh.barrier();
128+
cgh.ext_intel_barrier();
113129
});
114130
115131
Queue.submit([&](cl::sycl::handler& cgh) {
@@ -118,7 +134,7 @@ Queue.submit([&](cl::sycl::handler& cgh) {
118134
...
119135
----
120136

121-
==== 2. Using `queue::submit_barrier()`:
137+
==== 2. Using `queue::ext_intel_submit_barrier()`:
122138

123139
[source,c++,NoName,linenums]
124140
----
@@ -133,7 +149,7 @@ Queue.submit([&](cl::sycl::handler& cgh) {
133149
// CG3
134150
});
135151
136-
Queue.submit_barrier();
152+
Queue.ext_intel_submit_barrier();
137153
138154
Queue.submit([&](cl::sycl::handler& cgh) {
139155
// CG4
@@ -146,7 +162,7 @@ Queue.submit([&](cl::sycl::handler& cgh) {
146162

147163
CG3 requires CG1 (in Queue1) and CG2 (in Queue2) to have completed before it (CG3) begins execution.
148164

149-
==== 1. Using `handler::barrier()`:
165+
==== 1. Using `handler::ext_intel_barrier()`:
150166

151167
[source,c++,NoName,linenums]
152168
----
@@ -160,7 +176,7 @@ auto event_barrier2 = Queue2.submit([&](cl::sycl::handler& cgh) {
160176
});
161177
162178
Queue3.submit([&](cl::sycl::handler& cgh) {
163-
cgh.barrier( vector_class<event>{event_barrier1, event_barrier2} );
179+
cgh.ext_intel_barrier( vector_class<event>{event_barrier1, event_barrier2} );
164180
});
165181
166182
Queue3.submit([&](cl::sycl::handler& cgh) {
@@ -169,7 +185,7 @@ Queue3.submit([&](cl::sycl::handler& cgh) {
169185
...
170186
----
171187

172-
==== 2. Using `queue::submit_barrier()`:
188+
==== 2. Using `queue::ext_intel_submit_barrier()`:
173189

174190
[source,c++,NoName,linenums]
175191
----
@@ -182,7 +198,7 @@ auto event_barrier2 = Queue2.submit([&](cl::sycl::handler& cgh) {
182198
// CG2
183199
});
184200
185-
Queue3.submit_barrier( vector_class<event>{event_barrier1, event_barrier2} );
201+
Queue3.ext_intel_submit_barrier( vector_class<event>{event_barrier1, event_barrier2} );
186202
187203
Queue3.submit([&](cl::sycl::handler& cgh) {
188204
// CG3
@@ -211,9 +227,9 @@ void wait();
211227
template <typename T>
212228
event submit(T cgf, const queue &secondaryQueue);
213229
214-
event submit_barrier();
230+
event ext_intel_submit_barrier();
215231
216-
event submit_barrier( const vector_class<event> &waitList );
232+
event ext_intel_submit_barrier( const vector_class<event> &waitList );
217233
218234
void wait();
219235
...
@@ -225,8 +241,8 @@ void wait();
225241
[options="header"]
226242
|========================================
227243
|*Member functions*|*Description*
228-
|`event submit_barrier()` | Same effect as submitting a `handler::barrier()` within a command group to this `queue`. The returned event enters the `info::event_command_status::complete` state when all events that the barrier is dependent on (implicitly from all previously submitted commands to the same queue) have entered the `info::event_command_status::complete` state.
229-
|`event submit_barrier( const vector_class<event> &waitList )` | Same effect as submitting a `handler:barrier( const vector_class<event> &waitList )` within a command group to this `queue`. The returned event enters the `info::event_command_status::complete` state when all events that the barrier is dependent on (explicitly from `waitList`) have entered the `info::event_command_status::complete` state.
244+
|`event ext_intel_submit_barrier()` | Same effect as submitting a `handler::ext_intel_barrier()` within a command group to this `queue`. The returned event enters the `info::event_command_status::complete` state when all events that the barrier is dependent on (implicitly from all previously submitted commands to the same queue) have entered the `info::event_command_status::complete` state.
245+
|`event ext_intel_submit_barrier( const vector_class<event> &waitList )` | Same effect as submitting a `handler:ext_intel_barrier( const vector_class<event> &waitList )` within a command group to this `queue`. The returned event enters the `info::event_command_status::complete` state when all events that the barrier is dependent on (explicitly from `waitList`) have entered the `info::event_command_status::complete` state.
230246
|========================================
231247

232248

@@ -261,9 +277,9 @@ void fill(accessor<T, dim, mode, tgt> dest, const T& src);
261277
template<typename T, int dim, access::mode mode, access::target tgt>
262278
void fill(accessor<T, dim, mode, tgt> dest, const T& src);
263279
264-
void barrier();
280+
void ext_intel_barrier();
265281
266-
void barrier( const vector_class<event> &waitList );
282+
void ext_intel_barrier( const vector_class<event> &waitList );
267283
268284
};
269285
...
@@ -284,8 +300,8 @@ Barriers can be created by two members of the `handler` class that force synchro
284300
[options="header"]
285301
|========================================
286302
|*Member functions*|*Description*
287-
|`void barrier()` | Prevents any commands submitted afterward to this queue from executing until all commands previously submitted to this queue have entered the `info::event_command_status::complete` state.
288-
|`void barrier( const vector_class<event> &waitList` ) | Prevents any commands submitted afterward to this queue from executing until all events in `waitList` have entered the `info::event_command_status::complete` state. If `waitList` is empty, then the barrier has no effect.
303+
|`void ext_intel_barrier()` | Prevents any commands submitted afterward to this queue from executing until all commands previously submitted to this queue have entered the `info::event_command_status::complete` state.
304+
|`void ext_intel_barrier( const vector_class<event> &waitList` ) | Prevents any commands submitted afterward to this queue from executing until all events in `waitList` have entered the `info::event_command_status::complete` state. If `waitList` is empty, then the barrier has no effect.
289305
|========================================
290306

291307
== References
@@ -303,6 +319,7 @@ None.
303319
|========================================
304320
|Rev|Date|Author|Changes
305321
|1|2020-02-26|Ye Ting|*Initial public release*
322+
|2|2021-08-30|Dmitry Vodopyanov|*Updated according to SYCL 2020 reqs for extensions*
306323
|========================================
307324

308325
//************************************************************************

sycl/doc/extensions/LevelZeroBackend/LevelZeroBackend.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The Level-Zero backend is added to the cl::sycl::backend enumeration:
2323
``` C++
2424
enum class backend {
2525
// ...
26-
level_zero,
26+
ext_oneapi_level_zero,
2727
// ...
2828
};
2929
```
@@ -55,7 +55,7 @@ and they must be included in the order shown:
5555
5656
``` C++
5757
#include "level_zero/ze_api.h"
58-
#include "sycl/backend/level_zero.hpp"
58+
#include "sycl/ext/oneapi/backend/level_zero.hpp"
5959
```
6060
### 4.1 Mapping of SYCL objects to Level-Zero handles
6161

@@ -71,7 +71,7 @@ These SYCL objects encapsulate the corresponding Level-Zero handles:
7171

7272
### 4.2 Obtaining of native Level-Zero handles from SYCL objects
7373
74-
The ```get_native<cl::sycl::backend::level_zero>()``` member function is how a raw native Level-Zero handle can be obtained
74+
The ```get_native<cl::sycl::backend::ext_oneapi_level_zero>()``` member function is how a raw native Level-Zero handle can be obtained
7575
for a specific SYCL object. It is currently supported for SYCL ```platform```, ```device```, ```context```, ```queue```, ```event```
7676
and ```program``` classes. There is also a free-function defined in ```cl::sycl``` namespace that can be used instead of the member function:
7777
``` C++
@@ -81,7 +81,7 @@ auto get_native(const SyclObjectT &Obj) ->
8181
```
8282
### 4.3 Construct a SYCL object from a Level-Zero handle
8383
84-
The following free functions defined in the ```cl::sycl::level_zero``` namespace allow an application to create
84+
The following free functions defined in the ```cl::sycl::ext::oneapi::level_zero``` namespace allow an application to create
8585
a SYCL object that encapsulates a corresponding Level-Zero object:
8686
8787
| Level-Zero interoperability function |Description|
@@ -103,11 +103,15 @@ some interoperability API supports overriding this behavior and keep the ownersh
103103
Use this enumeration for explicit specification of the ownership:
104104
``` C++
105105
namespace sycl {
106+
namespace ext {
107+
namespace oneapi {
106108
namespace level_zero {
107109
108110
enum class ownership { transfer, keep };
109111
110112
} // namespace level_zero
113+
} // namespace oneapi
114+
} // namespace ext
111115
} // namespace sycl
112116
```
113117
@@ -193,3 +197,4 @@ struct free_memory {
193197
|3|2021-04-13|James Brodman|Free Memory Query
194198
|4|2021-07-06|Rehana Begam|Introduced explicit ownership for queue
195199
|5|2021-07-25|Sergey Maslov|Introduced SYCL interop for events
200+
|6|2021-08-30|Dmitry Vodopyanov|Updated according to SYCL 2020 reqs for extensions

sycl/doc/extensions/MemChannel/SYCL_INTEL_mem_channel_property.asciidoc renamed to sycl/doc/extensions/MemChannel/MemChannel.asciidoc

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= SYCL_INTEL_mem_channel_property
1+
= SYCL_EXT_INTEL_MEM_CHANNEL_PROPERTY
22

33
== Introduction
44
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.
@@ -31,6 +31,22 @@ This extension is written against the SYCL 2020 provisional specification, Revis
3131

3232
The use of this extension requires a target that supports cl_intel_mem_channel_property or equivalent if OpenCL is used as the underlying device runtime.
3333

34+
== Feature Test Macro
35+
36+
This extension provides a feature-test macro as described in the core SYCL
37+
specification section 6.3.3 "Feature test macros". Therefore, an
38+
implementation supporting this extension must predefine the macro
39+
`SYCL_EXT_INTEL_MEM_CHANNEL_PROPERTY` to one of the values defined in the table below.
40+
Applications can test for the existence of this macro to determine if the
41+
implementation supports this feature, or applications can test the macro's
42+
value to determine which of the extension's APIs the implementation supports.
43+
44+
[%header,cols="1,5"]
45+
|===
46+
|Value |Description
47+
|1 |Initial extension version. Base features are supported.
48+
|===
49+
3450
== Overview
3551

3652
On some targets manual assignment of buffers to memory regions can improve memory bandwidth. This extension adds a buffer property to indicate in which memory channel a particular buffer should be allocated. This information is an optimization hint to the runtime and thus it is legal to ignore.
@@ -45,7 +61,7 @@ Add a new property to Table 4.33: Properties supported by the SYCL buffer class
4561
[options="header"]
4662
|===
4763
| Property | Description
48-
| property::buffer::mem_channel | The `mem_channel` property is a hint to the SYCL runtime that the buffer should be stored in a particular memory channel provided to the property.
64+
| property::buffer::ext_intel_mem_channel | The `ext_intel_mem_channel` property is a hint to the SYCL runtime that the buffer should be stored in a particular memory channel provided to the property.
4965
|===
5066
--
5167

@@ -55,7 +71,7 @@ Add a new constructor to Table 4.34: Constructors of the buffer property classes
5571
[options="header"]
5672
|===
5773
| Constructor | Description
58-
| property::buffer::mem_channel::mem_channel(cl_uint channel) | Constructs a SYCL `mem_channel` property instance with the specified channel ID. The range of valid values depends on the target and is implementation defined. Invalid values do not need to result in an error as the property is only a hint.
74+
| property::buffer::ext_intel_mem_channel::ext_intel_mem_channel(cl_uint channel) | Constructs a SYCL `ext_intel_mem_channel` property instance with the specified channel ID. The range of valid values depends on the target and is implementation defined. Invalid values do not need to result in an error as the property is only a hint.
5975
|===
6076
--
6177

@@ -65,7 +81,7 @@ Add a new member function to Table 4.35: Member functions of the buffer property
6581
[options="header"]
6682
|===
6783
| Member function | Description
68-
| cl_uint property::buffer::mem_channel::get_channel() const | Returns the cl_uint which was specified when constructing this SYCL `mem_channel` property.
84+
| cl_uint property::buffer::ext_intel_mem_channel::get_channel() const | Returns the cl_uint which was specified when constructing this SYCL `ext_intel_mem_channel` property.
6985
|===
7086
--
7187

@@ -107,4 +123,6 @@ Add an entry for the new aspect to Table 4.20: Device aspects defined by the cor
107123
|========================================
108124
|Rev|Date|Author|Changes
109125
|1|2020-10-26|Joe Garvey|*Initial public draft*
126+
|2|2021-08-30|Dmitry Vodopyanov|*Updated according to SYCL 2020 reqs for extensions*
127+
110128
|========================================

sycl/doc/extensions/USMAddressSpaces/usm_address_spaces.asciidoc

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= SYCL_INTEL_usm_address_spaces
1+
= SYCL_EXT_INTEL_USM_ADDRESS_SPACES
22

33
== Introduction
44
This extension introduces two new address spaces and their corresponding multi_ptr specializations.
@@ -36,6 +36,22 @@ This extension is written against the SYCL 1.2.1 specification, Revision 7. It
3636

3737
If SPIR-V is used by the implementation, this extension also requires support for the SPV_INTEL_usm_storage_classes SPIR-V extension.
3838

39+
== Feature Test Macro
40+
41+
This extension provides a feature-test macro as described in the core SYCL
42+
specification section 6.3.3 "Feature test macros". Therefore, an
43+
implementation supporting this extension must predefine the macro
44+
`SYCL_EXT_INTEL_USM_ADDRESS_SPACES` to one of the values defined in the table below.
45+
Applications can test for the existence of this macro to determine if the
46+
implementation supports this feature, or applications can test the macro's
47+
value to determine which of the extension's APIs the implementation supports.
48+
49+
[%header,cols="1,5"]
50+
|===
51+
|Value |Description
52+
|1 |Initial extension version. Base features are supported.
53+
|===
54+
3955
== Overview
4056

4157
This extension adds two new address spaces: device and host that are subsets of the global address space.
@@ -121,4 +137,5 @@ using host_ptr = multi_ptr<ElementType, access::address_space::host_space>
121137
|========================================
122138
|Rev|Date|Author|Changes
123139
|A|2020-06-18|Joe Garvey|Initial public draft
140+
|B|2021-08-30|Dmitry Vodopyanov|Updated according to SYCL 2020 reqs for extensions
124141
|========================================

sycl/include/CL/sycl/access/access.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ enum class address_space : int {
4646
global_space = 1,
4747
constant_space = 2,
4848
local_space = 3,
49-
global_device_space = 4,
50-
global_host_space = 5
49+
ext_intel_global_device_space = 4,
50+
ext_intel_host_device_space = 5,
51+
global_device_space __SYCL2020_DEPRECATED("use ext_intel_global_device_space instead") = ext_intel_global_device_space,
52+
global_host_space __SYCL2020_DEPRECATED("use ext_intel_host_device_space instead") = ext_intel_host_device_space,
5153
};
5254

5355
} // namespace access

sycl/include/CL/sycl/backend_types.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ namespace sycl {
2121
enum class backend : char {
2222
host = 0,
2323
opencl = 1,
24-
level_zero = 2,
24+
ext_oneapi_level_zero = 2,
25+
level_zero __SYCL2020_DEPRECATED("use ext_oneapi_level_zero instead") = ext_oneapi_level_zero,
2526
cuda = 3,
2627
all = 4,
2728
esimd_cpu = 5,

sycl/include/CL/sycl/bit_cast.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ namespace detail {
2222
inline void memcpy(void *Dst, const void *Src, std::size_t Size);
2323
}
2424

25-
// sycl::bit_cast ( no longer sycl::detail::bit_cast )
2625
template <typename To, typename From>
2726
#if __cpp_lib_bit_cast || __has_builtin(__builtin_bit_cast)
2827
constexpr
@@ -54,6 +53,7 @@ constexpr
5453

5554
namespace detail {
5655
template <typename To, typename From>
56+
__SYCL2020_DEPRECATED("use sycl::bit_cast instead")
5757
#if __cpp_lib_bit_cast || __has_builtin(__builtin_bit_cast)
5858
constexpr
5959
#endif

sycl/include/CL/sycl/feature_test.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ namespace sycl {
2424
#define SYCL_EXT_ONEAPI_MATRIX 2
2525
#endif
2626
#define SYCL_EXT_INTEL_BF16_CONVERSION 1
27+
#define SYCL_EXT_INTEL_ENQUEUE_BARRIER 1
28+
#define SYCL_EXT_INTEL_MEM_CHANNEL_PROPERTY 1
29+
#define SYCL_EXT_INTEL_USM_ADDRESS_SPACES 1
30+
#define SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO 1
31+
2732

2833
} // namespace sycl
2934
} // __SYCL_INLINE_NAMESPACE(cl)

0 commit comments

Comments
 (0)