Struct ocl::builders::KernelCmd

source ·
pub struct KernelCmd<'k> { /* private fields */ }
Expand description

A kernel command builder used to enqueue a kernel with a mix of default and optionally specified arguments.

Implementations§

source§

impl<'k> KernelCmd<'k>

A kernel enqueue command.

source

pub fn queue<'q, Q>(self, queue: &'q Q) -> KernelCmd<'k>
where Q: 'k + AsRef<CommandQueueCore>, 'q: 'k,

Specifies a queue to use for this call only.

Overrides the kernel’s default queue if one is set. If no default queue is set, this method must be called before enqueuing the kernel.

source

pub fn gwo<D: Into<SpatialDims>>(self, gwo: D) -> KernelCmd<'k>

👎Deprecated since 0.18.0: Use ::global_work_offset instead.

Specifies a global work offset for this call only.

source

pub fn gws<D: Into<SpatialDims>>(self, gws: D) -> KernelCmd<'k>

👎Deprecated since 0.18.0: Use ::global_work_size instead.

Specifies a global work size for this call only.

source

pub fn lws<D: Into<SpatialDims>>(self, lws: D) -> KernelCmd<'k>

👎Deprecated since 0.18.0: Use ::local_work_size instead.

Specifies a local work size for this call only.

source

pub fn global_work_offset<D: Into<SpatialDims>>(self, gwo: D) -> KernelCmd<'k>

Specifies a global work offset for this call only.

source

pub fn global_work_size<D: Into<SpatialDims>>(self, gws: D) -> KernelCmd<'k>

Specifies a global work size for this call only.

source

pub fn local_work_size<D: Into<SpatialDims>>(self, lws: D) -> KernelCmd<'k>

Specifies a local work size for this call only.

source

pub fn ewait<'e, Ewl>(self, ewait: Ewl) -> KernelCmd<'k>
where Ewl: Into<ClWaitListPtrEnum<'e>>, 'e: 'k,

Specifies an event or list of events to wait on before the command will run.

When events generated using the ::enew method of other, previously enqueued commands are passed here (either individually or as part of an EventList), this command will not execute until those commands have completed.

Using events can compliment the use of queues to order commands by creating temporal dependencies between them (where commands in one queue must wait for the completion of commands in another). Events can also supplant queues altogether when, for example, using out-of-order queues.

§Example
// Create an event list:
let mut event_list = EventList::new();
// Enqueue a kernel on `queue_1`, creating an event representing the kernel
// command in our list:
kernel.cmd().queue(&queue_1).enew(&mut event_list).enq()?;
// Read from a buffer using `queue_2`, ensuring the read does not begin until
// after the kernel command has completed:
buffer.read(rwvec.clone()).queue(&queue_2).ewait(&event_list).enq_async()?;
source

pub fn enew<'e, En>(self, new_event_dest: En) -> KernelCmd<'k>
where En: Into<ClNullEventPtrEnum<'e>>, 'e: 'k,

Specifies the destination to store a new, optionally created event associated with this command.

The destination can be a mutable reference to an empty event (created using Event::empty) or a mutable reference to an event list.

After this command is enqueued, the event in the destination can be passed to the ::ewait method of another command. Doing so will cause the other command to wait until this command has completed before executing.

Using events can compliment the use of queues to order commands by creating temporal dependencies between them (where commands in one queue must wait for the completion of commands in another). Events can also supplant queues altogether when, for example, using out-of-order queues.

§Example
// Create an event list:
let mut event = Event::empty();
// Enqueue a kernel on `queue_1`, creating an event representing the kernel
// command in our list:
kernel.cmd().queue(&queue_1).enew(&mut event).enq()?;
// Read from a buffer using `queue_2`, ensuring the read does not begin until
// after the kernel command has completed:
buffer.read(rwvec.clone()).queue(&queue_2).ewait(&event).enq_async()?;
source

pub unsafe fn enq(self) -> OclResult<()>

Enqueues this kernel command.

§Safety

All kernel code must be considered untrusted. Therefore the act of calling this function contains implied unsafety even though the API itself is safe.

Auto Trait Implementations§

§

impl<'k> Freeze for KernelCmd<'k>

§

impl<'k> !RefUnwindSafe for KernelCmd<'k>

§

impl<'k> !Send for KernelCmd<'k>

§

impl<'k> !Sync for KernelCmd<'k>

§

impl<'k> Unpin for KernelCmd<'k>

§

impl<'k> !UnwindSafe for KernelCmd<'k>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.