VECTORDATATYPES(3clc)

πŸ“¦
version 1.0~svn33624 Β· 3 versions
, in ubuntu jammy, ubuntu noble

✨ VECTOR DATA TYPES ✨

okay bestie, this is a page from the OpenCL Manual β€” yes we're doing GPU-adjacent lore today and honestly? iconic. sit down, hydrate, let's get into it πŸ’–


πŸ’« NAME πŸ’«

Vector_Data_Types β€” the built-in vector data types, fr fr.


πŸ¦‹ DESCRIPTION πŸ¦‹

So the char, unsigned char, short, unsigned short, integer, unsigned integer, long, unsigned long, and float vector data types are supported. periodt.

A vector data type is literally defined by the type name β€” that's char, uchar, short, ushort, int, uint, float, long, or ulong β€” followed by a literal value n that says how many elements are in the vector. And the supported values of n are 2, 3, 4, 8, and 16 for all vector data types. every single one. no cap.

Also! The built-in vector data types are declared as appropriate types in the OpenCL API (and the header files) so an application can use them. Here's the full rundown of the built-in vector data type in the OpenCL C programming language and the corresponding data type available to the application 🫢

  • charn β€” A vector of n 8-bit signed two's complement integer values. API type for application: cl_charn
  • ucharn β€” A vector of n 8-bit unsigned integer values. API type for application: cl_ucharn
  • shortn β€” A vector of n 16-bit signed two's complement integer values. API type for application: cl_shortn
  • ushortn β€” A vector of n 16-bit unsigned integer values. API type for application: cl_ushortn
  • intn β€” A vector of n 32-bit signed two's complement integer values. API type for application: cl_intn
  • uintn β€” A vector of n 32-bit unsigned integer values. API type for application: cl_uintn
  • longn β€” A vector of n 64-bit signed two's complement integer values. API type for application: cl_longn
  • ulongn β€” A vector of n 64-bit unsigned integer values. API type for application: cl_ulongn
  • floatn β€” A vector of n 32-bit floating-point values. API type for application: cl_floatn
  • doublen β€” A vector of n 64-bit floating-point values. API type for application: cl_doublen

🌸 NOTES 🌸

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. like, the device is out here being converted by the device compiler into appropriate instructions that use underlying built-in types supported natively by the compute device. that's the whole vibe. πŸ’…

The double vector type is an optional type β€” it's supported if CL_DEVICE_DOUBLE_FP_CONFIG for a device is not zero. See clGetDeviceInfo(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 extend the list of built-in vector and scalar data types to include the following ✨

  • half2 β€” A 2-component half-precision floating-point vector. API type for application: cl_half2
  • half3 β€” A 3-component half-precision floating-point vector. API type for application: cl_half3
  • half4 β€” A 4-component half-precision floating-point vector. API type for application: cl_half4
  • half8 β€” An 8-component half-precision floating-point vector. API type for application: cl_half8
  • half16 β€” A 16-component half-precision floating-point vector. API type for application: cl_half16

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. πŸ‘‘

And get this β€” the OpenCL compiler accepts an h and H suffix on floating point literals, indicating the literal is typed as a half. little treats. πŸ“


⭐ SPECIFICATION ⭐

OpenCL Specification[1]


🌈 SEE ALSO 🌈

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


πŸ‘‘ AUTHORS πŸ‘‘

The Khronos Group


Copyright Β© 2007-2020 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.


πŸ”₯ NOTES πŸ”₯

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

okay that's the whole page, you ate that πŸ’… go forth and vectorize responsibly

signing off from The Khronos Group, dated 01/14/2021 β€” stay slay, bestie πŸŽ€

πŸ“¦ where this page comes from