Optional half floating-point support.

#pragma OPENCL EXTENSION cl_khr_fp16 : enable


OpenCL 1.0 supports half as a storage format only in the core specification. This extension adds support for half scalar and vector types as built-in types that can be used for arithmetic operations, conversions etc. An application that wants to use half and halfn types will need to include the directive shown above. The list of built-in scalar, and vector data types defined in tables 6.1, and 6.2 are extended to include the types in the table below.

The built-in vector data types for halfn are also declared as appropriate types in the OpenCL API (and header files) that can be used by an application. The following table describes the built-in vector data types for halfn as defined in the OpenCL C programming language and the corresponding data type available to the application:

Type in OpenCL Language Description API type for application
half2 2-component half-precision floating-point vector cl_half2
half4 4-component half-precision floating-point vector cl_half4
half8 8-component half-precision floating-point vector cl_half8
half16 16-component half-precision floating-point vector cl_half16


OpenCL Specification

Also see


Copyright © 2007-2009 The Khronos Group Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.