logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Vector_Data_Types - Built-in vector data types.

Authors

TheKhronosGroup

Description

       The char, unsignedchar, short, unsignedshort, integer, unsignedinteger, long, unsignedlong, 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, float, long, or ulong 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.

       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:
       ┌─────────────────────────┬──────────────────────────────┬──────────────────────────┐
       │ TypeinOpenCLLanguageDescriptionAPItypeforapplication │
       ├─────────────────────────┼──────────────────────────────┼──────────────────────────┤
       │ charn                   │ A vector of n 8-bit signed   │ cl_charn                 │
       │                         │ two's complement integer     │                          │
       │                         │ values.                      │                          │
       ├─────────────────────────┼──────────────────────────────┼──────────────────────────┤
       │ ucharn                  │ A vector of n 8-bit unsigned │ cl_ucharn                │
       │                         │ integer values.              │                          │
       ├─────────────────────────┼──────────────────────────────┼──────────────────────────┤
       │ shortn                  │ A vector of n 16-bit signed  │ cl_shortn                │
       │                         │ two's complement integer     │                          │
       │                         │ values.                      │                          │
       ├─────────────────────────┼──────────────────────────────┼──────────────────────────┤
       │ ushortn                 │ A vector of n 16-bit         │ cl_ushortn               │
       │                         │ unsigned integer values.     │                          │
       ├─────────────────────────┼──────────────────────────────┼──────────────────────────┤
       │ intn                    │ A vector of n 32-bit signed  │ cl_intn                  │
       │                         │ two's complement integer     │                          │
       │                         │ values.                      │                          │
       ├─────────────────────────┼──────────────────────────────┼──────────────────────────┤
       │ uintn                   │ A vector of n 32-bit         │ cl_uintn                 │
       │                         │ unsigned integer values.     │                          │
       ├─────────────────────────┼──────────────────────────────┼──────────────────────────┤
       │ longn                   │ A vector of n 64-bit signed  │ cl_longn                 │
       │                         │ two's complement integer     │                          │
       │                         │ values.                      │                          │
       ├─────────────────────────┼──────────────────────────────┼──────────────────────────┤
       │ ulongn                  │ A vector of n 64-bit         │ cl_ulongn                │
       │                         │ unsigned integer values.     │                          │
       ├─────────────────────────┼──────────────────────────────┼──────────────────────────┤
       │ floatn                  │ A vector of n 32-bit         │ cl_floatn                │
       │                         │ floating-point values.       │                          │
       ├─────────────────────────┼──────────────────────────────┼──────────────────────────┤
       │ doublen                 │ A vector of n 64-bit         │ cl_doublen               │
       │                         │ floating-point values.       │                          │
       └─────────────────────────┴──────────────────────────────┴──────────────────────────┘

Name

       Vector_Data_Types - Built-in vector data types.

Notes

        1. OpenCL Specification
           page 198, section 6.1.2 - Built-in Vector Data Types

The Khronos Group                                  11/18/2024                            VECTORDATATYPES(3clc)

Optional Half Floating Point

       The half floating-point is supported as an optional extension. An application that wants to use half and
       halfn will need to include the cl_khr_fp16(3clc) directive. This will extended the list of built-in
       vector and scalar data types to include the following:

       ┌─────────────────────────┬──────────────────────────────┬──────────────────────────┐
       │ TypeinOpenCLLanguageDescriptionAPItypeforapplication │
       ├─────────────────────────┼──────────────────────────────┼──────────────────────────┤
       │ half2                   │ A 2-component half-precision │ cl_half2                 │
       │                         │ floating-point vector.       │                          │
       ├─────────────────────────┼──────────────────────────────┼──────────────────────────┤
       │ half3                   │ A 3-component half-precision │ cl_half3                 │
       │                         │ floating-point vector.       │                          │
       ├─────────────────────────┼──────────────────────────────┼──────────────────────────┤
       │ half4                   │ A 4-component half-precision │ cl_half4                 │
       │                         │ floating-point vector.       │                          │
       ├─────────────────────────┼──────────────────────────────┼──────────────────────────┤
       │ half8                   │ An 8-component               │ cl_half8                 │
       │                         │ half-precision               │                          │
       │                         │ floating-point vector.       │                          │
       ├─────────────────────────┼──────────────────────────────┼──────────────────────────┤
       │ half16                  │ A 16-component               │ cl_half16                │
       │                         │ half-precision               │                          │
       │                         │ floating-point vector.       │                          │
       └─────────────────────────┴──────────────────────────────┴──────────────────────────┘

       The relational, equality, logical and logical unary operators can be used with half scalar and halfn
       vector types and shall produce a scalar int and vector shortn result respectively.

       The OpenCL compiler accepts an h and H suffix on floating point literals, indicating the literal is typed
       as a half.

See Also

scalarDataTypes(3clc), reservedDataTypes(3clc), otherDataTypes(3clc), abstractDataTypes(3clc),
       enums(3clc), cl_khr_fp16(3clc), cl_khr_fp64(3clc)

Specification

OpenCLSpecification[1]

See Also