Skip to content

Commit 9c32d8c

Browse files
author
Diptorup Deb
committed
Edits to the queue user guide.
1 parent 2d5dc58 commit 9c32d8c

File tree

1 file changed

+49
-47
lines changed

1 file changed

+49
-47
lines changed

docs/docfiles/user_guides/manual/dpctl/queues.rst

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,41 @@
44
Queue
55
#####
66

7-
A queue is needed to schedule execution of any computation, or data
8-
copying on the device. Queue construction requires specifying a device
9-
and a context targeting that device as well as additional properties,
10-
such as whether profiling information should be collected or whether
11-
submitted tasks are executed in the order in which they were submitted.
7+
A queue is needed to schedule execution of any computation or data copying on a
8+
device. Queue construction requires specifying a device and a context targeting
9+
that device as well as additional properties, such as whether profiling
10+
information should be collected or whether submitted tasks are executed in the
11+
order in which they were submitted.
1212

13-
The :class:`dpctl.SyclQueue` class represents a queue and abstracts
14-
the :sycl_queue:`sycl::queue <>` SYCL runtime class.
13+
The :class:`dpctl.SyclQueue` class represents a queue and abstracts the
14+
:sycl_queue:`sycl::queue <>` SYCL runtime class.
1515

1616
Types of Queues
1717
---------------
1818

19-
In SYCL tasks are submitted for execution by the SYCL runtime. The order
20-
in which runtime executes them on the target device is specified by
21-
a sequence of events which must be complete before execution is allowed.
22-
Submission of a task returns an event which can be used to further grow
23-
the graph of computational tasks. SYCL queue stores data needed to manage
24-
this scheduling operations.
19+
SYCL has a task-based execution model. The order in which a SYCL runtime
20+
executes a task on a target device is specified by a sequence of events which
21+
must be complete before execution of the task is allowed. Submission of a task
22+
returns an event which can be used to further grow the graph of computational
23+
tasks. A SYCL queue stores the needed data to manage the scheduling operations.
2524

26-
Unless specified otherwise during constriction of a queue, SYCL runtime
27-
executes tasks whose dependencies were met in an unspecified order,
28-
with possibility for some of the tasks be execute concurrently. Such
29-
queues are said to be 'out-of-order'.
25+
Unless specified otherwise during constriction of a queue, a SYCL runtime
26+
executes tasks whose dependencies were met in an unspecified order, with
27+
possibility for some of the tasks to be execute concurrently. Such queues are
28+
said to be 'out-of-order'.
3029

31-
SYCL queues can be specified to indicate that runtime must execute tasks
32-
in the linear order in which they were submitted. In this case tasks submitted
33-
to such a queue, called 'in-order' queues, are never executed concurrently.
30+
SYCL queues can be specified to indicate that runtime must execute tasks in the
31+
order in which they were submitted. In this case, tasks submitted to such a
32+
queue, called 'in-order' queues, are never executed concurrently.
3433

3534
Creating a New Queue
3635
--------------------
3736

38-
:class:`dpctl.SyclQueue(ctx, dev, property=None)` creates a new instance for
39-
the given compatible context and device. Keyword parameter `property`
40-
can be set to `"in_order"` to create an 'in-order' queue, to `"enable_profiling"`
41-
to dynamically collect task execution statistics in the returned event once
42-
the associated task completes.
37+
:class:`dpctl.SyclQueue(ctx, dev, property=None)` creates a new queue instance
38+
for the given compatible context and device. Keyword parameter `property` can be
39+
set to `"in_order"` to create an 'in-order' queue and to `"enable_profiling"` to
40+
dynamically collect task execution statistics in the returned event once the
41+
associated task completes.
4342

4443
.. _fig-constructing-queue-context-device-property:
4544

@@ -49,15 +48,16 @@ the associated task completes.
4948
:caption: Constructing SyclQueue from context and device
5049
:linenos:
5150

52-
A possible output for the example :ref:`fig-constructing-queue-context-device-property:` may be:
51+
A possible output for the example
52+
:ref:`fig-constructing-queue-context-device-property:` may be:
5353

5454
.. program-output:: python ../examples/python/sycl_queue.py -r create_queue_from_subdevice_multidevice_context
5555

56-
When context is not specified the :sycl_queue:`sycl::queue <>` constructor
56+
When a context is not specified the :sycl_queue:`sycl::queue <>` constructor
5757
from a device instance is called. Instead of an instance of
58-
:class:`dpctl.SyclDevice` the argument `dev` can be a valid filter
59-
selector string. In this case the :sycl_queue:`sycl::queue <>` constructor
60-
with the corresponding :oneapi_filter_selection:`sycl::ext::oneapi::filter_selector <>`
58+
:class:`dpctl.SyclDevice` the argument `dev` can be a valid filter selector
59+
string. In this case, the :sycl_queue:`sycl::queue <>` constructor with the
60+
corresponding :oneapi_filter_selection:`sycl::ext::oneapi::filter_selector <>`
6161
is called.
6262

6363
.. _fig-constructing-queue-filter-selector:
@@ -68,37 +68,39 @@ is called.
6868
:caption: Constructing SyclQueue from filter selector
6969
:linenos:
7070

71-
A possible output for the example :ref:`fig-constructing-queue-filter-selector` may be:
71+
A possible output for the example :ref:`fig-constructing-queue-filter-selector`
72+
may be:
7273

7374
.. program-output:: python ../examples/python/sycl_queue.py -r create_queue_from_filter_selector
7475

7576

7677
Profiling a Task Submitted to a Queue
7778
-------------------------------------
7879

79-
The result of scheduling execution of a task on queue is an event which can queried for the status
80-
of the task execution, can be used to order execution of the future tasks after this one is complete,
81-
can be used to wait for the completion of the task, and can carry profiling information of the task
82-
execution. The profiling information is only populated if the queue used was created with
83-
"enable_profiling" property and only becomes available after the task execution is complete.
80+
The result of scheduling execution of a task on a queue is an event. An event
81+
has several uses: it can be queried for the status of the task execution, it can
82+
be used to order execution of the future tasks after it is complete, it can be
83+
used to wait for execution to complete, and it can carry information to profile
84+
of the task execution. The profiling information is only populated if the queue
85+
used was created with the "enable_profiling" property and only becomes available
86+
after the task execution is complete.
8487

85-
The class :class:`dpctl.SyclTimer` implements a context manager that can be used to collect cumulative
86-
profiling information for all the tasks submitted to the queue of interest by functions executed
87-
within the context:
88+
The class :class:`dpctl.SyclTimer` implements a Python context manager that can
89+
be used to collect cumulative profiling information for all the tasks submitted
90+
to the queue of interest by functions executed within the context:
8891

8992
.. code-block:: python
9093
:caption: Example of timing execution
9194
92-
import dpctl
93-
import dpctl.tensor as dpt
95+
import dpctl import dpctl.tensor as dpt
9496
95-
q = dpctl.SyclQueue(property="enable_profiling")
96-
timer_ctx = dpctl.SyclTimer()
97-
with timer_ctx(q):
97+
q = dpctl.SyclQueue(property="enable_profiling") timer_ctx =
98+
dpctl.SyclTimer() with timer_ctx(q):
9899
X = dpt.arange(10**6, dtype=float, sycl_queue=q)
99100
100101
host_dt, device_dt = timer_ctx.dt
101102
102-
The timer leverages :oneapi_enqueue_barrier:`oneAPI enqueue_barrier SYCL extension <>` and submits
103-
a barrier at context entrance and a barrier at context exit and records associated events. The elapsed
104-
device time is computed as ``e_exit.profiling_info_start - e_enter.profiling_info_end``.
103+
The timer leverages :oneapi_enqueue_barrier:`oneAPI enqueue_barrier SYCL
104+
extension <>` and submits a barrier at context entrance and a barrier at context
105+
exit and records associated events. The elapsed device time is computed as
106+
``e_exit.profiling_info_start - e_enter.profiling_info_end``.

0 commit comments

Comments
 (0)