Skip to content

Commit b6143e5

Browse files
authored
[SYCL][Doc] Create sycl_ext_oneapi_queue_status_query.asciidoc (#5860)
This PR add a new sycl extension named `sycl_ext_oneapi_queue_status_query` (sorry for the bad name... and the bad ascii doc file!). It adds a few queue members functions (size, empty, get_wait_list) that were needed by some Argonne developers to port their code from CUDA to SYCL.
1 parent 8ec9755 commit b6143e5

File tree

1 file changed

+145
-0
lines changed

1 file changed

+145
-0
lines changed
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
= sycl_ext_oneapi_queue_status_query
2+
3+
:source-highlighter: coderay
4+
:coderay-linenums-mode: table
5+
6+
// This section needs to be after the document title.
7+
:doctype: book
8+
:toc2:
9+
:toc: left
10+
:encoding: utf-8
11+
:lang: en
12+
:dpcpp: pass:[DPC++]
13+
14+
// Set the default source code type in this document to C++,
15+
// for syntax highlighting purposes. This is needed because
16+
// docbook uses c++ and html5 uses cpp.
17+
:language: {basebackend@docbook:c++:cpp}
18+
19+
20+
== Notice
21+
22+
Copyright (C) 2022-2022 Intel Corporation. All rights reserved.
23+
24+
Khronos(R) is a registered trademark and SYCL(TM) and SPIR(TM) are trademarks
25+
of The Khronos Group Inc. OpenCL(TM) is a trademark of Apple Inc. used by
26+
permission by Khronos.
27+
28+
29+
== Contact
30+
31+
To report problems with this extension, please open a new issue at:
32+
33+
https://github.com/intel/llvm/issues
34+
35+
36+
== Dependencies
37+
38+
This extension is written against the SYCL 2020 revision 4 specification. All
39+
references below to the "core SYCL specification" or to section numbers in the
40+
SYCL specification refer to that revision.
41+
42+
== Status
43+
44+
This is a proposed extension specification, intended to gather community
45+
feedback. Interfaces defined in this specification may not be implemented yet
46+
or may be in a preliminary state. The specification itself may also change in
47+
incompatible ways before it is finalized. *Shipping software products should
48+
not rely on APIs defined in this specification.*
49+
50+
== Overview
51+
52+
CUDA has a stream API
53+
(link:https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html#group__CUDART__STREAM_1g2021adeb17905c7ec2a3c1bf125c5435[CudaStreamQuery]) which checks if all operations in a CUDA stream have been completed. Such a feature is lacking in `sycl::queue`. This extension adds a new query API to introspect queues. In particular, `ext_oneapi_empty` can be used to replace the `CudaStreamQuery`. This should ease the porting applications from CUDA to SYCL.
54+
55+
== Specification
56+
57+
=== Feature test macro
58+
59+
60+
This extension provides a feature-test macro as described in the core SYCL
61+
specification. An implementation supporting this extension must predefine the
62+
macro `SYCL_EXT_ONEAPI_QUEUE_STATUS_QUERY` to one of the values defined in the table
63+
below. Applications can test for the existence of this macro to determine if
64+
the implementation supports this feature, or applications can test the macro's
65+
value to determine which of the extension's features the implementation
66+
supports.
67+
68+
[%header,cols="2,5"]
69+
|===
70+
|Value
71+
|Description
72+
73+
|1
74+
|Initial version of this extension.
75+
|===
76+
77+
78+
=== Signatures and Semantics
79+
80+
This extension adds the following new member functions to the SYCL `queue` class.
81+
82+
[source,c++]
83+
----
84+
namespace sycl {
85+
86+
class queue {
87+
bool ext_oneapi_empty() const;
88+
size_t ext_oneapi_size() const;
89+
std::vector<event> ext_oneapi_get_wait_list() const;
90+
};
91+
92+
} // namespace sycl
93+
----
94+
95+
96+
The semantics of the new functions are:
97+
98+
[frame="topbot",options="header"]
99+
|===
100+
|Function |Description
101+
102+
// --- ROW BREAK ---
103+
a|
104+
[source,c++]
105+
----
106+
bool ext_oneapi_empty() const
107+
----
108+
|
109+
Returns `true` if `ext_oneapi_size() == 0`.
110+
111+
// --- ROW BREAK ---
112+
a|
113+
[source,c++]
114+
----
115+
size_t ext_oneapi_size() const
116+
----
117+
|
118+
Returns the number of enqueued `commands` in the queue that have not been
119+
completed. Since the implementation completes commands from the queue
120+
asynchronously, the returned value is a snapshot in time, and the actual
121+
number of uncompleted commands may be different by the time the function
122+
returns. Note that the behavior of `ext_oneapi_size()` is associated with the SYCL
123+
`queue` and not with the underlying native-backend-object.
124+
125+
// --- ROW BREAK ---
126+
a|
127+
[source,c++]
128+
----
129+
std::vector<event> ext_oneapi_get_wait_list() const
130+
----
131+
|
132+
Returns the list of events such that waiting for all returned events
133+
guarantees that all enqueued commands in the queue have been completed.
134+
Implementations are free to omit events that don't contribute
135+
to the semantic of `ext_oneapi_get_wait_list()`. For example,
136+
whether already completed events or non-leaf events of the dependency sub-graph
137+
managed by the queue are included in the returned list is implementation-defined.
138+
This implies that the number of events returned by `ext_oneapi_get_wait_list()`
139+
maybe different from the value returned by `ext_oneapi_size()`.
140+
a|
141+
|===
142+
143+
== Similar Work
144+
145+
- `ext_oneapi_get_wait_list` is inspired by the hipSYCL extension link:https://github.com/illuhad/hipSYCL/blob/develop/doc/extensions.md#hipsycl_ext_queue_wait_list[queue_wait_list].

0 commit comments

Comments
 (0)