Skip to content

Commit 15be3a0

Browse files
Python API SyclQueue.has_enable_profiling
Queries whether queue was constructed with said property. If so, events from tasks submitted to this queue will have profiling info
1 parent 2898db5 commit 15be3a0

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

dpctl/_backend.pxd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ cdef extern from "dpctl_sycl_queue_interface.h":
353353
const DPCTLSyclQueueRef QRef,
354354
const DPCTLSyclEventRef *DepEvents,
355355
size_t NDepEvents)
356+
cdef bool DPCTLQueue_HasEnableProfiling(const DPCTLSyclQueueRef QRef)
356357

357358

358359
cdef extern from "dpctl_sycl_queue_manager.h":

dpctl/_sycl_queue.pyx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ from ._backend cimport ( # noqa: E211
3838
DPCTLQueue_GetBackend,
3939
DPCTLQueue_GetContext,
4040
DPCTLQueue_GetDevice,
41+
DPCTLQueue_HasEnableProfiling,
4142
DPCTLQueue_Hash,
4243
DPCTLQueue_IsInOrder,
4344
DPCTLQueue_MemAdvise,
@@ -851,6 +852,12 @@ cdef class SyclQueue(_SyclQueue):
851852
"""True if SyclQueue is in-order, False if it is out-of-order."""
852853
return DPCTLQueue_IsInOrder(self._queue_ref)
853854

855+
@property
856+
def has_enable_profiling(self):
857+
"""True if SyclQueue was constructed with enabled_profiling property,
858+
False otherwise."""
859+
return DPCTLQueue_HasEnableProfiling(self._queue_ref)
860+
854861
@property
855862
def __name__(self):
856863
return "SyclQueue"

dpctl/tests/test_sycl_queue.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,14 @@ def test_context_equals():
373373
assert hash(ctx0) == hash(ctx1)
374374

375375

376+
def test_has_enable_profiling():
377+
try:
378+
q = dpctl.SyclQueue(property="enable_profiling")
379+
except dpctl.SyclQueueCreationError:
380+
pytest.skip()
381+
assert q.has_enable_profiling
382+
383+
376384
def test_hashing_of_queue():
377385
"""
378386
Test that a :class:`dpctl.SyclQueue` object can be used as

0 commit comments

Comments
 (0)