1 /**********************************************************************************
2 * Copyright (c) 2008-2012 The Khronos Group Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and/or associated documentation files (the
6 * "Materials"), to deal in the Materials without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Materials, and to
9 * permit persons to whom the Materials are furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice shall be included
13 * in all copies or substantial portions of the Materials.
15 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
22 **********************************************************************************/
24 /* $Revision: 11803 $ on $Date: 2010-06-25 10:02:12 -0700 (Fri, 25 Jun 2010) $ */
26 #ifndef __CL_PLATFORM_H
27 #define __CL_PLATFORM_H
30 /* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER below */
31 #include <AvailabilityMacros.h>
40 #define CL_API_CALL __stdcall
41 #define CL_CALLBACK __stdcall
49 #define CL_EXTENSION_WEAK_LINK __attribute__((weak_import))
50 #define CL_API_SUFFIX__VERSION_1_0 AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
51 #define CL_EXT_SUFFIX__VERSION_1_0 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
52 #define CL_API_SUFFIX__VERSION_1_1 AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
53 #define GCL_API_SUFFIX__VERSION_1_1 AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
54 #define CL_EXT_SUFFIX__VERSION_1_1 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
55 #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_7
57 #ifdef AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
58 #define CL_API_SUFFIX__VERSION_1_2 AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
59 #define GCL_API_SUFFIX__VERSION_1_2 AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
60 #define CL_EXT_SUFFIX__VERSION_1_2 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
61 #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
62 #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_8
64 #warning This path should never happen outside of internal operating system development. AvailabilityMacros do not function correctly here!
65 #define CL_API_SUFFIX__VERSION_1_2 AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
66 #define GCL_API_SUFFIX__VERSION_1_2 AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
67 #define CL_EXT_SUFFIX__VERSION_1_2 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
68 #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
71 #define CL_EXTENSION_WEAK_LINK
72 #define CL_API_SUFFIX__VERSION_1_0
73 #define CL_EXT_SUFFIX__VERSION_1_0
74 #define CL_API_SUFFIX__VERSION_1_1
75 #define CL_EXT_SUFFIX__VERSION_1_1
76 #define CL_API_SUFFIX__VERSION_1_2
77 #define CL_EXT_SUFFIX__VERSION_1_2
80 #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
81 #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
82 #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
84 #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED __attribute__((deprecated))
85 #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
88 #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
89 #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
90 #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
92 #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED __attribute__((deprecated))
93 #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
96 #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
97 #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
98 #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
100 #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
101 #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED __declspec(deprecated)
104 #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
105 #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
106 #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
108 #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
109 #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED __declspec(deprecated)
112 #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
113 #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
115 #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
116 #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
120 #if (defined (_WIN32) && defined(_MSC_VER))
123 typedef signed __int8 cl_char;
124 typedef unsigned __int8 cl_uchar;
125 typedef signed __int16 cl_short;
126 typedef unsigned __int16 cl_ushort;
127 typedef signed __int32 cl_int;
128 typedef unsigned __int32 cl_uint;
129 typedef signed __int64 cl_long;
130 typedef unsigned __int64 cl_ulong;
132 typedef unsigned __int16 cl_half;
133 typedef float cl_float;
134 typedef double cl_double;
136 /* Macro names and corresponding values defined by OpenCL */
137 #define CL_CHAR_BIT 8
138 #define CL_SCHAR_MAX 127
139 #define CL_SCHAR_MIN (-127-1)
140 #define CL_CHAR_MAX CL_SCHAR_MAX
141 #define CL_CHAR_MIN CL_SCHAR_MIN
142 #define CL_UCHAR_MAX 255
143 #define CL_SHRT_MAX 32767
144 #define CL_SHRT_MIN (-32767-1)
145 #define CL_USHRT_MAX 65535
146 #define CL_INT_MAX 2147483647
147 #define CL_INT_MIN (-2147483647-1)
148 #define CL_UINT_MAX 0xffffffffU
149 #define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
150 #define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
151 #define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
154 #define CL_FLT_MANT_DIG 24
155 #define CL_FLT_MAX_10_EXP +38
156 #define CL_FLT_MAX_EXP +128
157 #define CL_FLT_MIN_10_EXP -37
158 #define CL_FLT_MIN_EXP -125
159 #define CL_FLT_RADIX 2
160 #define CL_FLT_MAX 340282346638528859811704183484516925440.0f
161 #define CL_FLT_MIN 1.175494350822287507969e-38f
162 #define CL_FLT_EPSILON 0x1.0p-23f
164 #define CL_DBL_DIG 15
165 #define CL_DBL_MANT_DIG 53
166 #define CL_DBL_MAX_10_EXP +308
167 #define CL_DBL_MAX_EXP +1024
168 #define CL_DBL_MIN_10_EXP -307
169 #define CL_DBL_MIN_EXP -1021
170 #define CL_DBL_RADIX 2
171 #define CL_DBL_MAX 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
172 #define CL_DBL_MIN 2.225073858507201383090e-308
173 #define CL_DBL_EPSILON 2.220446049250313080847e-16
175 #define CL_M_E 2.718281828459045090796
176 #define CL_M_LOG2E 1.442695040888963387005
177 #define CL_M_LOG10E 0.434294481903251816668
178 #define CL_M_LN2 0.693147180559945286227
179 #define CL_M_LN10 2.302585092994045901094
180 #define CL_M_PI 3.141592653589793115998
181 #define CL_M_PI_2 1.570796326794896557999
182 #define CL_M_PI_4 0.785398163397448278999
183 #define CL_M_1_PI 0.318309886183790691216
184 #define CL_M_2_PI 0.636619772367581382433
185 #define CL_M_2_SQRTPI 1.128379167095512558561
186 #define CL_M_SQRT2 1.414213562373095145475
187 #define CL_M_SQRT1_2 0.707106781186547572737
189 #define CL_M_E_F 2.71828174591064f
190 #define CL_M_LOG2E_F 1.44269502162933f
191 #define CL_M_LOG10E_F 0.43429449200630f
192 #define CL_M_LN2_F 0.69314718246460f
193 #define CL_M_LN10_F 2.30258512496948f
194 #define CL_M_PI_F 3.14159274101257f
195 #define CL_M_PI_2_F 1.57079637050629f
196 #define CL_M_PI_4_F 0.78539818525314f
197 #define CL_M_1_PI_F 0.31830987334251f
198 #define CL_M_2_PI_F 0.63661974668503f
199 #define CL_M_2_SQRTPI_F 1.12837922573090f
200 #define CL_M_SQRT2_F 1.41421353816986f
201 #define CL_M_SQRT1_2_F 0.70710676908493f
203 #define CL_NAN (CL_INFINITY - CL_INFINITY)
204 #define CL_HUGE_VALF ((cl_float) 1e50)
205 #define CL_HUGE_VAL ((cl_double) 1e500)
206 #define CL_MAXFLOAT CL_FLT_MAX
207 #define CL_INFINITY CL_HUGE_VALF
214 typedef int8_t cl_char;
215 typedef uint8_t cl_uchar;
216 typedef int16_t cl_short __attribute__((aligned(2)));
217 typedef uint16_t cl_ushort __attribute__((aligned(2)));
218 typedef int32_t cl_int __attribute__((aligned(4)));
219 typedef uint32_t cl_uint __attribute__((aligned(4)));
220 typedef int64_t cl_long __attribute__((aligned(8)));
221 typedef uint64_t cl_ulong __attribute__((aligned(8)));
223 typedef uint16_t cl_half __attribute__((aligned(2)));
224 typedef float cl_float __attribute__((aligned(4)));
225 typedef double cl_double __attribute__((aligned(8)));
227 /* Macro names and corresponding values defined by OpenCL */
228 #define CL_CHAR_BIT 8
229 #define CL_SCHAR_MAX 127
230 #define CL_SCHAR_MIN (-127-1)
231 #define CL_CHAR_MAX CL_SCHAR_MAX
232 #define CL_CHAR_MIN CL_SCHAR_MIN
233 #define CL_UCHAR_MAX 255
234 #define CL_SHRT_MAX 32767
235 #define CL_SHRT_MIN (-32767-1)
236 #define CL_USHRT_MAX 65535
237 #define CL_INT_MAX 2147483647
238 #define CL_INT_MIN (-2147483647-1)
239 #define CL_UINT_MAX 0xffffffffU
240 #define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
241 #define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
242 #define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
245 #define CL_FLT_MANT_DIG 24
246 #define CL_FLT_MAX_10_EXP +38
247 #define CL_FLT_MAX_EXP +128
248 #define CL_FLT_MIN_10_EXP -37
249 #define CL_FLT_MIN_EXP -125
250 #define CL_FLT_RADIX 2
251 #define CL_FLT_MAX 0x1.fffffep127f
252 #define CL_FLT_MIN 0x1.0p-126f
253 #define CL_FLT_EPSILON 0x1.0p-23f
255 #define CL_DBL_DIG 15
256 #define CL_DBL_MANT_DIG 53
257 #define CL_DBL_MAX_10_EXP +308
258 #define CL_DBL_MAX_EXP +1024
259 #define CL_DBL_MIN_10_EXP -307
260 #define CL_DBL_MIN_EXP -1021
261 #define CL_DBL_RADIX 2
262 #define CL_DBL_MAX 0x1.fffffffffffffp1023
263 #define CL_DBL_MIN 0x1.0p-1022
264 #define CL_DBL_EPSILON 0x1.0p-52
266 #define CL_M_E 2.718281828459045090796
267 #define CL_M_LOG2E 1.442695040888963387005
268 #define CL_M_LOG10E 0.434294481903251816668
269 #define CL_M_LN2 0.693147180559945286227
270 #define CL_M_LN10 2.302585092994045901094
271 #define CL_M_PI 3.141592653589793115998
272 #define CL_M_PI_2 1.570796326794896557999
273 #define CL_M_PI_4 0.785398163397448278999
274 #define CL_M_1_PI 0.318309886183790691216
275 #define CL_M_2_PI 0.636619772367581382433
276 #define CL_M_2_SQRTPI 1.128379167095512558561
277 #define CL_M_SQRT2 1.414213562373095145475
278 #define CL_M_SQRT1_2 0.707106781186547572737
280 #define CL_M_E_F 2.71828174591064f
281 #define CL_M_LOG2E_F 1.44269502162933f
282 #define CL_M_LOG10E_F 0.43429449200630f
283 #define CL_M_LN2_F 0.69314718246460f
284 #define CL_M_LN10_F 2.30258512496948f
285 #define CL_M_PI_F 3.14159274101257f
286 #define CL_M_PI_2_F 1.57079637050629f
287 #define CL_M_PI_4_F 0.78539818525314f
288 #define CL_M_1_PI_F 0.31830987334251f
289 #define CL_M_2_PI_F 0.63661974668503f
290 #define CL_M_2_SQRTPI_F 1.12837922573090f
291 #define CL_M_SQRT2_F 1.41421353816986f
292 #define CL_M_SQRT1_2_F 0.70710676908493f
294 #if defined( __GNUC__ )
295 #define CL_HUGE_VALF __builtin_huge_valf()
296 #define CL_HUGE_VAL __builtin_huge_val()
297 #define CL_NAN __builtin_nanf( "" )
299 #define CL_HUGE_VALF ((cl_float) 1e50)
300 #define CL_HUGE_VAL ((cl_double) 1e500)
301 float nanf( const char * );
302 #define CL_NAN nanf( "" )
304 #define CL_MAXFLOAT CL_FLT_MAX
305 #define CL_INFINITY CL_HUGE_VALF
311 /* Mirror types to GL types. Mirror types allow us to avoid deciding which 87s to load based on whether we are using GL or GLES here. */
312 typedef unsigned int cl_GLuint;
313 typedef int cl_GLint;
314 typedef unsigned int cl_GLenum;
319 * Note: OpenCL requires that all types be naturally aligned.
320 * This means that vector types must be naturally aligned.
321 * For example, a vector of four floats must be aligned to
322 * a 16 byte boundary (calculated as 4 * the natural 4-byte
323 * alignment of the float). The alignment qualifiers here
324 * will only function properly if your compiler supports them
325 * and if you don't actively work to defeat them. For example,
326 * in order for a cl_float4 to be 16 byte aligned in a struct,
327 * the start of the struct must itself be 16-byte aligned.
329 * Maintaining proper alignment is the user's responsibility.
332 /* Define basic vector types */
333 #if defined( __VEC__ )
334 #include <altivec.h> /* may be omitted depending on compiler. AltiVec spec provides no way to detect whether the header is required. */
335 typedef vector unsigned char __cl_uchar16;
336 typedef vector signed char __cl_char16;
337 typedef vector unsigned short __cl_ushort8;
338 typedef vector signed short __cl_short8;
339 typedef vector unsigned int __cl_uint4;
340 typedef vector signed int __cl_int4;
341 typedef vector float __cl_float4;
342 #define __CL_UCHAR16__ 1
343 #define __CL_CHAR16__ 1
344 #define __CL_USHORT8__ 1
345 #define __CL_SHORT8__ 1
346 #define __CL_UINT4__ 1
347 #define __CL_INT4__ 1
348 #define __CL_FLOAT4__ 1
351 #if defined( __SSE__ )
352 #if defined( __MINGW64__ )
355 #include <xmmintrin.h>
357 #if defined( __GNUC__ )
358 typedef float __cl_float4 __attribute__((vector_size(16)));
360 typedef __m128 __cl_float4;
362 #define __CL_FLOAT4__ 1
365 #if defined( __SSE2__ )
366 #if defined( __MINGW64__ )
369 #include <emmintrin.h>
371 #if defined( __GNUC__ )
372 typedef cl_uchar __cl_uchar16 __attribute__((vector_size(16)));
373 typedef cl_char __cl_char16 __attribute__((vector_size(16)));
374 typedef cl_ushort __cl_ushort8 __attribute__((vector_size(16)));
375 typedef cl_short __cl_short8 __attribute__((vector_size(16)));
376 typedef cl_uint __cl_uint4 __attribute__((vector_size(16)));
377 typedef cl_int __cl_int4 __attribute__((vector_size(16)));
378 typedef cl_ulong __cl_ulong2 __attribute__((vector_size(16)));
379 typedef cl_long __cl_long2 __attribute__((vector_size(16)));
380 typedef cl_double __cl_double2 __attribute__((vector_size(16)));
382 typedef __m128i __cl_uchar16;
383 typedef __m128i __cl_char16;
384 typedef __m128i __cl_ushort8;
385 typedef __m128i __cl_short8;
386 typedef __m128i __cl_uint4;
387 typedef __m128i __cl_int4;
388 typedef __m128i __cl_ulong2;
389 typedef __m128i __cl_long2;
390 typedef __m128d __cl_double2;
392 #define __CL_UCHAR16__ 1
393 #define __CL_CHAR16__ 1
394 #define __CL_USHORT8__ 1
395 #define __CL_SHORT8__ 1
396 #define __CL_INT4__ 1
397 #define __CL_UINT4__ 1
398 #define __CL_ULONG2__ 1
399 #define __CL_LONG2__ 1
400 #define __CL_DOUBLE2__ 1
403 #if defined( __MMX__ )
404 #include <mmintrin.h>
405 #if defined( __GNUC__ )
406 typedef cl_uchar __cl_uchar8 __attribute__((vector_size(8)));
407 typedef cl_char __cl_char8 __attribute__((vector_size(8)));
408 typedef cl_ushort __cl_ushort4 __attribute__((vector_size(8)));
409 typedef cl_short __cl_short4 __attribute__((vector_size(8)));
410 typedef cl_uint __cl_uint2 __attribute__((vector_size(8)));
411 typedef cl_int __cl_int2 __attribute__((vector_size(8)));
412 typedef cl_ulong __cl_ulong1 __attribute__((vector_size(8)));
413 typedef cl_long __cl_long1 __attribute__((vector_size(8)));
414 typedef cl_float __cl_float2 __attribute__((vector_size(8)));
416 typedef __m64 __cl_uchar8;
417 typedef __m64 __cl_char8;
418 typedef __m64 __cl_ushort4;
419 typedef __m64 __cl_short4;
420 typedef __m64 __cl_uint2;
421 typedef __m64 __cl_int2;
422 typedef __m64 __cl_ulong1;
423 typedef __m64 __cl_long1;
424 typedef __m64 __cl_float2;
426 #define __CL_UCHAR8__ 1
427 #define __CL_CHAR8__ 1
428 #define __CL_USHORT4__ 1
429 #define __CL_SHORT4__ 1
430 #define __CL_INT2__ 1
431 #define __CL_UINT2__ 1
432 #define __CL_ULONG1__ 1
433 #define __CL_LONG1__ 1
434 #define __CL_FLOAT2__ 1
437 #if defined( __AVX__ )
438 #if defined( __MINGW64__ )
441 #include <immintrin.h>
443 #if defined( __GNUC__ )
444 typedef cl_float __cl_float8 __attribute__((vector_size(32)));
445 typedef cl_double __cl_double4 __attribute__((vector_size(32)));
447 typedef __m256 __cl_float8;
448 typedef __m256d __cl_double4;
450 #define __CL_FLOAT8__ 1
451 #define __CL_DOUBLE4__ 1
454 /* Define alignment keys */
455 #if defined( __GNUC__ )
456 #define CL_ALIGNED(_x) __attribute__ ((aligned(_x)))
457 #elif defined( _WIN32) && (_MSC_VER)
458 /* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements */
459 /* http://msdn.microsoft.com/en-us/library/373ak2y1%28VS.71%29.aspx */
460 /* #include <crtdefs.h> */
461 /* #define CL_ALIGNED(_x) _CRT_ALIGN(_x) */
462 #define CL_ALIGNED(_x)
464 #warning Need to implement some method to align data here
465 #define CL_ALIGNED(_x)
468 /* Indicate whether .xyzw, .s0123 and .hi.lo are supported */
469 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
470 /* .xyzw and .s0123...{f|F} are supported */
471 #define CL_HAS_NAMED_VECTOR_FIELDS 1
472 /* .hi and .lo are supported */
473 #define CL_HAS_HI_LO_VECTOR_FIELDS 1
476 /* Define cl_vector types */
478 /* ---- cl_charn ---- */
481 cl_char CL_ALIGNED(2) s[2];
482 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
483 __extension__ struct{ cl_char x, y; };
484 __extension__ struct{ cl_char s0, s1; };
485 __extension__ struct{ cl_char lo, hi; };
487 #if defined( __CL_CHAR2__)
494 cl_char CL_ALIGNED(4) s[4];
495 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
496 __extension__ struct{ cl_char x, y, z, w; };
497 __extension__ struct{ cl_char s0, s1, s2, s3; };
498 __extension__ struct{ cl_char2 lo, hi; };
500 #if defined( __CL_CHAR2__)
503 #if defined( __CL_CHAR4__)
508 /* cl_char3 is identical in size, alignment and behavior to cl_char4. See section 6.1.5. */
509 typedef cl_char4 cl_char3;
513 cl_char CL_ALIGNED(8) s[8];
514 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
515 __extension__ struct{ cl_char x, y, z, w; };
516 __extension__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7; };
517 __extension__ struct{ cl_char4 lo, hi; };
519 #if defined( __CL_CHAR2__)
522 #if defined( __CL_CHAR4__)
525 #if defined( __CL_CHAR8__ )
532 cl_char CL_ALIGNED(16) s[16];
533 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
534 __extension__ struct{ cl_char x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
535 __extension__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
536 __extension__ struct{ cl_char8 lo, hi; };
538 #if defined( __CL_CHAR2__)
541 #if defined( __CL_CHAR4__)
544 #if defined( __CL_CHAR8__ )
547 #if defined( __CL_CHAR16__ )
553 /* ---- cl_ucharn ---- */
556 cl_uchar CL_ALIGNED(2) s[2];
557 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
558 __extension__ struct{ cl_uchar x, y; };
559 __extension__ struct{ cl_uchar s0, s1; };
560 __extension__ struct{ cl_uchar lo, hi; };
562 #if defined( __cl_uchar2__)
569 cl_uchar CL_ALIGNED(4) s[4];
570 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
571 __extension__ struct{ cl_uchar x, y, z, w; };
572 __extension__ struct{ cl_uchar s0, s1, s2, s3; };
573 __extension__ struct{ cl_uchar2 lo, hi; };
575 #if defined( __CL_UCHAR2__)
578 #if defined( __CL_UCHAR4__)
583 /* cl_uchar3 is identical in size, alignment and behavior to cl_uchar4. See section 6.1.5. */
584 typedef cl_uchar4 cl_uchar3;
588 cl_uchar CL_ALIGNED(8) s[8];
589 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
590 __extension__ struct{ cl_uchar x, y, z, w; };
591 __extension__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7; };
592 __extension__ struct{ cl_uchar4 lo, hi; };
594 #if defined( __CL_UCHAR2__)
597 #if defined( __CL_UCHAR4__)
600 #if defined( __CL_UCHAR8__ )
607 cl_uchar CL_ALIGNED(16) s[16];
608 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
609 __extension__ struct{ cl_uchar x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
610 __extension__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
611 __extension__ struct{ cl_uchar8 lo, hi; };
613 #if defined( __CL_UCHAR2__)
616 #if defined( __CL_UCHAR4__)
619 #if defined( __CL_UCHAR8__ )
622 #if defined( __CL_UCHAR16__ )
628 /* ---- cl_shortn ---- */
631 cl_short CL_ALIGNED(4) s[2];
632 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
633 __extension__ struct{ cl_short x, y; };
634 __extension__ struct{ cl_short s0, s1; };
635 __extension__ struct{ cl_short lo, hi; };
637 #if defined( __CL_SHORT2__)
644 cl_short CL_ALIGNED(8) s[4];
645 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
646 __extension__ struct{ cl_short x, y, z, w; };
647 __extension__ struct{ cl_short s0, s1, s2, s3; };
648 __extension__ struct{ cl_short2 lo, hi; };
650 #if defined( __CL_SHORT2__)
653 #if defined( __CL_SHORT4__)
658 /* cl_short3 is identical in size, alignment and behavior to cl_short4. See section 6.1.5. */
659 typedef cl_short4 cl_short3;
663 cl_short CL_ALIGNED(16) s[8];
664 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
665 __extension__ struct{ cl_short x, y, z, w; };
666 __extension__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7; };
667 __extension__ struct{ cl_short4 lo, hi; };
669 #if defined( __CL_SHORT2__)
672 #if defined( __CL_SHORT4__)
675 #if defined( __CL_SHORT8__ )
682 cl_short CL_ALIGNED(32) s[16];
683 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
684 __extension__ struct{ cl_short x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
685 __extension__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
686 __extension__ struct{ cl_short8 lo, hi; };
688 #if defined( __CL_SHORT2__)
691 #if defined( __CL_SHORT4__)
694 #if defined( __CL_SHORT8__ )
697 #if defined( __CL_SHORT16__ )
703 /* ---- cl_ushortn ---- */
706 cl_ushort CL_ALIGNED(4) s[2];
707 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
708 __extension__ struct{ cl_ushort x, y; };
709 __extension__ struct{ cl_ushort s0, s1; };
710 __extension__ struct{ cl_ushort lo, hi; };
712 #if defined( __CL_USHORT2__)
719 cl_ushort CL_ALIGNED(8) s[4];
720 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
721 __extension__ struct{ cl_ushort x, y, z, w; };
722 __extension__ struct{ cl_ushort s0, s1, s2, s3; };
723 __extension__ struct{ cl_ushort2 lo, hi; };
725 #if defined( __CL_USHORT2__)
728 #if defined( __CL_USHORT4__)
733 /* cl_ushort3 is identical in size, alignment and behavior to cl_ushort4. See section 6.1.5. */
734 typedef cl_ushort4 cl_ushort3;
738 cl_ushort CL_ALIGNED(16) s[8];
739 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
740 __extension__ struct{ cl_ushort x, y, z, w; };
741 __extension__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7; };
742 __extension__ struct{ cl_ushort4 lo, hi; };
744 #if defined( __CL_USHORT2__)
747 #if defined( __CL_USHORT4__)
750 #if defined( __CL_USHORT8__ )
757 cl_ushort CL_ALIGNED(32) s[16];
758 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
759 __extension__ struct{ cl_ushort x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
760 __extension__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
761 __extension__ struct{ cl_ushort8 lo, hi; };
763 #if defined( __CL_USHORT2__)
766 #if defined( __CL_USHORT4__)
769 #if defined( __CL_USHORT8__ )
772 #if defined( __CL_USHORT16__ )
777 /* ---- cl_intn ---- */
780 cl_int CL_ALIGNED(8) s[2];
781 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
782 __extension__ struct{ cl_int x, y; };
783 __extension__ struct{ cl_int s0, s1; };
784 __extension__ struct{ cl_int lo, hi; };
786 #if defined( __CL_INT2__)
793 cl_int CL_ALIGNED(16) s[4];
794 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
795 __extension__ struct{ cl_int x, y, z, w; };
796 __extension__ struct{ cl_int s0, s1, s2, s3; };
797 __extension__ struct{ cl_int2 lo, hi; };
799 #if defined( __CL_INT2__)
802 #if defined( __CL_INT4__)
807 /* cl_int3 is identical in size, alignment and behavior to cl_int4. See section 6.1.5. */
808 typedef cl_int4 cl_int3;
812 cl_int CL_ALIGNED(32) s[8];
813 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
814 __extension__ struct{ cl_int x, y, z, w; };
815 __extension__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7; };
816 __extension__ struct{ cl_int4 lo, hi; };
818 #if defined( __CL_INT2__)
821 #if defined( __CL_INT4__)
824 #if defined( __CL_INT8__ )
831 cl_int CL_ALIGNED(64) s[16];
832 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
833 __extension__ struct{ cl_int x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
834 __extension__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
835 __extension__ struct{ cl_int8 lo, hi; };
837 #if defined( __CL_INT2__)
840 #if defined( __CL_INT4__)
843 #if defined( __CL_INT8__ )
846 #if defined( __CL_INT16__ )
852 /* ---- cl_uintn ---- */
855 cl_uint CL_ALIGNED(8) s[2];
856 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
857 __extension__ struct{ cl_uint x, y; };
858 __extension__ struct{ cl_uint s0, s1; };
859 __extension__ struct{ cl_uint lo, hi; };
861 #if defined( __CL_UINT2__)
868 cl_uint CL_ALIGNED(16) s[4];
869 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
870 __extension__ struct{ cl_uint x, y, z, w; };
871 __extension__ struct{ cl_uint s0, s1, s2, s3; };
872 __extension__ struct{ cl_uint2 lo, hi; };
874 #if defined( __CL_UINT2__)
877 #if defined( __CL_UINT4__)
882 /* cl_uint3 is identical in size, alignment and behavior to cl_uint4. See section 6.1.5. */
883 typedef cl_uint4 cl_uint3;
887 cl_uint CL_ALIGNED(32) s[8];
888 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
889 __extension__ struct{ cl_uint x, y, z, w; };
890 __extension__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7; };
891 __extension__ struct{ cl_uint4 lo, hi; };
893 #if defined( __CL_UINT2__)
896 #if defined( __CL_UINT4__)
899 #if defined( __CL_UINT8__ )
906 cl_uint CL_ALIGNED(64) s[16];
907 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
908 __extension__ struct{ cl_uint x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
909 __extension__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
910 __extension__ struct{ cl_uint8 lo, hi; };
912 #if defined( __CL_UINT2__)
915 #if defined( __CL_UINT4__)
918 #if defined( __CL_UINT8__ )
921 #if defined( __CL_UINT16__ )
926 /* ---- cl_longn ---- */
929 cl_long CL_ALIGNED(16) s[2];
930 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
931 __extension__ struct{ cl_long x, y; };
932 __extension__ struct{ cl_long s0, s1; };
933 __extension__ struct{ cl_long lo, hi; };
935 #if defined( __CL_LONG2__)
942 cl_long CL_ALIGNED(32) s[4];
943 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
944 __extension__ struct{ cl_long x, y, z, w; };
945 __extension__ struct{ cl_long s0, s1, s2, s3; };
946 __extension__ struct{ cl_long2 lo, hi; };
948 #if defined( __CL_LONG2__)
951 #if defined( __CL_LONG4__)
956 /* cl_long3 is identical in size, alignment and behavior to cl_long4. See section 6.1.5. */
957 typedef cl_long4 cl_long3;
961 cl_long CL_ALIGNED(64) s[8];
962 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
963 __extension__ struct{ cl_long x, y, z, w; };
964 __extension__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7; };
965 __extension__ struct{ cl_long4 lo, hi; };
967 #if defined( __CL_LONG2__)
970 #if defined( __CL_LONG4__)
973 #if defined( __CL_LONG8__ )
980 cl_long CL_ALIGNED(128) s[16];
981 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
982 __extension__ struct{ cl_long x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
983 __extension__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
984 __extension__ struct{ cl_long8 lo, hi; };
986 #if defined( __CL_LONG2__)
989 #if defined( __CL_LONG4__)
992 #if defined( __CL_LONG8__ )
995 #if defined( __CL_LONG16__ )
1001 /* ---- cl_ulongn ---- */
1004 cl_ulong CL_ALIGNED(16) s[2];
1005 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1006 __extension__ struct{ cl_ulong x, y; };
1007 __extension__ struct{ cl_ulong s0, s1; };
1008 __extension__ struct{ cl_ulong lo, hi; };
1010 #if defined( __CL_ULONG2__)
1017 cl_ulong CL_ALIGNED(32) s[4];
1018 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1019 __extension__ struct{ cl_ulong x, y, z, w; };
1020 __extension__ struct{ cl_ulong s0, s1, s2, s3; };
1021 __extension__ struct{ cl_ulong2 lo, hi; };
1023 #if defined( __CL_ULONG2__)
1026 #if defined( __CL_ULONG4__)
1031 /* cl_ulong3 is identical in size, alignment and behavior to cl_ulong4. See section 6.1.5. */
1032 typedef cl_ulong4 cl_ulong3;
1036 cl_ulong CL_ALIGNED(64) s[8];
1037 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1038 __extension__ struct{ cl_ulong x, y, z, w; };
1039 __extension__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7; };
1040 __extension__ struct{ cl_ulong4 lo, hi; };
1042 #if defined( __CL_ULONG2__)
1045 #if defined( __CL_ULONG4__)
1048 #if defined( __CL_ULONG8__ )
1055 cl_ulong CL_ALIGNED(128) s[16];
1056 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1057 __extension__ struct{ cl_ulong x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1058 __extension__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1059 __extension__ struct{ cl_ulong8 lo, hi; };
1061 #if defined( __CL_ULONG2__)
1064 #if defined( __CL_ULONG4__)
1067 #if defined( __CL_ULONG8__ )
1070 #if defined( __CL_ULONG16__ )
1076 /* --- cl_floatn ---- */
1080 cl_float CL_ALIGNED(8) s[2];
1081 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1082 __extension__ struct{ cl_float x, y; };
1083 __extension__ struct{ cl_float s0, s1; };
1084 __extension__ struct{ cl_float lo, hi; };
1086 #if defined( __CL_FLOAT2__)
1093 cl_float CL_ALIGNED(16) s[4];
1094 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1095 __extension__ struct{ cl_float x, y, z, w; };
1096 __extension__ struct{ cl_float s0, s1, s2, s3; };
1097 __extension__ struct{ cl_float2 lo, hi; };
1099 #if defined( __CL_FLOAT2__)
1102 #if defined( __CL_FLOAT4__)
1107 /* cl_float3 is identical in size, alignment and behavior to cl_float4. See section 6.1.5. */
1108 typedef cl_float4 cl_float3;
1112 cl_float CL_ALIGNED(32) s[8];
1113 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1114 __extension__ struct{ cl_float x, y, z, w; };
1115 __extension__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7; };
1116 __extension__ struct{ cl_float4 lo, hi; };
1118 #if defined( __CL_FLOAT2__)
1121 #if defined( __CL_FLOAT4__)
1124 #if defined( __CL_FLOAT8__ )
1131 cl_float CL_ALIGNED(64) s[16];
1132 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1133 __extension__ struct{ cl_float x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1134 __extension__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1135 __extension__ struct{ cl_float8 lo, hi; };
1137 #if defined( __CL_FLOAT2__)
1140 #if defined( __CL_FLOAT4__)
1143 #if defined( __CL_FLOAT8__ )
1146 #if defined( __CL_FLOAT16__ )
1151 /* --- cl_doublen ---- */
1155 cl_double CL_ALIGNED(16) s[2];
1156 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1157 __extension__ struct{ cl_double x, y; };
1158 __extension__ struct{ cl_double s0, s1; };
1159 __extension__ struct{ cl_double lo, hi; };
1161 #if defined( __CL_DOUBLE2__)
1168 cl_double CL_ALIGNED(32) s[4];
1169 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1170 __extension__ struct{ cl_double x, y, z, w; };
1171 __extension__ struct{ cl_double s0, s1, s2, s3; };
1172 __extension__ struct{ cl_double2 lo, hi; };
1174 #if defined( __CL_DOUBLE2__)
1177 #if defined( __CL_DOUBLE4__)
1182 /* cl_double3 is identical in size, alignment and behavior to cl_double4. See section 6.1.5. */
1183 typedef cl_double4 cl_double3;
1187 cl_double CL_ALIGNED(64) s[8];
1188 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1189 __extension__ struct{ cl_double x, y, z, w; };
1190 __extension__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7; };
1191 __extension__ struct{ cl_double4 lo, hi; };
1193 #if defined( __CL_DOUBLE2__)
1196 #if defined( __CL_DOUBLE4__)
1199 #if defined( __CL_DOUBLE8__ )
1206 cl_double CL_ALIGNED(128) s[16];
1207 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1208 __extension__ struct{ cl_double x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1209 __extension__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1210 __extension__ struct{ cl_double8 lo, hi; };
1212 #if defined( __CL_DOUBLE2__)
1215 #if defined( __CL_DOUBLE4__)
1218 #if defined( __CL_DOUBLE8__ )
1221 #if defined( __CL_DOUBLE16__ )
1226 /* Macro to facilitate debugging
1228 * Place CL_PROGRAM_STRING_DEBUG_INFO on the line before the first line of your source.
1229 * The first line ends with: CL_PROGRAM_STRING_DEBUG_INFO \"
1230 * Each line thereafter of OpenCL C source must end with: \n\
1231 * The last line ends in ";
1235 * const char *my_program = CL_PROGRAM_STRING_DEBUG_INFO "\
1236 * kernel void foo( int a, float * b ) \n\
1239 * *b[ get_global_id(0)] = a; \n\
1243 * This should correctly set up the line, (column) and file information for your source
1244 * string so you can do source level debugging.
1246 #define __CL_STRINGIFY( _x ) # _x
1247 #define _CL_STRINGIFY( _x ) __CL_STRINGIFY( _x )
1248 #define CL_PROGRAM_STRING_DEBUG_INFO "#line " _CL_STRINGIFY(__LINE__) " \"" __FILE__ "\" \n\n"
1254 #endif /* __CL_PLATFORM_H */