Skip to content

Commit 9ac1e2f

Browse files
Static method SyclQueue._create_from_context_and_device change
1. Added docstrings 2. Added optional keyword argument props, to allow queue creation with properties. This method is not covered in test suite. To solve this, test suite needs to learn to build and use Cython extensions
1 parent 783ded9 commit 9ac1e2f

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

dpctl/_sycl_queue.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ cdef public api class SyclQueue (_SyclQueue) [
6666
cdef SyclQueue _create(DPCTLSyclQueueRef qref)
6767
@staticmethod
6868
cdef SyclQueue _create_from_context_and_device(
69-
SyclContext ctx, SyclDevice dev
69+
SyclContext ctx, SyclDevice dev, int props=*
7070
)
7171
cdef cpp_bool equals(self, SyclQueue q)
7272
cpdef SyclContext get_sycl_context(self)

dpctl/_sycl_queue.pyx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,13 +537,24 @@ cdef class SyclQueue(_SyclQueue):
537537

538538
@staticmethod
539539
cdef SyclQueue _create_from_context_and_device(
540-
SyclContext ctx, SyclDevice dev
540+
SyclContext ctx, SyclDevice dev, int props=0
541541
):
542+
"""
543+
Static factory method to create :class:`dpctl.SyclQueue` instance
544+
from given :class:`dpctl.SyclContext`, :class:`dpctl.SyclDevice`
545+
and optional integer `props` encoding the queue properties.
546+
"""
542547
cdef _SyclQueue ret = _SyclQueue.__new__(_SyclQueue)
543548
cdef DPCTLSyclContextRef cref = ctx.get_context_ref()
544549
cdef DPCTLSyclDeviceRef dref = dev.get_device_ref()
545-
cdef DPCTLSyclQueueRef qref = DPCTLQueue_Create(cref, dref, NULL, 0)
550+
cdef DPCTLSyclQueueRef qref = NULL
546551

552+
qref = DPCTLQueue_Create(
553+
cref,
554+
dref,
555+
<error_handler_callback *>&default_async_error_handler,
556+
props
557+
)
547558
if qref is NULL:
548559
raise SyclQueueCreationError("Queue creation failed.")
549560
ret._queue_ref = qref

0 commit comments

Comments
 (0)