Struct ocl::Kernel
[−]
[src]
pub struct Kernel { // some fields omitted }
A kernel which represents a 'procedure'.
Corresponds to code which must have already been compiled into a program.
Destruction
Reference counter now managed automatically.
Thread Safety
Now handled automatically.
TODO: Add more details, examples, etc. TODO: Add information about panics and errors. TODO: Finish arg info formatting.
Methods
impl Kernel
[src]
fn new<S: Into<String>>(name: S, program: &Program, queue: &Queue) -> OclResult<Kernel>
Returns a new kernel.
fn gwo<D: Into<SpatialDims>>(self, gwo: D) -> Kernel
Sets the default global work offset (builder-style).
Used when enqueuing kernel commands. Superseded if specified while
making a call to enqueue or building a queue command with ::cmd
.
fn gws<D: Into<SpatialDims>>(self, gws: D) -> Kernel
Sets the default global work size (builder-style).
Used when enqueuing kernel commands. Superseded if specified while
making a call to enqueue or building a queue command with ::cmd
.
fn lws<D: Into<SpatialDims>>(self, lws: D) -> Kernel
Sets the default local work size (builder-style).
Used when enqueuing kernel commands. Superseded if specified while
making a call to enqueue or building a queue command with ::cmd
.
fn arg_buf<T: OclPrm>(self, buffer: &Buffer<T>) -> Kernel
Adds a new argument to the kernel specifying the buffer object represented by 'buffer' (builder-style). Argument is added to the bottom of the argument order.
fn arg_img<P: OclPrm>(self, image: &Image<P>) -> Kernel
Adds a new argument to the kernel specifying the image object represented by 'image' (builder-style). Argument is added to the bottom of the argument order.
fn arg_smp(self, sampler: &Sampler) -> Kernel
Adds a new argument to the kernel specifying the sampler object represented by 'sampler' (builder-style). Argument is added to the bottom of the argument order.
fn arg_scl<T: OclPrm>(self, scalar: T) -> Kernel
Adds a new argument specifying the value: scalar
(builder-style). Argument
is added to the bottom of the argument order.
fn arg_vec<T: OclPrm>(self, vector: &[T]) -> Kernel
Adds a new argument specifying the value: vector
(builder-style). Argument
is added to the bottom of the argument order.
fn arg_loc<T: OclPrm>(self, length: usize) -> Kernel
Adds a new argument specifying the allocation of a local variable of size
length * sizeof(T)
bytes (builder_style).
Local variables are used to share data between work items in the same workgroup.
fn arg_scl_named<T: OclPrm>(self, name: &'static str, scalar_opt: Option<T>) -> Kernel
Adds a new named argument (in order) specifying the value: scalar
(builder-style).
Named arguments can be easily modified later using ::set_arg_scl_named()
.
fn arg_vec_named<T: OclPrm>(self, name: &'static str, vector_opt: Option<&[T]>) -> Kernel
Adds a new named argument (in order) specifying the value: vector
(builder-style).
Named arguments can be easily modified later using ::set_arg_vec_named()
.
fn arg_buf_named<T: OclPrm>(self, name: &'static str, buffer_opt: Option<&Buffer<T>>) -> Kernel
Adds a new named argument specifying the buffer object represented by 'buffer' (builder-style). Argument is added to the bottom of the argument order.
Named arguments can be easily modified later using ::set_arg_scl_named()
.
fn arg_img_named<P: OclPrm>(self, name: &'static str, image_opt: Option<&Image<P>>) -> Kernel
Adds a new named argument specifying the image object represented by 'image' (builder-style). Argument is added to the bottom of the argument order.
Named arguments can be easily modified later using ::set_arg_scl_named()
.
fn arg_smp_named(self, name: &'static str, sampler_opt: Option<&Sampler>) -> Kernel
Adds a new named argument specifying the sampler object represented by 'sampler' (builder-style). Argument is added to the bottom of the argument order.
Named arguments can be easily modified later using ::set_arg_scl_named()
.
fn set_arg_scl_named<'a, T: OclPrm>(&'a mut self, name: &'static str, scalar: T) -> OclResult<&'a mut Kernel>
Modifies the kernel argument named: name
.
Panics [FIXME]
fn set_arg_vec_named<'a, T: OclPrm>(&'a mut self, name: &'static str, vector: &[T]) -> OclResult<&'a mut Kernel>
Modifies the kernel argument named: name
.
Panics [FIXME]
fn set_arg_buf_named<'a, T: OclPrm>(&'a mut self, name: &'static str, buffer_opt: Option<&Buffer<T>>) -> OclResult<&'a mut Kernel>
Modifies the kernel argument named: name
.
Panics [FIXME]
fn set_arg_img_named<'a, P: OclPrm, T: OclPrm>(&'a mut self, name: &'static str, image_opt: Option<&Image<P>>) -> OclResult<&'a mut Kernel>
Modifies the kernel argument named: name
.
Panics [FIXME]
fn set_arg_smp_named<'a, T: OclPrm>(&'a mut self, name: &'static str, sampler_opt: Option<&Sampler>) -> OclResult<&'a mut Kernel>
Sets the value of a named sampler argument.
Panics [FIXME]
fn cmd<'k>(&'k self) -> KernelCmd<'k>
Returns a command builder which is used to chain parameters of an 'enqueue' command together.
fn enq<'k>(&'k self) -> OclResult<()>
Enqueues this kernel on the default queue and returns the result.
Shorthand for .cmd().enq()
fn set_default_queue<'a>(&'a mut self, queue: &Queue) -> OclResult<&'a mut Kernel>
Changes the default queue.
Returns a ref for chaining i.e.:
kernel.set_default_queue(queue).enqueue(....);
Even when used as above, the queue is changed permanently, not just for the one call. Changing the queue is cheap so feel free to change as often as needed.
If you want to change the queue for only a single call, use:
::cmd.queue(...)...enq()...
The new queue must be associated with a device associated with the kernel's program.
fn default_queue(&self) -> &Queue
Returns the default core::CommandQueue
for this kernel.
fn get_gwo(&self) -> SpatialDims
Returns the default global work offset.
fn get_gws(&self) -> SpatialDims
Returns the default global work size.
fn get_lws(&self) -> SpatialDims
Returns the default local work size.
fn arg_count(&self) -> u32
Returns the number of arguments specified for this kernel.
fn core_as_ref(&self) -> &KernelCore
Returns a reference to the core pointer wrapper, usable by functions in
the core
module.
fn info(&self, info_kind: KernelInfo) -> KernelInfoResult
Returns info about this kernel.
fn arg_info(&self, arg_index: u32, info_kind: KernelArgInfo) -> KernelArgInfoResult
Returns info about this kernel.
fn wg_info(&self, device: &Device, info_kind: KernelWorkGroupInfo) -> KernelWorkGroupInfoResult
Returns info about this kernel.
fn name(&self) -> String
Methods from Deref<Target=KernelCore>
Trait Implementations
impl Debug for Kernel
[src]
impl Display for Kernel
[src]
impl Deref for Kernel
[src]
type Target = KernelCore
The resulting type after dereferencing
fn deref(&self) -> &KernelCore
The method called to dereference a value
impl DerefMut for Kernel
[src]
fn deref_mut(&mut self) -> &mut KernelCore
The method called to mutably dereference a value