Transcription of The OpenCL C 2.0 Specification - Khronos Group
1 The OpenCL C SpecificationKhronos OpenCL Working GroupVersion , Fri, 19 Jul 2019 14:13:00 +0000 Table of Contents6. The OpenCL C Programming Language.. Supported Data Types.. Built-in Scalar Data Types.. Built-in Vector Data Types4.. Other Built-in Data Types.. Reserved Data Types.. Alignment of Types.. Vector Literals.. Vector Components.. Aliasing Rules.. Keywords.. Conversions and Type Casting.. Implicit Conversions.. Explicit Casts.. Explicit Conversions.. Reinterpreting Data As Another Type.. Pointer Casting.. Usual Arithmetic Conversions.
2 Operators.. Arithmetic Operators.. Unary Operators.. Pre- and Post-Operators.. Relational Operators.. Equality Operators.. Bitwise Operators.. Logical Operators.. Unary Logical Operator.. Ternary Selection Operator.. Shift Operators.. Sizeof Operator.. Comma Operator.. Indirection Operator.. Address Operator.. Assignment Operator.. Vector Operations.. Address Space Qualifiers.. __global (or global).. __local (or local).. __constant (or constant).. __private (or private).. The generic address space.. Changes to C99.
3 Access Qualifiers.. Function Qualifiers.. __kernel (or kernel).. Optional Attribute Qualifiers.. Storage-Class Specifiers.. Restrictions.. Preprocessor Directives and Macros.. Attribute Qualifiers.. Specifying Attributes of Types.. Specifying Attributes of Functions.. Specifying Attributes of Variables.. Specifying Attributes of Blocks and Control-Flow-Statements.. Specifying Attribute For Unrolling Loops.. Extending Attribute Qualifiers.. Blocks.. Declaring and Using a Block.. Declaring a Block Reference.. Block Literal Expressions.
4 Control Flow.. Restrictions.. Built-in Functions.. Work-Item Functions.. Math Functions.. Integer Functions.. Common Functions33.. Geometric Functions34.. Relational Functions.. Vector Data Load and Store Functions.. Synchronization Functions.. Address Space Qualifier Functions.. Async Copies from Global to Local Memory, Local to Global Memory, and Prefetch.. Atomic Functions.. Miscellaneous Vector Functions.. printf.. Image Read and Write Functions.. Work- Group Functions.. Pipe Functions.. Enqueuing Kernels.. 1517.
5 OpenCL Numerical Compliance.. Rounding Modes.. INF, NaN and Denormalized Numbers.. Floating-Point Exceptions.. Relative Error as ULPs.. Edge Case Behavior.. Additional Requirements Beyond C99 TC2.. Changes to C99 TC2 Behavior.. Edge Case Behavior in Flush To Zero Mode.. 1838. Image Addressing and Filtering.. Image Coordinates.. Addressing and Filter Modes.. Conversion Rules.. Conversion rules for normalized integer channel data types.. Conversion rules for half precision floating-point channel data type.. Conversion rules for floating-point channel data type.
6 Conversion rules for signed and unsigned 8-bit, 16-bit and 32-bit integer channel datatypes Conversion rules for sRGBA and sBGRA images.. Selecting an Image from an Image Array.. 1979. Normative References.. 19810. Acknowledgements.. 199 Copyright 2008-2019 The Khronos Specification is protected by copyright laws and contains material proprietary to the KhronosGroup, Inc. Except as described by these terms, it or any components may not be reproduced,republished, distributed, transmitted, displayed, broadcast or otherwise exploited in any mannerwithout the express prior written permission of Khronos Group grants a conditional copyright license to use and reproduce the unmodifiedspecification for any purpose, without fee or royalty, EXCEPT no licenses to any patent, trademarkor other intellectual property rights are granted under these terms.
7 Parties desiring to implementthe Specification and make use of Khronos trademarks in relation to that implementation, andreceive reciprocal patent license protection under the Khronos IP Policy must become Adopters andconfirm the implementation as conformant under the process defined by Khronos for thisspecification; see Group makes no, and expressly disclaims any, representations or warranties, express orimplied, regarding this Specification , including, without limitation: merchantability, fitness for aparticular purpose, non-infringement of any intellectual property, correctness, accuracy,completeness, timeliness, and reliability.
8 Under no circumstances will the Khronos Group , or any ofits Promoters, Contributors or Members, or their respective partners, officers, directors, employees,agents or representatives be liable for any damages, whether direct, indirect, special orconsequential damages for lost revenues, lost profits, or otherwise, arising from or in connectionwith these and Khronos are registered trademarks, and OpenXR, SPIR, SPIR-V, SYCL, WebGL, WebCL,OpenVX, OpenVG, EGL, COLLADA, glTF, NNEF, OpenKODE, OpenKCAM, StreamInput, OpenWF,OpenSL ES, OpenMAX, OpenMAX AL, OpenMAX IL, OpenMAX DL, OpenML and DevU aretrademarks of the Khronos Group Inc.
9 ASTC is a trademark of ARM Holdings PLC, OpenCL is atrademark of Apple Inc. and OpenGL and OpenML are registered trademarks and the OpenGL ESand OpenGL SC logos are trademarks of Silicon Graphics International used under license byKhronos. All other product names, trademarks, and/or company names are used solely foridentification and belong to their respective 6. The OpenCL C ProgrammingLanguage NoteThis document starts at chapter 6 to keep the section numbers historicallyconsistent with previous versions of the OpenCL and OpenCL C ProgrammingLanguage section describes the OpenCL C programming language used to create kernels that areexecuted on OpenCL device(s).
10 The OpenCL C programming language (also referred to as OpenCL C)is based on the ISO/IEC 9899:1999 C language Specification ( C99 Specification or just C99 )with specific extensions and restrictions. Please refer to that Specification for a detailed descriptionof the language grammar. This document describes modifications and restrictions to C99 supportedin OpenCL addition, some features of OpenCL C are based on the ISO/IEC 9899:2011 C language Specification ( C11 Specification or just C11 . Such features are described by reference to Supported Data TypesThe following data types are Built-in Scalar Data TypesThe following table describes the list of built-in scalar data 1.)