Module ocl_core::types::abs

source ·
Expand description

Abstract data type wrappers.

Reference

The following table describes abstract data types supported by OpenCL (from SDK):

  • cl_platform_id: The ID for a platform.
  • cl_device_id: The ID for a device.
  • cl_context: A context.
  • cl_command_queue: A command queue.
  • cl_mem: A memory object.
  • cl_program: A program.
  • cl_kernel: A kernel.
  • cl_event: An event.
  • cl_sampler: A sampler.

The following new derived wrappers are also included in this module:

  • cl_events: A list of events.

Who cares. Why bother?

These types ensure as best they can that stored pointers to any of the above objects will be valid until that pointer is dropped by the Rust runtime (which obviously is not a 100% guarantee).

What this means is that you can share, clone, store, and throw away these types, and any types that contain them, among multiple threads, for as long as you’d like, with an insignificant amount of overhead, without having to worry about the dangers of dereferencing those types later on. As good as the OpenCL library generally is about this, it fails in many cases to provide complete protection against segfaults due to dereferencing old pointers particularly on certain ahem platforms.

Structs

cl_command_queue
cl_context
cl_device_id
cl_event
Wrapper used by EventList to send event pointers to core functions cheaply.
cl_kernel
cl_mem
A pointer to a region of mapped (pinned) memory.
cl_platform_id
cl_program
cl_sampler

Traits

AsRef with a type being carried along for convenience.
Types with a copy of a context pointer.
Types with a reference to a raw device_id pointer.
Types with a reference to a raw event pointer.
Types with a mutable pointer to a new, null raw event pointer.
Types with a reference to a raw platform_id pointer.
Types with a fixed set of associated devices and an associated platform.
Types with a reference to a raw event array and an associated element count.
Types which can be passed to any and all ::enqueue_... functions as the primary (ptr) argument and can also be passed as kernel cl_mem arguments.
Types which can be passed as the primary (ptr) argument value to ::enqueue_read_buffer, ::enqueue_write_buffer, ::enqueue_read_buffer_rect, ::enqueue_write_buffer_rect, ::enqueue_read_image, or ::enqueue_write_image.