• 2019 Update 4
  • 03/20/2019
  • Public Content

Considering native_ and half_ Versions of Math Built-Ins

OpenCL™ API offers two basic ways to trade precision for speed:
  • native_*
    math built-ins, which have lower precision, but are faster than their un-prefixed variants
  • Compiler optimization options that enable optimizations for floating-point arithmetic for the whole OpenCL program (for example, the
    -cl-fast-relaxed-math flag
For the list of other compiler options and their description please refer to the
Intel® Code Builder for OpenCL™ API - User Manual
. In general, while the
flag is a quick way to get potentially large performance gains for kernels with many math operations, it does not permit fine control of numeric accuracy. Consider experimenting with
equivalents separately for each specific case, keeping track of the resulting accuracy.
versions of math built-ins are generally supported in hardware and run substantially faster, while offering lower accuracy. Use native trigonometry and transcendental functions, such as
, when performance is more important than precision.
The list of functions that have optimized versions support is provided in "Working with cl-fast-relaxed-math Flag" section of the
OpenCL Code Builder - User’s Guide
See Also
OpenCL™ Build and Linking Options chapter of the Intel® Code Builder for OpenCL™ API - User Manual

Product and Performance Information


Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804