Module ocl::prm

source ·
Expand description

OpenCL scalar and vector primitive types.

Rust primitives may have subtly different behaviour than OpenCL primitives within kernels. Wrapping is one example of this. Scalar integers within Rust may do overflow checks where in the kernel they do not. Therefore OpenCL-compatible implementations of each of the types are provided so that host and device side operations can be perfectly consistent.

The cl_... (cl_uchar, cl_int, cl_float, etc.) types are simple aliases of the Rust built-in primitive types and do not behave the same way that the kernel-side equivalents do. The uppercase-named types, on the other hand, (Uchar, Int, Float, etc.) are designed to behave identically to their corresponding types within kernels.

Please file an issue if any of the uppercase-named kernel-mimicking types deviate from what they should (as they are reasonably new this is definitely something to watch out for).

Vector type fields can be accessed using index operations i.e. [0], [1], [2] … etc. Plans for other ways of accessing fields (such as .x(), .y(), .s0(), .s15(), etc.) will be considered in the future (pending a number of additions/stabilizations to the Rust language). Create an issue if you have an opinion on the matter.

[NOTE]: This module may be renamed.

Structs§

Type Aliases§