pub struct Queue(/* private fields */);Expand description
The Queue connects a host program to a single device. Programs submit tasks to a device via the
Queue and may monitor the Queue for completion. A program initiates the task by submitting
a kernel.
Implementations§
Source§impl Queue
impl Queue
Sourcepub fn new_immediate() -> Self
pub fn new_immediate() -> Self
Construct an immediate Queue based on the device returned from the default selector.
Sourcepub fn get_context(&self) -> Context
pub fn get_context(&self) -> Context
Returns the SYCL queue’s context.
Sourcepub fn get_device(&self) -> Device
pub fn get_device(&self) -> Device
Returns the device the queue is associated with.
Sourcepub fn alloc_host<T: Pod>(
&mut self,
len: usize,
) -> Result<EnqueuedHostUsmBox<T>>
pub fn alloc_host<T: Pod>( &mut self, len: usize, ) -> Result<EnqueuedHostUsmBox<T>>
Allocates zeroed memory and creates a host-side UsmBox that can store an array of T.
Allocates zeroed memory and creates a shared UsmBox that can store an array of T.
Sourcepub fn alloc_device<T: Pod>(
&mut self,
len: usize,
) -> Result<EnqueuedDeviceUsmBox<T>>
pub fn alloc_device<T: Pod>( &mut self, len: usize, ) -> Result<EnqueuedDeviceUsmBox<T>>
Allocates zeroed memory and creates a device UsmBox that can store an array of T.
Sourcepub unsafe fn alloc_uninit_host<T>(&self, len: usize) -> HostUsmBox<T>
pub unsafe fn alloc_uninit_host<T>(&self, len: usize) -> HostUsmBox<T>
Allocates memory and creates a host-side UsmBox that can store an array of T.
Safety: the array contents are uninitialized.
Allocates memory and creates a shared UsmBox that can store an array of T.
Safety: the array contents are uninitialized.
Sourcepub unsafe fn alloc_uninit_device<T>(&self, len: usize) -> DeviceUsmBox<T>
pub unsafe fn alloc_uninit_device<T>(&self, len: usize) -> DeviceUsmBox<T>
Allocates memory and creates a device-side UsmBox that can store an array of T.
Safety: the array contents are uninitialized.
Sourcepub unsafe fn memset<T, A: UsmAlloc>(
&mut self,
array: &mut UsmBox<T, A>,
value: i32,
) -> Result<Event>
pub unsafe fn memset<T, A: UsmAlloc>( &mut self, array: &mut UsmBox<T, A>, value: i32, ) -> Result<Event>
Sets memory allocated with USM allocations. Safety: the caller must make sure the underlying memory isn’t being aliased somewhere else.
Sourcepub unsafe fn memset_with_deps<T, A: UsmAlloc>(
&mut self,
array: &mut UsmBox<T, A>,
value: i32,
dep_events: &[&Event],
) -> Result<Event>
pub unsafe fn memset_with_deps<T, A: UsmAlloc>( &mut self, array: &mut UsmBox<T, A>, value: i32, dep_events: &[&Event], ) -> Result<Event>
Sets memory allocated with USM allocations after all specified events finish. Safety: the caller must make sure the underlying memory isn’t being aliased somewhere else.
Sourcepub fn barrier_with_deps(&mut self, dep_events: &[&Event]) -> Result<Event>
pub fn barrier_with_deps(&mut self, dep_events: &[&Event]) -> Result<Event>
Submits a barrier to the queue after all specified events finish.
Sourcepub fn wait(&mut self) -> Result<()>
pub fn wait(&mut self) -> Result<()>
Performs a blocking wait for the completion of all enqueued tasks in the queue. Returns an error if a synchronous SYCL exception occurs.
Dropping the queue does not wait for its completion.
Sourcepub unsafe fn launch<const ARGC: usize, const DIMENSIONS: usize>(
&mut self,
nd_range: NdRange<DIMENSIONS>,
kernel: &Kernel,
args: impl KernelArgumentList<ARGC>,
) -> Result<Event>where
NdRange<DIMENSIONS>: ValidDimension,
pub unsafe fn launch<const ARGC: usize, const DIMENSIONS: usize>(
&mut self,
nd_range: NdRange<DIMENSIONS>,
kernel: &Kernel,
args: impl KernelArgumentList<ARGC>,
) -> Result<Event>where
NdRange<DIMENSIONS>: ValidDimension,
Enqueues a kernel object to the queue as an ND-range kernel, using the number of work-items
specified by the NdRange nd_range.
Safety: The caller must make sure each argument matches the launched SYCL kernel’s signature, including their respective size, layout and alignment.
Sourcepub fn copy<T, A1, A2>(
&mut self,
src: &UsmBox<T, A1>,
dst: &mut UsmBox<T, A2>,
) -> Result<Event>
pub fn copy<T, A1, A2>( &mut self, src: &UsmBox<T, A1>, dst: &mut UsmBox<T, A2>, ) -> Result<Event>
Copies the contents of the source array to the destination array.
Panics if the source and destination array lengths differ.