'\" t .\" Title: Vector Data Types .\" Author: The Khronos Group .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 01/14/2021 .\" Manual: OpenCL Manual .\" Source: The Khronos Group .\" Language: English .\" .TH "VECTOR DATA TYPES" "3clc" "01/14/2021" "The Khronos Group" "OpenCL Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" Vector_Data_Types \- Built\-in vector data types\&. .SH "DESCRIPTION" .PP The \fBchar\fR, \fBunsigned char\fR, \fBshort\fR, \fBunsigned short\fR, \fBinteger\fR, \fBunsigned integer\fR, \fBlong\fR, \fBunsigned long\fR, and \fBfloat\fR vector data types are supported\&. The vector data type is defined with the type name i\&.e\&. \fBchar\fR, \fBuchar\fR, \fBshort\fR, \fBushort\fR, \fBint\fR, \fBuint\fR, \fBfloat\fR, \fBlong\fR, or \fBulong\fR followed by a literal value \fIn\fR that defines the number of elements in the vector\&. Supported values of \fIn\fR are 2, 3, 4, 8, and 16 for all vector data types\&. .PP The built\-in 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 built\-in vector data type in the OpenCL C programming language and the corresponding data type available to the application: .TS allbox tab(:); lB lB lB. T{ Type in OpenCL Language T}:T{ Description T}:T{ API type for application T} .T& l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l. T{ \fBchar\fR\fB\fIn\fR\fR T}:T{ A vector of \fIn\fR 8\-bit signed two\*(Aqs complement integer values\&. T}:T{ \fBcl_char\fR\fB\fIn\fR\fR T} T{ \fBuchar\fR\fB\fIn\fR\fR T}:T{ A vector of \fIn\fR 8\-bit unsigned integer values\&. T}:T{ \fBcl_uchar\fR\fB\fIn\fR\fR T} T{ \fBshort\fR\fB\fIn\fR\fR T}:T{ A vector of \fIn\fR 16\-bit signed two\*(Aqs complement integer values\&. T}:T{ \fBcl_short\fR\fB\fIn\fR\fR T} T{ \fBushort\fR\fB\fIn\fR\fR T}:T{ A vector of \fIn\fR 16\-bit unsigned integer values\&. T}:T{ \fBcl_ushort\fR\fB\fIn\fR\fR T} T{ \fBint\fR\fB\fIn\fR\fR T}:T{ A vector of \fIn\fR 32\-bit signed two\*(Aqs complement integer values\&. T}:T{ \fBcl_int\fR\fB\fIn\fR\fR T} T{ \fBuint\fR\fB\fIn\fR\fR T}:T{ A vector of \fIn\fR 32\-bit unsigned integer values\&. T}:T{ \fBcl_uint\fR\fB\fIn\fR\fR T} T{ \fBlong\fR\fB\fIn\fR\fR T}:T{ A vector of \fIn\fR 64\-bit signed two\*(Aqs complement integer values\&. T}:T{ \fBcl_long\fR\fB\fIn\fR\fR T} T{ \fBulong\fR\fB\fIn\fR\fR T}:T{ A vector of \fIn\fR 64\-bit unsigned integer values\&. T}:T{ \fBcl_ulong\fR\fB\fIn\fR\fR T} T{ \fBfloat\fR\fB\fIn\fR\fR T}:T{ A vector of \fIn\fR 32\-bit floating\-point values\&. T}:T{ \fBcl_float\fR\fB\fIn\fR\fR T} T{ \fBdouble\fR\fB\fIn\fR\fR T}:T{ A vector of \fIn\fR 64\-bit floating\-point values\&. T}:T{ \fBcl_double\fR\fB\fIn\fR\fR T} .TE .sp 1 .SH "NOTES" .PP Built\-in 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 built\-in types supported natively by the compute device\&. .PP The \fBdouble\fR vector type is an optional type that is supported if \fBCL_DEVICE_DOUBLE_FP_CONFIG\fR for a device is not zero\&. See \fBclGetDeviceInfo\fR(3clc)\&. .SH "OPTIONAL HALF FLOATING POINT" .PP The \fBhalf\fR floating\-point is supported as an optional extension\&. An application that wants to use \fBhalf\fR and \fBhalf\fR\fB\fIn\fR\fR will need to include the \fBcl_khr_fp16\fR(3clc) directive\&. This will extended the list of built\-in vector and scalar data types to include the following: .PP .TS allbox tab(:); lB lB lB. T{ Type in OpenCL Language T}:T{ Description T}:T{ API type for application T} .T& l l l l l l l l l l l l l l l. T{ \fBhalf2\fR T}:T{ A 2\-component half\-precision floating\-point vector\&. T}:T{ \fBcl_half2\fR T} T{ \fBhalf3\fR T}:T{ A 3\-component half\-precision floating\-point vector\&. T}:T{ \fBcl_half3\fR T} T{ \fBhalf4\fR T}:T{ A 4\-component half\-precision floating\-point vector\&. T}:T{ \fBcl_half4\fR T} T{ \fBhalf8\fR T}:T{ An 8\-component half\-precision floating\-point vector\&. T}:T{ \fBcl_half8\fR T} T{ \fBhalf16\fR T}:T{ A 16\-component half\-precision floating\-point vector\&. T}:T{ \fBcl_half16\fR T} .TE .sp 1 .PP The relational, equality, logical and logical unary operators can be used with \fBhalf\fR scalar and \fBhalf\fR\fB\fIn\fR\fR vector types and shall produce a scalar \fBint\fR and vector \fBshort\fR\fB\fIn\fR\fR result respectively\&. .PP The OpenCL compiler accepts an h and H suffix on floating point literals, indicating the literal is typed as a \fBhalf\fR\&. .SH "SPECIFICATION" .PP \m[blue]\fBOpenCL Specification\fR\m[]\&\s-2\u[1]\d\s+2 .SH "SEE ALSO" .PP \fBscalarDataTypes\fR(3clc), \fBreservedDataTypes\fR(3clc), \fBotherDataTypes\fR(3clc), \fBabstractDataTypes\fR(3clc), \fBenums\fR(3clc), \fBcl_khr_fp16\fR(3clc), \fBcl_khr_fp64\fR(3clc) .SH "AUTHORS" .PP \fBThe Khronos Group\fR .SH "COPYRIGHT" .br Copyright \(co 2007-2020 The Khronos Group Inc. .br 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. .sp .SH "NOTES" .IP " 1." 4 OpenCL Specification .RS 4 \%page 198, section 6.1.2 - Built-in Vector Data Types .RE