Skip to content

Commit 8e3af7d

Browse files
filled out profiling section
1 parent dbd5eed commit 8e3af7d

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

docs/docfiles/urls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"oneapi": "https://www.oneapi.io/",
55
"oneapi_filter_selection": "https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/supported/sycl_ext_oneapi_filter_selector.asciidoc",
66
"oneapi_default_context": "https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/supported/sycl_ext_oneapi_default_context.asciidoc",
7+
"oneapi_enqueue_barrier": "https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/supported/sycl_ext_oneapi_enqueue_barrier.asciidoc",
78
"sycl_aspects": "https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#table.device.aspect",
89
"sycl_context": "https://sycl.readthedocs.io/en/latest/iface/context.html",
910
"sycl_device": "https://sycl.readthedocs.io/en/latest/iface/device.html",

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,30 @@ A possible output for the example :ref:`fig-constructing-queue-filter-selector`
7575

7676
Profiling a Task Submitted to a Queue
7777
-------------------------------------
78+
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.
84+
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+
89+
.. code-block:: python
90+
:caption: Example of timing execution
91+
92+
import dpctl
93+
import dpctl.tensor as dpt
94+
95+
q = dpctl.SyclQueue(property="enable_profiling")
96+
timer_ctx = dpctl.SyclTimer()
97+
with timer_ctx(q):
98+
X = dpt.arange(10**6, dtype=float, sycl_queue=q)
99+
100+
host_dt, device_dt = timer_ctx.dt
101+
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``.

0 commit comments

Comments
 (0)