drop __attribute__((aligned(X))) from cl_X defs Currently, we add __attribute__((aligned(X))) for definitions like cl_int, cl_short etc. This guarantees that the variable will be aligned *at least* at an X byte boundary. We don't need to do this, for a few reasons: - Most of these types are fixed width (int32_t, int16_t, etc.). This means __attribute((aligned(X))) isn't doing anything, as the types are exactly the right size, so they will already be aligned to at least their size. float and double are not guaranteed to be any given width, though in practice they are almost always IEEE 754 floats and therefore 4 and 8 bytes respectively. If they were not 4/8 bytes, it's unclear that forcing 4/8 byte alignment would be good for either space or performance efficiency. - Attributes don't carry over to templates, which ends up causing a GCC -Wignored-attributes warning in cl.hpp when we declare an std::vector<cl_int>. This warning is indicating that the attributes get dropped when put inside a template. Nothing seems to break when this happens, further suggesting that the attributes aren't really needed. - The attributes aren't present on Windows, so if they were really needed, then Windows is currently broken. Again, it doesn't seem like anything is broken, so this is further evidence that we don't need to add these attributes. See here for further reference on __attribute((aligned(X))): https://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Type-Attributes.html
This repository contains C language headers for the OpenCL API.
The authoritative public repository for these headers is located at:
https://github.com/KhronosGroup/OpenCL-Headers
Issues, proposed fixes for issues, and other suggested changes should be created using Github.
The OpenCL API headers in this repository are Unified headers and are designed to work with all released OpenCL versions. This differs from previous OpenCL API headers, where version-specific API headers either existed in separate branches, or in separate folders in a branch.
By default, the OpenCL API headers in this repository are for the latest OpenCL version (currently OpenCL 2.2). To use these API headers to target a different OpenCL version, an application may #define the preprocessor value CL_TARGET_OPENCL_VERSION before including the OpenCL API headers. The CL_TARGET_OPENCL_VERSION is a three digit decimal value representing the OpenCL API version.
For example, to enforce usage of no more than the OpenCL 1.2 APIs, you may include the OpenCL API headers as follows:
#define CL_TARGET_OPENCL_VERSION 120 #include <CL/opencl.h>
README.md This file LICENSE Source license for the OpenCL API headers CL/ Unified OpenCL API headers tree
See LICENSE.
OpenCL and the OpenCL logo are trademarks of Apple Inc. used by permission by Khronos.