Struct CommandQueue

Source
pub struct CommandQueue { /* private fields */ }
Expand description

An OpenCL command-queue.

Operations on OpenCL memory and kernel objects are performed using a command-queue.

Implementations§

Source§

impl CommandQueue

Source

pub const fn get(&self) -> cl_command_queue

Get the underlying OpenCL cl_command_queue.

Source

pub const fn max_work_item_dimensions(&self) -> cl_uint

Get the max_work_item_dimensions for the device that the underlying OpenCL device.

Source

pub unsafe fn create( context: &Context, device_id: cl_device_id, properties: cl_command_queue_properties, ) -> Result<Self>

Create an OpenCL command-queue on a specific device.

Queries the device the max_work_item_dimensions.
Deprecated in CL_VERSION_2_0 by create_command_queue_with_properties.

  • context - a valid OpenCL context.
  • device_id - a device or sub-device associated with context.
  • properties - a list of properties for the command-queue, see cl_command_queue_properties.

returns a Result containing the new CommandQueue or the error code from the OpenCL C API function.

§Safety

This is unsafe when a device is not a member of context.

Source

pub fn create_default( context: &Context, properties: cl_command_queue_properties, ) -> Result<Self>

Create an OpenCL command-queue on the context default device.
Queries the device the max_work_item_dimensions.
Deprecated in CL_VERSION_2_0 by create_command_queue_with_properties.

returns a Result containing the new CommandQueue or the error code from the OpenCL C API function.

Source

pub unsafe fn create_with_properties( context: &Context, device_id: cl_device_id, properties: cl_command_queue_properties, queue_size: cl_uint, ) -> Result<Self>

Create an OpenCL command-queue on a specific device.
Queries the device the max_work_item_dimensions.
CL_VERSION_2_0 onwards.

  • context - a valid OpenCL context.
  • device_id - a device or sub-device associated with context.
  • properties - a null terminated list of properties for the command-queue, see cl_queue_properties.

returns a Result containing the new CommandQueue or the error code from the OpenCL C API function.

§Safety

This is unsafe when a device is not a member of context.

Source

pub fn create_default_with_properties( context: &Context, properties: cl_command_queue_properties, queue_size: cl_uint, ) -> Result<Self>

Create an OpenCL command-queue on the default device.
Queries the device the max_work_item_dimensions.
CL_VERSION_2_0 onwards.

  • context - a valid OpenCL context.
  • properties - a null terminated list of properties for the command-queue, see cl_queue_properties.

returns a Result containing the new CommandQueue or the error code from the OpenCL C API function.

Source

pub fn create_with_properties_khr( context: &Context, device_id: cl_device_id, properties: &[cl_queue_properties_khr], ) -> Result<Self>

Source

pub fn flush(&self) -> Result<()>

Flush commands to a device.
returns an empty Result or the error code from the OpenCL C API function.

Source

pub fn finish(&self) -> Result<()>

Wait for completion of commands on a device.
returns an empty Result or the error code from the OpenCL C API function.

Source

pub unsafe fn enqueue_read_buffer<T>( &self, buffer: &Buffer<T>, blocking_read: cl_bool, offset: size_t, data: &mut [T], event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_read_buffer_rect<T>( &self, buffer: &Buffer<T>, blocking_read: cl_bool, buffer_origin: *const size_t, host_origin: *const size_t, region: *const size_t, buffer_row_pitch: size_t, buffer_slice_pitch: size_t, host_row_pitch: size_t, host_slice_pitch: size_t, ptr: *mut c_void, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_write_buffer<T>( &self, buffer: &mut Buffer<T>, blocking_write: cl_bool, offset: size_t, data: &[T], event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_write_buffer_rect<T>( &self, buffer: &mut Buffer<T>, blocking_write: cl_bool, buffer_origin: *const size_t, host_origin: *const size_t, region: *const size_t, buffer_row_pitch: size_t, buffer_slice_pitch: size_t, host_row_pitch: size_t, host_slice_pitch: size_t, ptr: *mut c_void, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_fill_buffer<T>( &self, buffer: &mut Buffer<T>, pattern: &[T], offset: size_t, size: size_t, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_copy_buffer<T>( &self, src_buffer: &Buffer<T>, dst_buffer: &mut Buffer<T>, src_offset: size_t, dst_offset: size_t, size: size_t, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_copy_buffer_rect<T>( &self, src_buffer: &Buffer<T>, dst_buffer: &mut Buffer<T>, src_origin: *const size_t, dst_origin: *const size_t, region: *const size_t, src_row_pitch: size_t, src_slice_pitch: size_t, dst_row_pitch: size_t, dst_slice_pitch: size_t, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_read_image( &self, image: &Image, blocking_read: cl_bool, origin: *const size_t, region: *const size_t, row_pitch: size_t, slice_pitch: size_t, ptr: *mut c_void, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_write_image( &self, image: &mut Image, blocking_write: cl_bool, origin: *const size_t, region: *const size_t, row_pitch: size_t, slice_pitch: size_t, ptr: *mut c_void, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_fill_image( &self, image: &mut Image, fill_color: *const c_void, origin: *const size_t, region: *const size_t, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_copy_image( &self, src_image: &Image, dst_image: &mut Image, src_origin: *const size_t, dst_origin: *const size_t, region: *const size_t, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_copy_image_to_buffer<T>( &self, src_image: &Image, dst_buffer: &mut Buffer<T>, src_origin: *const size_t, region: *const size_t, dst_offset: size_t, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_copy_buffer_to_image<T>( &self, src_buffer: &Buffer<T>, dst_image: &mut Image, src_offset: size_t, dst_origin: *const size_t, region: *const size_t, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_map_buffer<T>( &self, buffer: &Buffer<T>, blocking_map: cl_bool, map_flags: cl_map_flags, offset: size_t, size: size_t, buffer_ptr: &mut cl_mem, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_map_image( &self, image: &Image, blocking_map: cl_bool, map_flags: cl_map_flags, origin: *const size_t, region: *const size_t, image_row_pitch: *mut size_t, image_slice_pitch: *mut size_t, image_ptr: &mut cl_mem, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_unmap_mem_object( &self, memobj: cl_mem, mapped_ptr: *mut c_void, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_migrate_mem_object( &self, num_mem_objects: cl_uint, mem_objects: *const cl_mem, flags: cl_mem_migration_flags, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_migrate_mem_object_ext( &self, num_mem_objects: cl_uint, mem_objects: *const cl_mem, flags: cl_mem_migration_flags_ext, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_nd_range_kernel( &self, kernel: cl_kernel, work_dim: cl_uint, global_work_offsets: *const size_t, global_work_sizes: *const size_t, local_work_sizes: *const size_t, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_task( &self, kernel: cl_kernel, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_native_kernel( &self, user_func: Option<unsafe extern "C" fn(*mut c_void)>, args: &[*mut c_void], mem_list: &[cl_mem], args_mem_loc: &[*const c_void], event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_marker_with_wait_list( &self, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_barrier_with_wait_list( &self, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_svm_free( &self, svm_pointers: &[*const c_void], pfn_free_func: Option<unsafe extern "C" fn(queue: cl_command_queue, num_svm_pointers: cl_uint, svm_pointers: *mut *mut c_void, user_data: *mut c_void)>, user_data: *mut c_void, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_svm_mem_cpy( &self, blocking_copy: cl_bool, dst_ptr: *mut c_void, src_ptr: *const c_void, size: size_t, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_svm_mem_fill<T>( &self, svm_ptr: *mut c_void, pattern: &[T], size: size_t, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_svm_map<T>( &self, blocking_map: cl_bool, flags: cl_map_flags, svm: &mut [T], event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_svm_unmap<T>( &self, svm: &[T], event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_svm_migrate_mem( &self, svm_pointers: &[*const c_void], sizes: *const size_t, flags: cl_mem_migration_flags, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_acquire_gl_objects( &self, mem_objects: &[*const c_void], event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_release_gl_objects( &self, mem_objects: &[*const c_void], event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_acquire_egl_objects( &self, mem_objects: &[*const c_void], event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_release_egl_objects( &self, mem_objects: &[*const c_void], event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_acquire_gralloc_objects_img( &self, mem_objects: &[*const c_void], event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_release_gralloc_objects_img( &self, mem_objects: &[*const c_void], event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_acquire_external_mem_objects_khr( &self, mem_objects: &[*const c_void], event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_release_external_mem_objects_khr( &self, mem_objects: &[*const c_void], event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_wait_semaphores_khr( &self, sema_objects: &[*const c_void], sema_payload_list: *const cl_semaphore_payload_khr, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_signal_semaphores_khr( &self, sema_objects: &[*const c_void], sema_payload_list: *const cl_semaphore_payload_khr, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_acquire_dx9_objects_intel( &self, mem_objects: &[*const c_void], event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_release_dx9_objects_intel( &self, mem_objects: &[*const c_void], event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_generate_mipmap_img( &self, src_image: cl_mem, dst_image: cl_mem, mipmap_filter_mode: cl_mipmap_filter_mode_img, array_region: *const size_t, mip_region: *const size_t, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_read_host_pipe_intel( &self, program: cl_program, pipe_symbol: *const c_char, blocking_read: cl_bool, ptr: *mut c_void, size: size_t, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub unsafe fn enqueue_write_host_pipe_intel( &self, program: cl_program, pipe_symbol: *const c_char, blocking_write: cl_bool, ptr: *const c_void, size: size_t, event_wait_list: &[cl_event], ) -> Result<Event>

Source

pub fn context(&self) -> Result<cl_context>

Source

pub fn device(&self) -> Result<cl_device_id>

Source

pub fn reference_count(&self) -> Result<cl_uint>

Source

pub fn properties(&self) -> Result<cl_ulong>

Source

pub fn size(&self) -> Result<cl_uint>

CL_VERSION_2_0

Source

pub fn device_default(&self) -> Result<cl_device_id>

CL_VERSION_2_1

Source

pub fn properties_array(&self) -> Result<Vec<cl_ulong>>

CL_VERSION_3_0

Source

pub fn get_data(&self, param_name: cl_command_queue_info) -> Result<Vec<u8>>

Get data about an OpenCL command-queue. Calls clGetCommandQueueInfo to get the desired data about the command-queue.

Trait Implementations§

Source§

impl Debug for CommandQueue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for CommandQueue

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl From<CommandQueue> for cl_command_queue

Source§

fn from(value: CommandQueue) -> Self

Converts to this type from the input type.
Source§

impl Send for CommandQueue

Source§

impl Sync for CommandQueue

Auto Trait Implementations§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.