Struct ocl::Kernel [] [src]

pub struct Kernel { /* fields omitted */ }

A kernel which represents a 'procedure'.

Corresponds to code which must have already been compiled into a program.

Set arguments using any of the ::arg... (builder-style) or ::set_arg... functions or use ::set_arg to set arguments by index.

Kernel includes features that a raw OpenCL kernel does not, including:

  1. Type-checked arguments (not just size-checked)
  2. Named arguments (with a &'static str name)
  3. Prevention of a potential (difficult to debug) segfault if a buffer or image used by a kernel is dropped prematurely.
  4. Stored defaults for the:
    • Queue
    • Global Work Offset
    • Global Work Size
    • Local Work Size

Methods

impl Kernel
[src]

Returns a new kernel.

Sets the default queue to be used by all subsequent enqueue commands unless otherwise changed (with ::set_default_queue) or overridden (by ::cmd().queue(...)...).

The queue must be associated with a device associated with the kernel's program.

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.

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.

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.

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.

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.

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.

Adds a new argument specifying the value: scalar (builder-style). Argument is added to the bottom of the argument order.

Adds a new argument specifying the value: vector (builder-style). Argument is added to the bottom of the argument order.

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.

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().

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().

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_buf_named().

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_img_named().

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_smp_named().

Modifies the kernel argument named: name.

Panics [FIXME]

Modifies the kernel argument named: name.

Panics [FIXME]

Modifies the kernel argument named: name.

Panics [FIXME]

Modifies the kernel argument named: name.

Panics [FIXME]

Sets the value of a named sampler argument.

Panics [FIXME]

Returns a command builder which is used to chain parameters of an 'enqueue' command together.

Enqueues this kernel on the default queue and returns the result.

Shorthand for .cmd().enq()

Safety

All kernel code must be considered unsafe. Therefore the act of calling this function contains implied unsafety even though the API itself is safe. How best to express that without the ambiguity of being marked unsafe while maintaining zero extra runtime overhead is still under consideration. Please provide feedback by filing an issue if you have any thoughts on the matter.

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.

Returns the default queue for this kernel.

Returns the default global work offset.

Returns the default global work size.

Returns the default local work size.

Returns the number of arguments specified for this kernel.

Deprecated since 0.13.0

: Use ::core instead.

Returns a reference to the core pointer wrapper, usable by functions in the core module.

Returns a reference to the core pointer wrapper, usable by functions in the core module.

Returns information about this kernel.

Returns argument information for this kernel.

Returns work group information for this kernel.

Returns the name of this kernel.

Returns the number of arguments this kernel has.

Returns the argument index of a named argument if it exists.

Verifies that a type matches the kernel arg info:

Sets an argument by index without checks of any kind.

Setting buffer or image (cl_mem) arguments this way may cause segfaults or errors if the buffer goes out of scope at any point before this kernel is dropped.

This method also bypasses the check to determine if the type you are passing matches the type defined in your kernel.

Methods from Deref<Target = KernelCore>

Returns a pointer, do not store it.

Returns the program associated with this kernel.

Trait Implementations

impl Debug for Kernel
[src]

Formats the value using the given formatter.

impl Clone for Kernel
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Display for Kernel
[src]

Formats the value using the given formatter. Read more

impl Deref for Kernel
[src]

The resulting type after dereferencing

The method called to dereference a value

impl DerefMut for Kernel
[src]

The method called to mutably dereference a value