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 #ifndef UNAVAILABLE_ATTRIBUTE
51 #define UNAVAILABLE_ATTRIBUTE
53 #ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
54 #define CL_API_SUFFIX__VERSION_1_0 AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
55 #define CL_EXT_SUFFIX__VERSION_1_0 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
57 #define CL_API_SUFFIX__VERSION_1_0 UNAVAILABLE_ATTRIBUTE
58 #define CL_EXT_SUFFIX__VERSION_1_0 CL_EXTENSION_WEAK_LINK UNAVAILABLE_ATTRIBUTE
60 #ifdef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
61 #define CL_API_SUFFIX__VERSION_1_1 AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
62 #define GCL_API_SUFFIX__VERSION_1_1 AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
63 #define CL_EXT_SUFFIX__VERSION_1_1 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
64 #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
66 #define CL_API_SUFFIX__VERSION_1_1 UNAVAILABLE_ATTRIBUTE
67 #define GCL_API_SUFFIX__VERSION_1_1 UNAVAILABLE_ATTRIBUTE
68 #define CL_EXT_SUFFIX__VERSION_1_1 CL_EXTENSION_WEAK_LINK UNAVAILABLE_ATTRIBUTE
69 #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATE CL_EXT_SUFFIX__VERSION_1_0
71 #ifdef AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
72 #define CL_API_SUFFIX__VERSION_1_2 AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
73 #define GCL_API_SUFFIX__VERSION_1_2 AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
74 #define CL_EXT_SUFFIX__VERSION_1_2 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
75 #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
76 #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
78 #define CL_API_SUFFIX__VERSION_1_2 UNAVAILABLE_ATTRIBUTE
79 #define GCL_API_SUFFIX__VERSION_1_2 UNAVAILABLE_ATTRIBUTE
80 #define CL_EXT_SUFFIX__VERSION_1_2 CL_EXTENSION_WEAK_LINK UNAVAILABLE_ATTRIBUTE
81 #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
82 #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED CL_EXT_SUFFIX__VERSION_1_1
85 #define CL_EXTENSION_WEAK_LINK
86 #define CL_API_SUFFIX__VERSION_1_0
87 #define CL_EXT_SUFFIX__VERSION_1_0
88 #define CL_API_SUFFIX__VERSION_1_1
89 #define CL_EXT_SUFFIX__VERSION_1_1
90 #define CL_API_SUFFIX__VERSION_1_2
91 #define CL_EXT_SUFFIX__VERSION_1_2
94 #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
95 #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
96 #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
98 #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED __attribute__((deprecated))
99 #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
102 #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
103 #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
104 #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
106 #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED __attribute__((deprecated))
107 #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
110 #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
111 #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
112 #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
114 #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
115 #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED __declspec(deprecated)
118 #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
119 #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
120 #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
122 #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
123 #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED __declspec(deprecated)
126 #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
127 #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
129 #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
130 #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
134 #if (defined (_WIN32) && defined(_MSC_VER))
137 typedef signed __int8 cl_char;
138 typedef unsigned __int8 cl_uchar;
139 typedef signed __int16 cl_short;
140 typedef unsigned __int16 cl_ushort;
141 typedef signed __int32 cl_int;
142 typedef unsigned __int32 cl_uint;
143 typedef signed __int64 cl_long;
144 typedef unsigned __int64 cl_ulong;
146 typedef unsigned __int16 cl_half;
147 typedef float cl_float;
148 typedef double cl_double;
150 /* Macro names and corresponding values defined by OpenCL */
151 #define CL_CHAR_BIT 8
152 #define CL_SCHAR_MAX 127
153 #define CL_SCHAR_MIN (-127-1)
154 #define CL_CHAR_MAX CL_SCHAR_MAX
155 #define CL_CHAR_MIN CL_SCHAR_MIN
156 #define CL_UCHAR_MAX 255
157 #define CL_SHRT_MAX 32767
158 #define CL_SHRT_MIN (-32767-1)
159 #define CL_USHRT_MAX 65535
160 #define CL_INT_MAX 2147483647
161 #define CL_INT_MIN (-2147483647-1)
162 #define CL_UINT_MAX 0xffffffffU
163 #define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
164 #define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
165 #define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
168 #define CL_FLT_MANT_DIG 24
169 #define CL_FLT_MAX_10_EXP +38
170 #define CL_FLT_MAX_EXP +128
171 #define CL_FLT_MIN_10_EXP -37
172 #define CL_FLT_MIN_EXP -125
173 #define CL_FLT_RADIX 2
174 #define CL_FLT_MAX 340282346638528859811704183484516925440.0f
175 #define CL_FLT_MIN 1.175494350822287507969e-38f
176 #define CL_FLT_EPSILON 0x1.0p-23f
178 #define CL_DBL_DIG 15
179 #define CL_DBL_MANT_DIG 53
180 #define CL_DBL_MAX_10_EXP +308
181 #define CL_DBL_MAX_EXP +1024
182 #define CL_DBL_MIN_10_EXP -307
183 #define CL_DBL_MIN_EXP -1021
184 #define CL_DBL_RADIX 2
185 #define CL_DBL_MAX 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
186 #define CL_DBL_MIN 2.225073858507201383090e-308
187 #define CL_DBL_EPSILON 2.220446049250313080847e-16
189 #define CL_M_E 2.718281828459045090796
190 #define CL_M_LOG2E 1.442695040888963387005
191 #define CL_M_LOG10E 0.434294481903251816668
192 #define CL_M_LN2 0.693147180559945286227
193 #define CL_M_LN10 2.302585092994045901094
194 #define CL_M_PI 3.141592653589793115998
195 #define CL_M_PI_2 1.570796326794896557999
196 #define CL_M_PI_4 0.785398163397448278999
197 #define CL_M_1_PI 0.318309886183790691216
198 #define CL_M_2_PI 0.636619772367581382433
199 #define CL_M_2_SQRTPI 1.128379167095512558561
200 #define CL_M_SQRT2 1.414213562373095145475
201 #define CL_M_SQRT1_2 0.707106781186547572737
203 #define CL_M_E_F 2.71828174591064f
204 #define CL_M_LOG2E_F 1.44269502162933f
205 #define CL_M_LOG10E_F 0.43429449200630f
206 #define CL_M_LN2_F 0.69314718246460f
207 #define CL_M_LN10_F 2.30258512496948f
208 #define CL_M_PI_F 3.14159274101257f
209 #define CL_M_PI_2_F 1.57079637050629f
210 #define CL_M_PI_4_F 0.78539818525314f
211 #define CL_M_1_PI_F 0.31830987334251f
212 #define CL_M_2_PI_F 0.63661974668503f
213 #define CL_M_2_SQRTPI_F 1.12837922573090f
214 #define CL_M_SQRT2_F 1.41421353816986f
215 #define CL_M_SQRT1_2_F 0.70710676908493f
217 #define CL_NAN (CL_INFINITY - CL_INFINITY)
218 #define CL_HUGE_VALF ((cl_float) 1e50)
219 #define CL_HUGE_VAL ((cl_double) 1e500)
220 #define CL_MAXFLOAT CL_FLT_MAX
221 #define CL_INFINITY CL_HUGE_VALF
228 typedef int8_t cl_char;
229 typedef uint8_t cl_uchar;
230 typedef int16_t cl_short __attribute__((aligned(2)));
231 typedef uint16_t cl_ushort __attribute__((aligned(2)));
232 typedef int32_t cl_int __attribute__((aligned(4)));
233 typedef uint32_t cl_uint __attribute__((aligned(4)));
234 typedef int64_t cl_long __attribute__((aligned(8)));
235 typedef uint64_t cl_ulong __attribute__((aligned(8)));
237 typedef uint16_t cl_half __attribute__((aligned(2)));
238 typedef float cl_float __attribute__((aligned(4)));
239 typedef double cl_double __attribute__((aligned(8)));
241 /* Macro names and corresponding values defined by OpenCL */
242 #define CL_CHAR_BIT 8
243 #define CL_SCHAR_MAX 127
244 #define CL_SCHAR_MIN (-127-1)
245 #define CL_CHAR_MAX CL_SCHAR_MAX
246 #define CL_CHAR_MIN CL_SCHAR_MIN
247 #define CL_UCHAR_MAX 255
248 #define CL_SHRT_MAX 32767
249 #define CL_SHRT_MIN (-32767-1)
250 #define CL_USHRT_MAX 65535
251 #define CL_INT_MAX 2147483647
252 #define CL_INT_MIN (-2147483647-1)
253 #define CL_UINT_MAX 0xffffffffU
254 #define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
255 #define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
256 #define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
259 #define CL_FLT_MANT_DIG 24
260 #define CL_FLT_MAX_10_EXP +38
261 #define CL_FLT_MAX_EXP +128
262 #define CL_FLT_MIN_10_EXP -37
263 #define CL_FLT_MIN_EXP -125
264 #define CL_FLT_RADIX 2
265 #define CL_FLT_MAX 0x1.fffffep127f
266 #define CL_FLT_MIN 0x1.0p-126f
267 #define CL_FLT_EPSILON 0x1.0p-23f
269 #define CL_DBL_DIG 15
270 #define CL_DBL_MANT_DIG 53
271 #define CL_DBL_MAX_10_EXP +308
272 #define CL_DBL_MAX_EXP +1024
273 #define CL_DBL_MIN_10_EXP -307
274 #define CL_DBL_MIN_EXP -1021
275 #define CL_DBL_RADIX 2
276 #define CL_DBL_MAX 0x1.fffffffffffffp1023
277 #define CL_DBL_MIN 0x1.0p-1022
278 #define CL_DBL_EPSILON 0x1.0p-52
280 #define CL_M_E 2.718281828459045090796
281 #define CL_M_LOG2E 1.442695040888963387005
282 #define CL_M_LOG10E 0.434294481903251816668
283 #define CL_M_LN2 0.693147180559945286227
284 #define CL_M_LN10 2.302585092994045901094
285 #define CL_M_PI 3.141592653589793115998
286 #define CL_M_PI_2 1.570796326794896557999
287 #define CL_M_PI_4 0.785398163397448278999
288 #define CL_M_1_PI 0.318309886183790691216
289 #define CL_M_2_PI 0.636619772367581382433
290 #define CL_M_2_SQRTPI 1.128379167095512558561
291 #define CL_M_SQRT2 1.414213562373095145475
292 #define CL_M_SQRT1_2 0.707106781186547572737
294 #define CL_M_E_F 2.71828174591064f
295 #define CL_M_LOG2E_F 1.44269502162933f
296 #define CL_M_LOG10E_F 0.43429449200630f
297 #define CL_M_LN2_F 0.69314718246460f
298 #define CL_M_LN10_F 2.30258512496948f
299 #define CL_M_PI_F 3.14159274101257f
300 #define CL_M_PI_2_F 1.57079637050629f
301 #define CL_M_PI_4_F 0.78539818525314f
302 #define CL_M_1_PI_F 0.31830987334251f
303 #define CL_M_2_PI_F 0.63661974668503f
304 #define CL_M_2_SQRTPI_F 1.12837922573090f
305 #define CL_M_SQRT2_F 1.41421353816986f
306 #define CL_M_SQRT1_2_F 0.70710676908493f
308 #if defined( __GNUC__ )
309 #define CL_HUGE_VALF __builtin_huge_valf()
310 #define CL_HUGE_VAL __builtin_huge_val()
311 #define CL_NAN __builtin_nanf( "" )
313 #define CL_HUGE_VALF ((cl_float) 1e50)
314 #define CL_HUGE_VAL ((cl_double) 1e500)
315 float nanf( const char * );
316 #define CL_NAN nanf( "" )
318 #define CL_MAXFLOAT CL_FLT_MAX
319 #define CL_INFINITY CL_HUGE_VALF
325 /* 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. */
326 typedef unsigned int cl_GLuint;
327 typedef int cl_GLint;
328 typedef unsigned int cl_GLenum;
333 * Note: OpenCL requires that all types be naturally aligned.
334 * This means that vector types must be naturally aligned.
335 * For example, a vector of four floats must be aligned to
336 * a 16 byte boundary (calculated as 4 * the natural 4-byte
337 * alignment of the float). The alignment qualifiers here
338 * will only function properly if your compiler supports them
339 * and if you don't actively work to defeat them. For example,
340 * in order for a cl_float4 to be 16 byte aligned in a struct,
341 * the start of the struct must itself be 16-byte aligned.
343 * Maintaining proper alignment is the user's responsibility.
346 /* Define basic vector types */
347 #if defined( __VEC__ )
348 #include <altivec.h> /* may be omitted depending on compiler. AltiVec spec provides no way to detect whether the header is required. */
349 typedef vector unsigned char __cl_uchar16;
350 typedef vector signed char __cl_char16;
351 typedef vector unsigned short __cl_ushort8;
352 typedef vector signed short __cl_short8;
353 typedef vector unsigned int __cl_uint4;
354 typedef vector signed int __cl_int4;
355 typedef vector float __cl_float4;
356 #define __CL_UCHAR16__ 1
357 #define __CL_CHAR16__ 1
358 #define __CL_USHORT8__ 1
359 #define __CL_SHORT8__ 1
360 #define __CL_UINT4__ 1
361 #define __CL_INT4__ 1
362 #define __CL_FLOAT4__ 1
365 #if defined( __SSE__ )
366 #if defined( __MINGW64__ )
369 #include <xmmintrin.h>
371 #if defined( __GNUC__ )
372 typedef float __cl_float4 __attribute__((vector_size(16)));
374 typedef __m128 __cl_float4;
376 #define __CL_FLOAT4__ 1
379 #if defined( __SSE2__ )
380 #if defined( __MINGW64__ )
383 #include <emmintrin.h>
385 #if defined( __GNUC__ )
386 typedef cl_uchar __cl_uchar16 __attribute__((vector_size(16)));
387 typedef cl_char __cl_char16 __attribute__((vector_size(16)));
388 typedef cl_ushort __cl_ushort8 __attribute__((vector_size(16)));
389 typedef cl_short __cl_short8 __attribute__((vector_size(16)));
390 typedef cl_uint __cl_uint4 __attribute__((vector_size(16)));
391 typedef cl_int __cl_int4 __attribute__((vector_size(16)));
392 typedef cl_ulong __cl_ulong2 __attribute__((vector_size(16)));
393 typedef cl_long __cl_long2 __attribute__((vector_size(16)));
394 typedef cl_double __cl_double2 __attribute__((vector_size(16)));
396 typedef __m128i __cl_uchar16;
397 typedef __m128i __cl_char16;
398 typedef __m128i __cl_ushort8;
399 typedef __m128i __cl_short8;
400 typedef __m128i __cl_uint4;
401 typedef __m128i __cl_int4;
402 typedef __m128i __cl_ulong2;
403 typedef __m128i __cl_long2;
404 typedef __m128d __cl_double2;
406 #define __CL_UCHAR16__ 1
407 #define __CL_CHAR16__ 1
408 #define __CL_USHORT8__ 1
409 #define __CL_SHORT8__ 1
410 #define __CL_INT4__ 1
411 #define __CL_UINT4__ 1
412 #define __CL_ULONG2__ 1
413 #define __CL_LONG2__ 1
414 #define __CL_DOUBLE2__ 1
417 #if defined( __MMX__ )
418 #include <mmintrin.h>
419 #if defined( __GNUC__ )
420 typedef cl_uchar __cl_uchar8 __attribute__((vector_size(8)));
421 typedef cl_char __cl_char8 __attribute__((vector_size(8)));
422 typedef cl_ushort __cl_ushort4 __attribute__((vector_size(8)));
423 typedef cl_short __cl_short4 __attribute__((vector_size(8)));
424 typedef cl_uint __cl_uint2 __attribute__((vector_size(8)));
425 typedef cl_int __cl_int2 __attribute__((vector_size(8)));
426 typedef cl_ulong __cl_ulong1 __attribute__((vector_size(8)));
427 typedef cl_long __cl_long1 __attribute__((vector_size(8)));
428 typedef cl_float __cl_float2 __attribute__((vector_size(8)));
430 typedef __m64 __cl_uchar8;
431 typedef __m64 __cl_char8;
432 typedef __m64 __cl_ushort4;
433 typedef __m64 __cl_short4;
434 typedef __m64 __cl_uint2;
435 typedef __m64 __cl_int2;
436 typedef __m64 __cl_ulong1;
437 typedef __m64 __cl_long1;
438 typedef __m64 __cl_float2;
440 #define __CL_UCHAR8__ 1
441 #define __CL_CHAR8__ 1
442 #define __CL_USHORT4__ 1
443 #define __CL_SHORT4__ 1
444 #define __CL_INT2__ 1
445 #define __CL_UINT2__ 1
446 #define __CL_ULONG1__ 1
447 #define __CL_LONG1__ 1
448 #define __CL_FLOAT2__ 1
451 #if defined( __AVX__ )
452 #if defined( __MINGW64__ )
455 #include <immintrin.h>
457 #if defined( __GNUC__ )
458 typedef cl_float __cl_float8 __attribute__((vector_size(32)));
459 typedef cl_double __cl_double4 __attribute__((vector_size(32)));
461 typedef __m256 __cl_float8;
462 typedef __m256d __cl_double4;
464 #define __CL_FLOAT8__ 1
465 #define __CL_DOUBLE4__ 1
468 /* Define alignment keys */
469 #if defined( __GNUC__ )
470 #define CL_ALIGNED(_x) __attribute__ ((aligned(_x)))
471 #elif defined( _WIN32) && (_MSC_VER)
472 /* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements */
473 /* http://msdn.microsoft.com/en-us/library/373ak2y1%28VS.71%29.aspx */
474 /* #include <crtdefs.h> */
475 /* #define CL_ALIGNED(_x) _CRT_ALIGN(_x) */
476 #define CL_ALIGNED(_x)
478 #warning Need to implement some method to align data here
479 #define CL_ALIGNED(_x)
482 /* Indicate whether .xyzw, .s0123 and .hi.lo are supported */
483 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
484 /* .xyzw and .s0123...{f|F} are supported */
485 #define CL_HAS_NAMED_VECTOR_FIELDS 1
486 /* .hi and .lo are supported */
487 #define CL_HAS_HI_LO_VECTOR_FIELDS 1
490 /* Define cl_vector types */
492 /* ---- cl_charn ---- */
495 cl_char CL_ALIGNED(2) s[2];
496 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
497 __extension__ struct{ cl_char x, y; };
498 __extension__ struct{ cl_char s0, s1; };
499 __extension__ struct{ cl_char lo, hi; };
501 #if defined( __CL_CHAR2__)
508 cl_char CL_ALIGNED(4) s[4];
509 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
510 __extension__ struct{ cl_char x, y, z, w; };
511 __extension__ struct{ cl_char s0, s1, s2, s3; };
512 __extension__ struct{ cl_char2 lo, hi; };
514 #if defined( __CL_CHAR2__)
517 #if defined( __CL_CHAR4__)
522 /* cl_char3 is identical in size, alignment and behavior to cl_char4. See section 6.1.5. */
523 typedef cl_char4 cl_char3;
527 cl_char CL_ALIGNED(8) s[8];
528 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
529 __extension__ struct{ cl_char x, y, z, w; };
530 __extension__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7; };
531 __extension__ struct{ cl_char4 lo, hi; };
533 #if defined( __CL_CHAR2__)
536 #if defined( __CL_CHAR4__)
539 #if defined( __CL_CHAR8__ )
546 cl_char CL_ALIGNED(16) s[16];
547 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
548 __extension__ struct{ cl_char x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
549 __extension__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
550 __extension__ struct{ cl_char8 lo, hi; };
552 #if defined( __CL_CHAR2__)
555 #if defined( __CL_CHAR4__)
558 #if defined( __CL_CHAR8__ )
561 #if defined( __CL_CHAR16__ )
567 /* ---- cl_ucharn ---- */
570 cl_uchar CL_ALIGNED(2) s[2];
571 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
572 __extension__ struct{ cl_uchar x, y; };
573 __extension__ struct{ cl_uchar s0, s1; };
574 __extension__ struct{ cl_uchar lo, hi; };
576 #if defined( __cl_uchar2__)
583 cl_uchar CL_ALIGNED(4) s[4];
584 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
585 __extension__ struct{ cl_uchar x, y, z, w; };
586 __extension__ struct{ cl_uchar s0, s1, s2, s3; };
587 __extension__ struct{ cl_uchar2 lo, hi; };
589 #if defined( __CL_UCHAR2__)
592 #if defined( __CL_UCHAR4__)
597 /* cl_uchar3 is identical in size, alignment and behavior to cl_uchar4. See section 6.1.5. */
598 typedef cl_uchar4 cl_uchar3;
602 cl_uchar CL_ALIGNED(8) s[8];
603 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
604 __extension__ struct{ cl_uchar x, y, z, w; };
605 __extension__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7; };
606 __extension__ struct{ cl_uchar4 lo, hi; };
608 #if defined( __CL_UCHAR2__)
611 #if defined( __CL_UCHAR4__)
614 #if defined( __CL_UCHAR8__ )
621 cl_uchar CL_ALIGNED(16) s[16];
622 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
623 __extension__ struct{ cl_uchar x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
624 __extension__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
625 __extension__ struct{ cl_uchar8 lo, hi; };
627 #if defined( __CL_UCHAR2__)
630 #if defined( __CL_UCHAR4__)
633 #if defined( __CL_UCHAR8__ )
636 #if defined( __CL_UCHAR16__ )
642 /* ---- cl_shortn ---- */
645 cl_short CL_ALIGNED(4) s[2];
646 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
647 __extension__ struct{ cl_short x, y; };
648 __extension__ struct{ cl_short s0, s1; };
649 __extension__ struct{ cl_short lo, hi; };
651 #if defined( __CL_SHORT2__)
658 cl_short CL_ALIGNED(8) s[4];
659 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
660 __extension__ struct{ cl_short x, y, z, w; };
661 __extension__ struct{ cl_short s0, s1, s2, s3; };
662 __extension__ struct{ cl_short2 lo, hi; };
664 #if defined( __CL_SHORT2__)
667 #if defined( __CL_SHORT4__)
672 /* cl_short3 is identical in size, alignment and behavior to cl_short4. See section 6.1.5. */
673 typedef cl_short4 cl_short3;
677 cl_short CL_ALIGNED(16) s[8];
678 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
679 __extension__ struct{ cl_short x, y, z, w; };
680 __extension__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7; };
681 __extension__ struct{ cl_short4 lo, hi; };
683 #if defined( __CL_SHORT2__)
686 #if defined( __CL_SHORT4__)
689 #if defined( __CL_SHORT8__ )
696 cl_short CL_ALIGNED(32) s[16];
697 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
698 __extension__ struct{ cl_short x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
699 __extension__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
700 __extension__ struct{ cl_short8 lo, hi; };
702 #if defined( __CL_SHORT2__)
705 #if defined( __CL_SHORT4__)
708 #if defined( __CL_SHORT8__ )
711 #if defined( __CL_SHORT16__ )
717 /* ---- cl_ushortn ---- */
720 cl_ushort CL_ALIGNED(4) s[2];
721 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
722 __extension__ struct{ cl_ushort x, y; };
723 __extension__ struct{ cl_ushort s0, s1; };
724 __extension__ struct{ cl_ushort lo, hi; };
726 #if defined( __CL_USHORT2__)
733 cl_ushort CL_ALIGNED(8) s[4];
734 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
735 __extension__ struct{ cl_ushort x, y, z, w; };
736 __extension__ struct{ cl_ushort s0, s1, s2, s3; };
737 __extension__ struct{ cl_ushort2 lo, hi; };
739 #if defined( __CL_USHORT2__)
742 #if defined( __CL_USHORT4__)
747 /* cl_ushort3 is identical in size, alignment and behavior to cl_ushort4. See section 6.1.5. */
748 typedef cl_ushort4 cl_ushort3;
752 cl_ushort CL_ALIGNED(16) s[8];
753 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
754 __extension__ struct{ cl_ushort x, y, z, w; };
755 __extension__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7; };
756 __extension__ struct{ cl_ushort4 lo, hi; };
758 #if defined( __CL_USHORT2__)
761 #if defined( __CL_USHORT4__)
764 #if defined( __CL_USHORT8__ )
771 cl_ushort CL_ALIGNED(32) s[16];
772 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
773 __extension__ struct{ cl_ushort x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
774 __extension__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
775 __extension__ struct{ cl_ushort8 lo, hi; };
777 #if defined( __CL_USHORT2__)
780 #if defined( __CL_USHORT4__)
783 #if defined( __CL_USHORT8__ )
786 #if defined( __CL_USHORT16__ )
791 /* ---- cl_intn ---- */
794 cl_int CL_ALIGNED(8) s[2];
795 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
796 __extension__ struct{ cl_int x, y; };
797 __extension__ struct{ cl_int s0, s1; };
798 __extension__ struct{ cl_int lo, hi; };
800 #if defined( __CL_INT2__)
807 cl_int CL_ALIGNED(16) s[4];
808 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
809 __extension__ struct{ cl_int x, y, z, w; };
810 __extension__ struct{ cl_int s0, s1, s2, s3; };
811 __extension__ struct{ cl_int2 lo, hi; };
813 #if defined( __CL_INT2__)
816 #if defined( __CL_INT4__)
821 /* cl_int3 is identical in size, alignment and behavior to cl_int4. See section 6.1.5. */
822 typedef cl_int4 cl_int3;
826 cl_int CL_ALIGNED(32) s[8];
827 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
828 __extension__ struct{ cl_int x, y, z, w; };
829 __extension__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7; };
830 __extension__ struct{ cl_int4 lo, hi; };
832 #if defined( __CL_INT2__)
835 #if defined( __CL_INT4__)
838 #if defined( __CL_INT8__ )
845 cl_int CL_ALIGNED(64) s[16];
846 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
847 __extension__ struct{ cl_int x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
848 __extension__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
849 __extension__ struct{ cl_int8 lo, hi; };
851 #if defined( __CL_INT2__)
854 #if defined( __CL_INT4__)
857 #if defined( __CL_INT8__ )
860 #if defined( __CL_INT16__ )
866 /* ---- cl_uintn ---- */
869 cl_uint CL_ALIGNED(8) s[2];
870 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
871 __extension__ struct{ cl_uint x, y; };
872 __extension__ struct{ cl_uint s0, s1; };
873 __extension__ struct{ cl_uint lo, hi; };
875 #if defined( __CL_UINT2__)
882 cl_uint CL_ALIGNED(16) s[4];
883 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
884 __extension__ struct{ cl_uint x, y, z, w; };
885 __extension__ struct{ cl_uint s0, s1, s2, s3; };
886 __extension__ struct{ cl_uint2 lo, hi; };
888 #if defined( __CL_UINT2__)
891 #if defined( __CL_UINT4__)
896 /* cl_uint3 is identical in size, alignment and behavior to cl_uint4. See section 6.1.5. */
897 typedef cl_uint4 cl_uint3;
901 cl_uint CL_ALIGNED(32) s[8];
902 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
903 __extension__ struct{ cl_uint x, y, z, w; };
904 __extension__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7; };
905 __extension__ struct{ cl_uint4 lo, hi; };
907 #if defined( __CL_UINT2__)
910 #if defined( __CL_UINT4__)
913 #if defined( __CL_UINT8__ )
920 cl_uint CL_ALIGNED(64) s[16];
921 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
922 __extension__ struct{ cl_uint x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
923 __extension__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
924 __extension__ struct{ cl_uint8 lo, hi; };
926 #if defined( __CL_UINT2__)
929 #if defined( __CL_UINT4__)
932 #if defined( __CL_UINT8__ )
935 #if defined( __CL_UINT16__ )
940 /* ---- cl_longn ---- */
943 cl_long CL_ALIGNED(16) s[2];
944 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
945 __extension__ struct{ cl_long x, y; };
946 __extension__ struct{ cl_long s0, s1; };
947 __extension__ struct{ cl_long lo, hi; };
949 #if defined( __CL_LONG2__)
956 cl_long CL_ALIGNED(32) s[4];
957 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
958 __extension__ struct{ cl_long x, y, z, w; };
959 __extension__ struct{ cl_long s0, s1, s2, s3; };
960 __extension__ struct{ cl_long2 lo, hi; };
962 #if defined( __CL_LONG2__)
965 #if defined( __CL_LONG4__)
970 /* cl_long3 is identical in size, alignment and behavior to cl_long4. See section 6.1.5. */
971 typedef cl_long4 cl_long3;
975 cl_long CL_ALIGNED(64) s[8];
976 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
977 __extension__ struct{ cl_long x, y, z, w; };
978 __extension__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7; };
979 __extension__ struct{ cl_long4 lo, hi; };
981 #if defined( __CL_LONG2__)
984 #if defined( __CL_LONG4__)
987 #if defined( __CL_LONG8__ )
994 cl_long CL_ALIGNED(128) s[16];
995 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
996 __extension__ struct{ cl_long x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
997 __extension__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
998 __extension__ struct{ cl_long8 lo, hi; };
1000 #if defined( __CL_LONG2__)
1003 #if defined( __CL_LONG4__)
1006 #if defined( __CL_LONG8__ )
1009 #if defined( __CL_LONG16__ )
1015 /* ---- cl_ulongn ---- */
1018 cl_ulong CL_ALIGNED(16) s[2];
1019 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1020 __extension__ struct{ cl_ulong x, y; };
1021 __extension__ struct{ cl_ulong s0, s1; };
1022 __extension__ struct{ cl_ulong lo, hi; };
1024 #if defined( __CL_ULONG2__)
1031 cl_ulong CL_ALIGNED(32) s[4];
1032 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1033 __extension__ struct{ cl_ulong x, y, z, w; };
1034 __extension__ struct{ cl_ulong s0, s1, s2, s3; };
1035 __extension__ struct{ cl_ulong2 lo, hi; };
1037 #if defined( __CL_ULONG2__)
1040 #if defined( __CL_ULONG4__)
1045 /* cl_ulong3 is identical in size, alignment and behavior to cl_ulong4. See section 6.1.5. */
1046 typedef cl_ulong4 cl_ulong3;
1050 cl_ulong CL_ALIGNED(64) s[8];
1051 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1052 __extension__ struct{ cl_ulong x, y, z, w; };
1053 __extension__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7; };
1054 __extension__ struct{ cl_ulong4 lo, hi; };
1056 #if defined( __CL_ULONG2__)
1059 #if defined( __CL_ULONG4__)
1062 #if defined( __CL_ULONG8__ )
1069 cl_ulong CL_ALIGNED(128) s[16];
1070 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1071 __extension__ struct{ cl_ulong x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1072 __extension__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1073 __extension__ struct{ cl_ulong8 lo, hi; };
1075 #if defined( __CL_ULONG2__)
1078 #if defined( __CL_ULONG4__)
1081 #if defined( __CL_ULONG8__ )
1084 #if defined( __CL_ULONG16__ )
1090 /* --- cl_floatn ---- */
1094 cl_float CL_ALIGNED(8) s[2];
1095 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1096 __extension__ struct{ cl_float x, y; };
1097 __extension__ struct{ cl_float s0, s1; };
1098 __extension__ struct{ cl_float lo, hi; };
1100 #if defined( __CL_FLOAT2__)
1107 cl_float CL_ALIGNED(16) s[4];
1108 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1109 __extension__ struct{ cl_float x, y, z, w; };
1110 __extension__ struct{ cl_float s0, s1, s2, s3; };
1111 __extension__ struct{ cl_float2 lo, hi; };
1113 #if defined( __CL_FLOAT2__)
1116 #if defined( __CL_FLOAT4__)
1121 /* cl_float3 is identical in size, alignment and behavior to cl_float4. See section 6.1.5. */
1122 typedef cl_float4 cl_float3;
1126 cl_float CL_ALIGNED(32) s[8];
1127 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1128 __extension__ struct{ cl_float x, y, z, w; };
1129 __extension__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7; };
1130 __extension__ struct{ cl_float4 lo, hi; };
1132 #if defined( __CL_FLOAT2__)
1135 #if defined( __CL_FLOAT4__)
1138 #if defined( __CL_FLOAT8__ )
1145 cl_float CL_ALIGNED(64) s[16];
1146 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1147 __extension__ struct{ cl_float x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1148 __extension__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1149 __extension__ struct{ cl_float8 lo, hi; };
1151 #if defined( __CL_FLOAT2__)
1154 #if defined( __CL_FLOAT4__)
1157 #if defined( __CL_FLOAT8__ )
1160 #if defined( __CL_FLOAT16__ )
1165 /* --- cl_doublen ---- */
1169 cl_double CL_ALIGNED(16) s[2];
1170 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1171 __extension__ struct{ cl_double x, y; };
1172 __extension__ struct{ cl_double s0, s1; };
1173 __extension__ struct{ cl_double lo, hi; };
1175 #if defined( __CL_DOUBLE2__)
1182 cl_double CL_ALIGNED(32) s[4];
1183 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1184 __extension__ struct{ cl_double x, y, z, w; };
1185 __extension__ struct{ cl_double s0, s1, s2, s3; };
1186 __extension__ struct{ cl_double2 lo, hi; };
1188 #if defined( __CL_DOUBLE2__)
1191 #if defined( __CL_DOUBLE4__)
1196 /* cl_double3 is identical in size, alignment and behavior to cl_double4. See section 6.1.5. */
1197 typedef cl_double4 cl_double3;
1201 cl_double CL_ALIGNED(64) s[8];
1202 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1203 __extension__ struct{ cl_double x, y, z, w; };
1204 __extension__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7; };
1205 __extension__ struct{ cl_double4 lo, hi; };
1207 #if defined( __CL_DOUBLE2__)
1210 #if defined( __CL_DOUBLE4__)
1213 #if defined( __CL_DOUBLE8__ )
1220 cl_double CL_ALIGNED(128) s[16];
1221 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1222 __extension__ struct{ cl_double x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1223 __extension__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1224 __extension__ struct{ cl_double8 lo, hi; };
1226 #if defined( __CL_DOUBLE2__)
1229 #if defined( __CL_DOUBLE4__)
1232 #if defined( __CL_DOUBLE8__ )
1235 #if defined( __CL_DOUBLE16__ )
1240 /* Macro to facilitate debugging
1242 * Place CL_PROGRAM_STRING_DEBUG_INFO on the line before the first line of your source.
1243 * The first line ends with: CL_PROGRAM_STRING_DEBUG_INFO \"
1244 * Each line thereafter of OpenCL C source must end with: \n\
1245 * The last line ends in ";
1249 * const char *my_program = CL_PROGRAM_STRING_DEBUG_INFO "\
1250 * kernel void foo( int a, float * b ) \n\
1253 * *b[ get_global_id(0)] = a; \n\
1257 * This should correctly set up the line, (column) and file information for your source
1258 * string so you can do source level debugging.
1260 #define __CL_STRINGIFY( _x ) # _x
1261 #define _CL_STRINGIFY( _x ) __CL_STRINGIFY( _x )
1262 #define CL_PROGRAM_STRING_DEBUG_INFO "#line " _CL_STRINGIFY(__LINE__) " \"" __FILE__ "\" \n\n"
1268 #endif /* __CL_PLATFORM_H */