@@ -158,17 +158,97 @@ cdef class _SyclQueue:
158158
159159
160160cdef class SyclQueue(_SyclQueue):
161- """ Python class representing cl::sycl::queue.
162-
163- SyclQueue(*, /, property=None)
164- create SyclQueue from default selector
165- SyclQueue(filter_string, *, /, propery=None)
166- create SyclQueue from filter selector string
167- SyclQueue(SyclDevice, *, /, property=None)
168- create SyclQueue from give SyclDevice automatically
169- finding/creating SyclContext.
170- SyclQueue(SyclContext, SyclDevice, *, /, property=None)
171- create SyclQueue from give SyclContext, SyclDevice
161+ """
162+ Python class representing ``cl::sycl::queue``. There are multiple
163+ ways to create a :class:`dpctl.SyclQueue` object:
164+
165+ - Invoking the constructor with no arguments creates a context using
166+ the default selector.
167+
168+ :Example:
169+ .. code-block:: python
170+
171+ import dpctl
172+
173+ # Create a default SyclQueue
174+ q = dpctl.SyclQueue()
175+ print(q.sycl_device)
176+
177+ - Invoking the constructor with specific filter selector string that
178+ creates a queue for the device corresponding to the filter string.
179+
180+ :Example:
181+ .. code-block:: python
182+
183+ import dpctl
184+
185+ # Create in-order SyclQueue for either gpu, or cpu device
186+ q = dpctl.SyclQueue("gpu,cpu", property="in_order")
187+ print([q.sycl_device.is_gpu, q.sycl_device.is_cpu])
188+
189+ - Invoking the constructor with a :class:`dpctl.SyclDevice` object
190+ creates a queue for that device, automatically finding/creating
191+ a :class:`dpctl.SyclContext` for the given device.
192+
193+ :Example:
194+ .. code-block:: python
195+
196+ import dpctl
197+
198+ d = dpctl.SyclDevice("gpu")
199+ q = dpctl.SyclQueue(d)
200+ ctx = q.sycl_context
201+ print(q.sycl_device == d)
202+ print(any([ d == ctx_d for ctx_d in ctx.get_devices()]))
203+
204+ - Invoking the constructor with a :class:`dpctl.SyclContext` and a
205+ :class:`dpctl.SyclDevice` creates a queue for given context and
206+ device.
207+
208+ :Example:
209+ .. code-block:: python
210+
211+ import dpctl
212+
213+ # Create a CPU device using the opencl driver
214+ cpu_d = dpctl.SyclDevice("opencl:cpu")
215+ # Partition the CPU device into sub-devices, each with two cores.
216+ sub_devices = cpu_d.create_sub_devices(partition=2)
217+ # Create a context common to all the sub-devices.
218+ ctx = dpctl.SyclContext(sub_devices)
219+ # create a queue for each sub-device using the common context
220+ queues = [dpctl.SyclQueue(ctx, sub_d) for sub_d in sub_devices]
221+
222+ - Invoking the constuctor with a named ``PyCapsule`` with the name
223+ **"SyclQueueRef"** that carries a pointer to a ``sycl::queue``
224+ object. The capsule will be renamed upon successful consumption
225+ to ensure one-time use. A new named capsule can be constructed by
226+ using :func:`dpctl.SyclQueue._get_capsule` method.
227+
228+ Args:
229+ ctx (:class:`dpctl.SyclContext`, optional): Sycl context to create
230+ :class:`dpctl.SyclQueue` from. If not specified, a single-device
231+ context will be created from the specified device.
232+ dev (str, :class:`dpctl.SyclDevice`, capsule, optional): Sycl device
233+ to create :class:`dpctl.SyclQueue` from. If not specified, sycl
234+ device selected by ``cl::sycl::default_selector`` is used.
235+ The argument must be explicitly specified if `ctxt` argument is
236+ provided.
237+
238+ If `dev` is a named ``PyCapsule`` called **"SyclQueueRef"** and
239+ `ctxt` is not specified, :class:`dpctl.SyclQueue` instance is
240+ created from foreign `sycl::queue` object referenced by the
241+ capsule.
242+ property (str, tuple(str), list(str), optional): Defaults to None.
243+ The argument can be either "default", "in_order",
244+ "enable_profiling", or a tuple containing these.
245+
246+ Raises:
247+ SyclQueueCreationError: If the :class:`dpctl.SyclQueue` object creation failed.
248+ TypeError: In case of incorrect arguments given to constructors, unexpected types
249+ of input arguments, or in the case the input capsule contained a null
250+ pointer or could not be renamed.
251+
172252 """
173253 def __cinit__ (self , *args , **kwargs ):
174254 cdef int len_args
0 commit comments