File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 4
4
"oneapi" : " https://www.oneapi.io/" ,
5
5
"oneapi_filter_selection" : " https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/supported/sycl_ext_oneapi_filter_selector.asciidoc" ,
6
6
"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" ,
7
8
"sycl_aspects" : " https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#table.device.aspect" ,
8
9
"sycl_context" : " https://sycl.readthedocs.io/en/latest/iface/context.html" ,
9
10
"sycl_device" : " https://sycl.readthedocs.io/en/latest/iface/device.html" ,
Original file line number Diff line number Diff line change @@ -75,3 +75,30 @@ A possible output for the example :ref:`fig-constructing-queue-filter-selector`
75
75
76
76
Profiling a Task Submitted to a Queue
77
77
-------------------------------------
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 ``.
You can’t perform that action at this time.
0 commit comments