Skip to content

Instantly share code, notes, and snippets.

@TApplencourt
Created March 22, 2022 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TApplencourt/0e9b572c5a172bae25c3f7389405511e to your computer and use it in GitHub Desktop.
Save TApplencourt/0e9b572c5a172bae25c3f7389405511e to your computer and use it in GitHub Desktop.
Adding new queue querry
diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc
index cea90170..f0402c37 100644
--- a/adoc/chapters/programming_interface.adoc
+++ b/adoc/chapters/programming_interface.adoc
@@ -3215,6 +3215,39 @@ requested by the template parameter [code]#param#.
error code if the <<backend>> that corresponds with [code]#param# is different
from the <<backend>> that is associated with this [code]#queue#.
+a@
+[source]
+----
+bool empty() const
+----
+a@ Returns [code]#true# if [code]#(size() == 0)#.
+
+a@
+[source]
+----
+size_t size() const
+----
+a@ Return the number of enqueued <<command,commands>> in the queue that have not been completed.
+Since the implementation completes commands from the queue asynchronously,
+the returned value is a snapshot in time,
+and the actual number of uncompleted commands may be different by the time the function returns.
+Note that the behavior of [code]#size() is associated with the SYCL [code]#queue#
+and not with the underlying <<native-backend-object>>.
+
+a@
+[source]
+----
+std::vector<event> get_wait_list() const
+----
+a@ Return the list of events such that waiting for all returned events
+guarantees that all enqueued commands in the queue have been completed.
+Implementations are free to omit events that don't contribute
+to the semantic of [code]#get_wait_list()#. For example,
+whether already completed events or non-leaf events of the dependency sub-graph
+managed by the queue are included in the returned list is implementation-defined.
+This implies that the number of events returned by [code]#get_wait_list()#
+may be different from the value returned by [code]#size()#.
+
|====
diff --git a/adoc/chapters/what_changed.adoc b/adoc/chapters/what_changed.adoc
index f77cdbea..94c2485f 100644
--- a/adoc/chapters/what_changed.adoc
+++ b/adoc/chapters/what_changed.adoc
@@ -6,6 +6,11 @@
[[sec:what-changed-between]]
+== What has changed from SYCL 2020 to SYCL NEXT
+
+[code]#empty()#, [code]#size()#, and [code]#get_wait_list()#
+member functions where added to [code]#sycl::queue#.
+
== What has changed from SYCL 1.2.1 to SYCL 2020
The SYCL runtime moved from namespace [code]#cl::sycl# provided
diff --git a/adoc/headers/queue.h b/adoc/headers/queue.h
index dbf80da5..e089df88 100644
--- a/adoc/headers/queue.h
+++ b/adoc/headers/queue.h
@@ -70,6 +70,12 @@ class queue {
void throw_asynchronous();
+ bool empty() const;
+
+ size_t size() const;
+
+ std::vector<event> get_wait_list() const;
+
/* -- convenience shortcuts -- */
template <typename KernelName, typename KernelType>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment