Description
The char
, unsigned char
, short
, unsigned short
, int
, unsigned
int
, long
, unsigned long
, and float
vector data types are supported.
The vector data type is defined with the type name, i.e. char
, uchar
,
short
, ushort
, int
, uint
, long
, ulong
, or float
, followed by a
literal value n that defines the number of elements in the vector.
Supported values of n are 2, 3, 4, 8, and 16 for all vector data types.
[4] Builtin vector data types are supported by the OpenCL implementation even if the underlying compute device does not support any or all of the vector data types. These are to be converted by the device compiler to appropriate instructions that use underlying builtin types supported natively by the compute device. Refer to Appendix B for a description of the order of the components of a vector type in memory.
The following table describes the list of builtin vector data types.
Type 
Description 

A vector of n 8bit signed two’s complement integer values. 

A vector of n 8bit unsigned integer values. 

A vector of n 16bit signed two’s complement integer values. 

A vector of n 16bit unsigned integer values. 

A vector of n 32bit signed two’s complement integer values. 

A vector of n 32bit unsigned integer values. 

A vector of n 64bit signed two’s complement integer values. 

A vector of n 64bit unsigned integer values. 

A vector of n 32bit floatingpoint values. 

A vector of n 64bit floatingpoint values. 
[5] The double
vector type is an optional type that is supported if the
value of the CL_DEVICE_DOUBLE_FP_CONFIG
device
query is not zero.
The builtin vector data types 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 builtin vector data type in the OpenCL C programming language and the corresponding data type available to the application:
Type in OpenCL Language 
API type for application 




















Document Notes
For more information, see the OpenCL C Specification
This page is extracted from the OpenCL C Specification. Fixes and changes should be made to the Specification, not directly.
Copyright
Copyright (c) 20142020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.