Trait KernelTrait

Source
pub trait KernelTrait: KernelTraitConst {
Show 18 methods // Required method fn as_raw_mut_Kernel(&mut self) -> *mut c_void; // Provided methods fn set(&mut self, k: &impl KernelTraitConst) -> Result<()> { ... } fn set_1(&mut self, k: Kernel) { ... } fn create( &mut self, kname: &str, prog: &impl ProgramTraitConst, ) -> Result<bool> { ... } fn create_ext( &mut self, kname: &str, prog: &impl ProgramSourceTraitConst, buildopts: &str, errmsg: &mut String, ) -> Result<bool> { ... } fn create_ext_def( &mut self, kname: &str, prog: &impl ProgramSourceTraitConst, buildopts: &str, ) -> Result<bool> { ... } unsafe fn set_2( &mut self, i: i32, value: *const c_void, sz: size_t, ) -> Result<i32> { ... } fn set_3( &mut self, i: i32, image_2d: &impl Image2DTraitConst, ) -> Result<i32> { ... } fn set_umat(&mut self, i: i32, m: &impl UMatTraitConst) -> Result<i32> { ... } fn set_kernel_arg( &mut self, i: i32, arg: &impl KernelArgTraitConst, ) -> Result<i32> { ... } fn run( &mut self, globalsize: &mut [size_t], localsize: &mut [size_t], sync: bool, q: &impl QueueTraitConst, ) -> Result<bool> { ... } fn run_def( &mut self, globalsize: &mut [size_t], localsize: &mut [size_t], sync: bool, ) -> Result<bool> { ... } fn run_( &mut self, globalsize: &mut [size_t], localsize: &mut [size_t], sync: bool, q: &impl QueueTraitConst, ) -> Result<bool> { ... } fn run__def( &mut self, globalsize: &mut [size_t], localsize: &mut [size_t], sync: bool, ) -> Result<bool> { ... } fn run_task(&mut self, sync: bool, q: &impl QueueTraitConst) -> Result<bool> { ... } fn run_task_def(&mut self, sync: bool) -> Result<bool> { ... } fn run_profiling( &mut self, globalsize: &mut [size_t], localsize: &mut [size_t], q: &impl QueueTraitConst, ) -> Result<i64> { ... } fn run_profiling_def( &mut self, globalsize: &mut [size_t], localsize: &mut [size_t], ) -> Result<i64> { ... }
}
Expand description

Mutable methods for core::Kernel

Required Methods§

Provided Methods§

Source

fn set(&mut self, k: &impl KernelTraitConst) -> Result<()>

Source

fn set_1(&mut self, k: Kernel)

Source

fn create(&mut self, kname: &str, prog: &impl ProgramTraitConst) -> Result<bool>

Source

fn create_ext( &mut self, kname: &str, prog: &impl ProgramSourceTraitConst, buildopts: &str, errmsg: &mut String, ) -> Result<bool>

§C++ default parameters
  • errmsg: 0
Source

fn create_ext_def( &mut self, kname: &str, prog: &impl ProgramSourceTraitConst, buildopts: &str, ) -> Result<bool>

§Note

This alternative version of KernelTrait::create_ext function uses the following default values for its arguments:

  • errmsg: 0
Source

unsafe fn set_2( &mut self, i: i32, value: *const c_void, sz: size_t, ) -> Result<i32>

Source

fn set_3(&mut self, i: i32, image_2d: &impl Image2DTraitConst) -> Result<i32>

Source

fn set_umat(&mut self, i: i32, m: &impl UMatTraitConst) -> Result<i32>

Source

fn set_kernel_arg( &mut self, i: i32, arg: &impl KernelArgTraitConst, ) -> Result<i32>

Source

fn run( &mut self, globalsize: &mut [size_t], localsize: &mut [size_t], sync: bool, q: &impl QueueTraitConst, ) -> Result<bool>

Run the OpenCL kernel (globalsize value may be adjusted)

§Parameters
  • dims: the work problem dimensions. It is the length of globalsize and localsize. It can be either 1, 2 or 3.
  • globalsize: work items for each dimension. It is not the final globalsize passed to OpenCL. Each dimension will be adjusted to the nearest integer divisible by the corresponding value in localsize. If localsize is NULL, it will still be adjusted depending on dims. The adjusted values are greater than or equal to the original values.
  • localsize: work-group size for each dimension.
  • sync: specify whether to wait for OpenCL computation to finish before return.
  • q: command queue

Note: Use run_() if your kernel code doesn’t support adjusted globalsize.

§C++ default parameters
  • q: Queue()
Source

fn run_def( &mut self, globalsize: &mut [size_t], localsize: &mut [size_t], sync: bool, ) -> Result<bool>

Run the OpenCL kernel (globalsize value may be adjusted)

§Parameters
  • dims: the work problem dimensions. It is the length of globalsize and localsize. It can be either 1, 2 or 3.
  • globalsize: work items for each dimension. It is not the final globalsize passed to OpenCL. Each dimension will be adjusted to the nearest integer divisible by the corresponding value in localsize. If localsize is NULL, it will still be adjusted depending on dims. The adjusted values are greater than or equal to the original values.
  • localsize: work-group size for each dimension.
  • sync: specify whether to wait for OpenCL computation to finish before return.
  • q: command queue

Note: Use run_() if your kernel code doesn’t support adjusted globalsize.

§Note

This alternative version of KernelTrait::run function uses the following default values for its arguments:

  • q: Queue()
Source

fn run_( &mut self, globalsize: &mut [size_t], localsize: &mut [size_t], sync: bool, q: &impl QueueTraitConst, ) -> Result<bool>

Run the OpenCL kernel

§Parameters
  • dims: the work problem dimensions. It is the length of globalsize and localsize. It can be either 1, 2 or 3.
  • globalsize: work items for each dimension. This value is passed to OpenCL without changes.
  • localsize: work-group size for each dimension.
  • sync: specify whether to wait for OpenCL computation to finish before return.
  • q: command queue
§C++ default parameters
  • q: Queue()
Source

fn run__def( &mut self, globalsize: &mut [size_t], localsize: &mut [size_t], sync: bool, ) -> Result<bool>

Run the OpenCL kernel

§Parameters
  • dims: the work problem dimensions. It is the length of globalsize and localsize. It can be either 1, 2 or 3.
  • globalsize: work items for each dimension. This value is passed to OpenCL without changes.
  • localsize: work-group size for each dimension.
  • sync: specify whether to wait for OpenCL computation to finish before return.
  • q: command queue
§Note

This alternative version of KernelTrait::run_ function uses the following default values for its arguments:

  • q: Queue()
Source

fn run_task(&mut self, sync: bool, q: &impl QueueTraitConst) -> Result<bool>

§C++ default parameters
  • q: Queue()
Source

fn run_task_def(&mut self, sync: bool) -> Result<bool>

§Note

This alternative version of KernelTrait::run_task function uses the following default values for its arguments:

  • q: Queue()
Source

fn run_profiling( &mut self, globalsize: &mut [size_t], localsize: &mut [size_t], q: &impl QueueTraitConst, ) -> Result<i64>

Similar to synchronized run_() call with returning of kernel execution time

Separate OpenCL command queue may be used (with CL_QUEUE_PROFILING_ENABLE)

§Returns

Execution time in nanoseconds or negative number on error

§C++ default parameters
  • q: Queue()
Source

fn run_profiling_def( &mut self, globalsize: &mut [size_t], localsize: &mut [size_t], ) -> Result<i64>

Similar to synchronized run_() call with returning of kernel execution time

Separate OpenCL command queue may be used (with CL_QUEUE_PROFILING_ENABLE)

§Returns

Execution time in nanoseconds or negative number on error

§Note

This alternative version of KernelTrait::run_profiling function uses the following default values for its arguments:

  • q: Queue()

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§