1 /**********************************************************************************
2 * Copyright (c) 2008-2010 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 CL_EXTENSION_WEAK_LINK
53 #define CL_EXT_SUFFIX__VERSION_1_1 CL_EXTENSION_WEAK_LINK
54 #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
56 #define CL_EXTENSION_WEAK_LINK
57 #define CL_API_SUFFIX__VERSION_1_0
58 #define CL_EXT_SUFFIX__VERSION_1_0
59 #define CL_API_SUFFIX__VERSION_1_1
60 #define CL_EXT_SUFFIX__VERSION_1_1
61 #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
64 #if (defined (_WIN32) && defined(_MSC_VER))
67 typedef signed __int8 cl_char
;
68 typedef unsigned __int8 cl_uchar
;
69 typedef signed __int16 cl_short
;
70 typedef unsigned __int16 cl_ushort
;
71 typedef signed __int32 cl_int
;
72 typedef unsigned __int32 cl_uint
;
73 typedef signed __int64 cl_long
;
74 typedef unsigned __int64 cl_ulong
;
76 typedef unsigned __int16 cl_half
;
77 typedef float cl_float
;
78 typedef double cl_double
;
80 /* Macro names and corresponding values defined by OpenCL */
82 #define CL_SCHAR_MAX 127
83 #define CL_SCHAR_MIN (-127-1)
84 #define CL_CHAR_MAX CL_SCHAR_MAX
85 #define CL_CHAR_MIN CL_SCHAR_MIN
86 #define CL_UCHAR_MAX 255
87 #define CL_SHRT_MAX 32767
88 #define CL_SHRT_MIN (-32767-1)
89 #define CL_USHRT_MAX 65535
90 #define CL_INT_MAX 2147483647
91 #define CL_INT_MIN (-2147483647-1)
92 #define CL_UINT_MAX 0xffffffffU
93 #define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
94 #define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
95 #define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
98 #define CL_FLT_MANT_DIG 24
99 #define CL_FLT_MAX_10_EXP +38
100 #define CL_FLT_MAX_EXP +128
101 #define CL_FLT_MIN_10_EXP -37
102 #define CL_FLT_MIN_EXP -125
103 #define CL_FLT_RADIX 2
104 #define CL_FLT_MAX 340282346638528859811704183484516925440.0f
105 #define CL_FLT_MIN 1.175494350822287507969e-38f
106 #define CL_FLT_EPSILON 0x1.0p-23f
108 #define CL_DBL_DIG 15
109 #define CL_DBL_MANT_DIG 53
110 #define CL_DBL_MAX_10_EXP +308
111 #define CL_DBL_MAX_EXP +1024
112 #define CL_DBL_MIN_10_EXP -307
113 #define CL_DBL_MIN_EXP -1021
114 #define CL_DBL_RADIX 2
115 #define CL_DBL_MAX 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
116 #define CL_DBL_MIN 2.225073858507201383090e-308
117 #define CL_DBL_EPSILON 2.220446049250313080847e-16
119 #define CL_M_E 2.718281828459045090796
120 #define CL_M_LOG2E 1.442695040888963387005
121 #define CL_M_LOG10E 0.434294481903251816668
122 #define CL_M_LN2 0.693147180559945286227
123 #define CL_M_LN10 2.302585092994045901094
124 #define CL_M_PI 3.141592653589793115998
125 #define CL_M_PI_2 1.570796326794896557999
126 #define CL_M_PI_4 0.785398163397448278999
127 #define CL_M_1_PI 0.318309886183790691216
128 #define CL_M_2_PI 0.636619772367581382433
129 #define CL_M_2_SQRTPI 1.128379167095512558561
130 #define CL_M_SQRT2 1.414213562373095145475
131 #define CL_M_SQRT1_2 0.707106781186547572737
133 #define CL_M_E_F 2.71828174591064f
134 #define CL_M_LOG2E_F 1.44269502162933f
135 #define CL_M_LOG10E_F 0.43429449200630f
136 #define CL_M_LN2_F 0.69314718246460f
137 #define CL_M_LN10_F 2.30258512496948f
138 #define CL_M_PI_F 3.14159274101257f
139 #define CL_M_PI_2_F 1.57079637050629f
140 #define CL_M_PI_4_F 0.78539818525314f
141 #define CL_M_1_PI_F 0.31830987334251f
142 #define CL_M_2_PI_F 0.63661974668503f
143 #define CL_M_2_SQRTPI_F 1.12837922573090f
144 #define CL_M_SQRT2_F 1.41421353816986f
145 #define CL_M_SQRT1_2_F 0.70710676908493f
147 #define CL_NAN (CL_INFINITY - CL_INFINITY)
148 #define CL_HUGE_VALF ((cl_float) 1e50)
149 #define CL_HUGE_VAL ((cl_double) 1e500)
150 #define CL_MAXFLOAT CL_FLT_MAX
151 #define CL_INFINITY CL_HUGE_VALF
158 typedef int8_t cl_char
;
159 typedef uint8_t cl_uchar
;
160 typedef int16_t cl_short
__attribute__((aligned(2)));
161 typedef uint16_t cl_ushort
__attribute__((aligned(2)));
162 typedef int32_t cl_int
__attribute__((aligned(4)));
163 typedef uint32_t cl_uint
__attribute__((aligned(4)));
164 typedef int64_t cl_long
__attribute__((aligned(8)));
165 typedef uint64_t cl_ulong
__attribute__((aligned(8)));
167 typedef uint16_t cl_half
__attribute__((aligned(2)));
168 typedef float cl_float
__attribute__((aligned(4)));
169 typedef double cl_double
__attribute__((aligned(8)));
171 /* Macro names and corresponding values defined by OpenCL */
172 #define CL_CHAR_BIT 8
173 #define CL_SCHAR_MAX 127
174 #define CL_SCHAR_MIN (-127-1)
175 #define CL_CHAR_MAX CL_SCHAR_MAX
176 #define CL_CHAR_MIN CL_SCHAR_MIN
177 #define CL_UCHAR_MAX 255
178 #define CL_SHRT_MAX 32767
179 #define CL_SHRT_MIN (-32767-1)
180 #define CL_USHRT_MAX 65535
181 #define CL_INT_MAX 2147483647
182 #define CL_INT_MIN (-2147483647-1)
183 #define CL_UINT_MAX 0xffffffffU
184 #define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
185 #define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
186 #define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
189 #define CL_FLT_MANT_DIG 24
190 #define CL_FLT_MAX_10_EXP +38
191 #define CL_FLT_MAX_EXP +128
192 #define CL_FLT_MIN_10_EXP -37
193 #define CL_FLT_MIN_EXP -125
194 #define CL_FLT_RADIX 2
195 #define CL_FLT_MAX 0x1.fffffep127f
196 #define CL_FLT_MIN 0x1.0p-126f
197 #define CL_FLT_EPSILON 0x1.0p-23f
199 #define CL_DBL_DIG 15
200 #define CL_DBL_MANT_DIG 53
201 #define CL_DBL_MAX_10_EXP +308
202 #define CL_DBL_MAX_EXP +1024
203 #define CL_DBL_MIN_10_EXP -307
204 #define CL_DBL_MIN_EXP -1021
205 #define CL_DBL_RADIX 2
206 #define CL_DBL_MAX 0x1.fffffffffffffp1023
207 #define CL_DBL_MIN 0x1.0p-1022
208 #define CL_DBL_EPSILON 0x1.0p-52
210 #define CL_M_E 2.718281828459045090796
211 #define CL_M_LOG2E 1.442695040888963387005
212 #define CL_M_LOG10E 0.434294481903251816668
213 #define CL_M_LN2 0.693147180559945286227
214 #define CL_M_LN10 2.302585092994045901094
215 #define CL_M_PI 3.141592653589793115998
216 #define CL_M_PI_2 1.570796326794896557999
217 #define CL_M_PI_4 0.785398163397448278999
218 #define CL_M_1_PI 0.318309886183790691216
219 #define CL_M_2_PI 0.636619772367581382433
220 #define CL_M_2_SQRTPI 1.128379167095512558561
221 #define CL_M_SQRT2 1.414213562373095145475
222 #define CL_M_SQRT1_2 0.707106781186547572737
224 #define CL_M_E_F 2.71828174591064f
225 #define CL_M_LOG2E_F 1.44269502162933f
226 #define CL_M_LOG10E_F 0.43429449200630f
227 #define CL_M_LN2_F 0.69314718246460f
228 #define CL_M_LN10_F 2.30258512496948f
229 #define CL_M_PI_F 3.14159274101257f
230 #define CL_M_PI_2_F 1.57079637050629f
231 #define CL_M_PI_4_F 0.78539818525314f
232 #define CL_M_1_PI_F 0.31830987334251f
233 #define CL_M_2_PI_F 0.63661974668503f
234 #define CL_M_2_SQRTPI_F 1.12837922573090f
235 #define CL_M_SQRT2_F 1.41421353816986f
236 #define CL_M_SQRT1_2_F 0.70710676908493f
238 #if defined( __GNUC__ )
239 #define CL_HUGE_VALF __builtin_huge_valf()
240 #define CL_HUGE_VAL __builtin_huge_val()
241 #define CL_NAN __builtin_nanf( "" )
243 #define CL_HUGE_VALF ((cl_float) 1e50)
244 #define CL_HUGE_VAL ((cl_double) 1e500)
245 float nanf( const char * );
246 #define CL_NAN nanf( "" )
248 #define CL_MAXFLOAT CL_FLT_MAX
249 #define CL_INFINITY CL_HUGE_VALF
255 /* Mirror types to GL types. Mirror types allow us to avoid deciding which headers to load based on whether we are using GL or GLES here. */
256 typedef unsigned int cl_GLuint
;
257 typedef int cl_GLint
;
258 typedef unsigned int cl_GLenum
;
263 * Note: OpenCL requires that all types be naturally aligned.
264 * This means that vector types must be naturally aligned.
265 * For example, a vector of four floats must be aligned to
266 * a 16 byte boundary (calculated as 4 * the natural 4-byte
267 * alignment of the float). The alignment qualifiers here
268 * will only function properly if your compiler supports them
269 * and if you don't actively work to defeat them. For example,
270 * in order for a cl_float4 to be 16 byte aligned in a struct,
271 * the start of the struct must itself be 16-byte aligned.
273 * Maintaining proper alignment is the user's responsibility.
276 /* Define basic vector types */
277 #if defined( __VEC__ )
278 #include <altivec.h> /* may be omitted depending on compiler. AltiVec spec provides no way to detect whether the header is required. */
279 typedef vector
unsigned char __cl_uchar16
;
280 typedef vector
signed char __cl_char16
;
281 typedef vector
unsigned short __cl_ushort8
;
282 typedef vector
signed short __cl_short8
;
283 typedef vector
unsigned int __cl_uint4
;
284 typedef vector
signed int __cl_int4
;
285 typedef vector
float __cl_float4
;
286 #define __CL_UCHAR16__ 1
287 #define __CL_CHAR16__ 1
288 #define __CL_USHORT8__ 1
289 #define __CL_SHORT8__ 1
290 #define __CL_UINT4__ 1
291 #define __CL_INT4__ 1
292 #define __CL_FLOAT4__ 1
295 #if defined( __SSE__ )
296 #if defined( __MINGW64__ )
299 #include <xmmintrin.h>
301 #if defined( __GNUC__ )
302 typedef float __cl_float4
__attribute__((vector_size(16)));
304 typedef __m128 __cl_float4
;
306 #define __CL_FLOAT4__ 1
309 #if defined( __SSE2__ )
310 #if defined( __MINGW64__ )
313 #include <emmintrin.h>
315 #if defined( __GNUC__ )
316 typedef cl_uchar __cl_uchar16
__attribute__((vector_size(16)));
317 typedef cl_char __cl_char16
__attribute__((vector_size(16)));
318 typedef cl_ushort __cl_ushort8
__attribute__((vector_size(16)));
319 typedef cl_short __cl_short8
__attribute__((vector_size(16)));
320 typedef cl_uint __cl_uint4
__attribute__((vector_size(16)));
321 typedef cl_int __cl_int4
__attribute__((vector_size(16)));
322 typedef cl_ulong __cl_ulong2
__attribute__((vector_size(16)));
323 typedef cl_long __cl_long2
__attribute__((vector_size(16)));
324 typedef cl_double __cl_double2
__attribute__((vector_size(16)));
326 typedef __m128i __cl_uchar16
;
327 typedef __m128i __cl_char16
;
328 typedef __m128i __cl_ushort8
;
329 typedef __m128i __cl_short8
;
330 typedef __m128i __cl_uint4
;
331 typedef __m128i __cl_int4
;
332 typedef __m128i __cl_ulong2
;
333 typedef __m128i __cl_long2
;
334 typedef __m128d __cl_double2
;
336 #define __CL_UCHAR16__ 1
337 #define __CL_CHAR16__ 1
338 #define __CL_USHORT8__ 1
339 #define __CL_SHORT8__ 1
340 #define __CL_INT4__ 1
341 #define __CL_UINT4__ 1
342 #define __CL_ULONG2__ 1
343 #define __CL_LONG2__ 1
344 #define __CL_DOUBLE2__ 1
347 #if defined( __MMX__ )
348 #include <mmintrin.h>
349 #if defined( __GNUC__ )
350 typedef cl_uchar __cl_uchar8
__attribute__((vector_size(8)));
351 typedef cl_char __cl_char8
__attribute__((vector_size(8)));
352 typedef cl_ushort __cl_ushort4
__attribute__((vector_size(8)));
353 typedef cl_short __cl_short4
__attribute__((vector_size(8)));
354 typedef cl_uint __cl_uint2
__attribute__((vector_size(8)));
355 typedef cl_int __cl_int2
__attribute__((vector_size(8)));
356 typedef cl_ulong __cl_ulong1
__attribute__((vector_size(8)));
357 typedef cl_long __cl_long1
__attribute__((vector_size(8)));
358 typedef cl_float __cl_float2
__attribute__((vector_size(8)));
360 typedef __m64 __cl_uchar8
;
361 typedef __m64 __cl_char8
;
362 typedef __m64 __cl_ushort4
;
363 typedef __m64 __cl_short4
;
364 typedef __m64 __cl_uint2
;
365 typedef __m64 __cl_int2
;
366 typedef __m64 __cl_ulong1
;
367 typedef __m64 __cl_long1
;
368 typedef __m64 __cl_float2
;
370 #define __CL_UCHAR8__ 1
371 #define __CL_CHAR8__ 1
372 #define __CL_USHORT4__ 1
373 #define __CL_SHORT4__ 1
374 #define __CL_INT2__ 1
375 #define __CL_UINT2__ 1
376 #define __CL_ULONG1__ 1
377 #define __CL_LONG1__ 1
378 #define __CL_FLOAT2__ 1
381 #if defined( __AVX__ )
382 #if defined( __MINGW64__ )
385 #include <immintrin.h>
387 #if defined( __GNUC__ )
388 typedef cl_float __cl_float8
__attribute__((vector_size(32)));
389 typedef cl_double __cl_double4
__attribute__((vector_size(32)));
391 typedef __m256 __cl_float8
;
392 typedef __m256d __cl_double4
;
394 #define __CL_FLOAT8__ 1
395 #define __CL_DOUBLE4__ 1
398 /* Define alignment keys */
399 #if defined( __GNUC__ )
400 #define CL_ALIGNED(_x) __attribute__ ((aligned(_x)))
401 #elif defined( _WIN32) && (_MSC_VER)
402 /* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements */
403 /* http://msdn.microsoft.com/en-us/library/373ak2y1%28VS.71%29.aspx */
404 /* #include <crtdefs.h> */
405 /* #define CL_ALIGNED(_x) _CRT_ALIGN(_x) */
406 #define CL_ALIGNED(_x)
408 #warning Need to implement some method to align data here
409 #define CL_ALIGNED(_x)
412 /* Indicate whether .xyzw, .s0123 and .hi.lo are supported */
413 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
414 /* .xyzw and .s0123...{f|F} are supported */
415 #define CL_HAS_NAMED_VECTOR_FIELDS 1
416 /* .hi and .lo are supported */
417 #define CL_HAS_HI_LO_VECTOR_FIELDS 1
420 /* Define cl_vector types */
422 /* ---- cl_charn ---- */
425 cl_char
CL_ALIGNED(2) s
[2];
426 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
427 __extension__
struct{ cl_char x
, y
; };
428 __extension__
struct{ cl_char s0
, s1
; };
429 __extension__
struct{ cl_char lo
, hi
; };
431 #if defined( __CL_CHAR2__)
438 cl_char
CL_ALIGNED(4) s
[4];
439 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
440 __extension__
struct{ cl_char x
, y
, z
, w
; };
441 __extension__
struct{ cl_char s0
, s1
, s2
, s3
; };
442 __extension__
struct{ cl_char2 lo
, hi
; };
444 #if defined( __CL_CHAR2__)
447 #if defined( __CL_CHAR4__)
452 /* cl_char3 is identical in size, alignment and behavior to cl_char4. See section 6.1.5. */
453 typedef cl_char4 cl_char3
;
457 cl_char
CL_ALIGNED(8) s
[8];
458 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
459 __extension__
struct{ cl_char x
, y
, z
, w
; };
460 __extension__
struct{ cl_char s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
; };
461 __extension__
struct{ cl_char4 lo
, hi
; };
463 #if defined( __CL_CHAR2__)
466 #if defined( __CL_CHAR4__)
469 #if defined( __CL_CHAR8__ )
476 cl_char
CL_ALIGNED(16) s
[16];
477 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
478 __extension__
struct{ cl_char x
, y
, z
, w
, __spacer4
, __spacer5
, __spacer6
, __spacer7
, __spacer8
, __spacer9
, sa
, sb
, sc
, sd
, se
, sf
; };
479 __extension__
struct{ cl_char s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
, s8
, s9
, sA
, sB
, sC
, sD
, sE
, sF
; };
480 __extension__
struct{ cl_char8 lo
, hi
; };
482 #if defined( __CL_CHAR2__)
485 #if defined( __CL_CHAR4__)
488 #if defined( __CL_CHAR8__ )
491 #if defined( __CL_CHAR16__ )
497 /* ---- cl_ucharn ---- */
500 cl_uchar
CL_ALIGNED(2) s
[2];
501 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
502 __extension__
struct{ cl_uchar x
, y
; };
503 __extension__
struct{ cl_uchar s0
, s1
; };
504 __extension__
struct{ cl_uchar lo
, hi
; };
506 #if defined( __cl_uchar2__)
513 cl_uchar
CL_ALIGNED(4) s
[4];
514 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
515 __extension__
struct{ cl_uchar x
, y
, z
, w
; };
516 __extension__
struct{ cl_uchar s0
, s1
, s2
, s3
; };
517 __extension__
struct{ cl_uchar2 lo
, hi
; };
519 #if defined( __CL_UCHAR2__)
522 #if defined( __CL_UCHAR4__)
527 /* cl_uchar3 is identical in size, alignment and behavior to cl_uchar4. See section 6.1.5. */
528 typedef cl_uchar4 cl_uchar3
;
532 cl_uchar
CL_ALIGNED(8) s
[8];
533 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
534 __extension__
struct{ cl_uchar x
, y
, z
, w
; };
535 __extension__
struct{ cl_uchar s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
; };
536 __extension__
struct{ cl_uchar4 lo
, hi
; };
538 #if defined( __CL_UCHAR2__)
541 #if defined( __CL_UCHAR4__)
544 #if defined( __CL_UCHAR8__ )
551 cl_uchar
CL_ALIGNED(16) s
[16];
552 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
553 __extension__
struct{ cl_uchar x
, y
, z
, w
, __spacer4
, __spacer5
, __spacer6
, __spacer7
, __spacer8
, __spacer9
, sa
, sb
, sc
, sd
, se
, sf
; };
554 __extension__
struct{ cl_uchar s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
, s8
, s9
, sA
, sB
, sC
, sD
, sE
, sF
; };
555 __extension__
struct{ cl_uchar8 lo
, hi
; };
557 #if defined( __CL_UCHAR2__)
560 #if defined( __CL_UCHAR4__)
563 #if defined( __CL_UCHAR8__ )
566 #if defined( __CL_UCHAR16__ )
572 /* ---- cl_shortn ---- */
575 cl_short
CL_ALIGNED(4) s
[2];
576 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
577 __extension__
struct{ cl_short x
, y
; };
578 __extension__
struct{ cl_short s0
, s1
; };
579 __extension__
struct{ cl_short lo
, hi
; };
581 #if defined( __CL_SHORT2__)
588 cl_short
CL_ALIGNED(8) s
[4];
589 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
590 __extension__
struct{ cl_short x
, y
, z
, w
; };
591 __extension__
struct{ cl_short s0
, s1
, s2
, s3
; };
592 __extension__
struct{ cl_short2 lo
, hi
; };
594 #if defined( __CL_SHORT2__)
597 #if defined( __CL_SHORT4__)
602 /* cl_short3 is identical in size, alignment and behavior to cl_short4. See section 6.1.5. */
603 typedef cl_short4 cl_short3
;
607 cl_short
CL_ALIGNED(16) s
[8];
608 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
609 __extension__
struct{ cl_short x
, y
, z
, w
; };
610 __extension__
struct{ cl_short s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
; };
611 __extension__
struct{ cl_short4 lo
, hi
; };
613 #if defined( __CL_SHORT2__)
616 #if defined( __CL_SHORT4__)
619 #if defined( __CL_SHORT8__ )
626 cl_short
CL_ALIGNED(32) s
[16];
627 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
628 __extension__
struct{ cl_short x
, y
, z
, w
, __spacer4
, __spacer5
, __spacer6
, __spacer7
, __spacer8
, __spacer9
, sa
, sb
, sc
, sd
, se
, sf
; };
629 __extension__
struct{ cl_short s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
, s8
, s9
, sA
, sB
, sC
, sD
, sE
, sF
; };
630 __extension__
struct{ cl_short8 lo
, hi
; };
632 #if defined( __CL_SHORT2__)
635 #if defined( __CL_SHORT4__)
638 #if defined( __CL_SHORT8__ )
641 #if defined( __CL_SHORT16__ )
647 /* ---- cl_ushortn ---- */
650 cl_ushort
CL_ALIGNED(4) s
[2];
651 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
652 __extension__
struct{ cl_ushort x
, y
; };
653 __extension__
struct{ cl_ushort s0
, s1
; };
654 __extension__
struct{ cl_ushort lo
, hi
; };
656 #if defined( __CL_USHORT2__)
663 cl_ushort
CL_ALIGNED(8) s
[4];
664 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
665 __extension__
struct{ cl_ushort x
, y
, z
, w
; };
666 __extension__
struct{ cl_ushort s0
, s1
, s2
, s3
; };
667 __extension__
struct{ cl_ushort2 lo
, hi
; };
669 #if defined( __CL_USHORT2__)
672 #if defined( __CL_USHORT4__)
677 /* cl_ushort3 is identical in size, alignment and behavior to cl_ushort4. See section 6.1.5. */
678 typedef cl_ushort4 cl_ushort3
;
682 cl_ushort
CL_ALIGNED(16) s
[8];
683 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
684 __extension__
struct{ cl_ushort x
, y
, z
, w
; };
685 __extension__
struct{ cl_ushort s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
; };
686 __extension__
struct{ cl_ushort4 lo
, hi
; };
688 #if defined( __CL_USHORT2__)
691 #if defined( __CL_USHORT4__)
694 #if defined( __CL_USHORT8__ )
701 cl_ushort
CL_ALIGNED(32) s
[16];
702 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
703 __extension__
struct{ cl_ushort x
, y
, z
, w
, __spacer4
, __spacer5
, __spacer6
, __spacer7
, __spacer8
, __spacer9
, sa
, sb
, sc
, sd
, se
, sf
; };
704 __extension__
struct{ cl_ushort s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
, s8
, s9
, sA
, sB
, sC
, sD
, sE
, sF
; };
705 __extension__
struct{ cl_ushort8 lo
, hi
; };
707 #if defined( __CL_USHORT2__)
710 #if defined( __CL_USHORT4__)
713 #if defined( __CL_USHORT8__ )
716 #if defined( __CL_USHORT16__ )
721 /* ---- cl_intn ---- */
724 cl_int
CL_ALIGNED(8) s
[2];
725 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
726 __extension__
struct{ cl_int x
, y
; };
727 __extension__
struct{ cl_int s0
, s1
; };
728 __extension__
struct{ cl_int lo
, hi
; };
730 #if defined( __CL_INT2__)
737 cl_int
CL_ALIGNED(16) s
[4];
738 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
739 __extension__
struct{ cl_int x
, y
, z
, w
; };
740 __extension__
struct{ cl_int s0
, s1
, s2
, s3
; };
741 __extension__
struct{ cl_int2 lo
, hi
; };
743 #if defined( __CL_INT2__)
746 #if defined( __CL_INT4__)
751 /* cl_int3 is identical in size, alignment and behavior to cl_int4. See section 6.1.5. */
752 typedef cl_int4 cl_int3
;
756 cl_int
CL_ALIGNED(32) s
[8];
757 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
758 __extension__
struct{ cl_int x
, y
, z
, w
; };
759 __extension__
struct{ cl_int s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
; };
760 __extension__
struct{ cl_int4 lo
, hi
; };
762 #if defined( __CL_INT2__)
765 #if defined( __CL_INT4__)
768 #if defined( __CL_INT8__ )
775 cl_int
CL_ALIGNED(64) s
[16];
776 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
777 __extension__
struct{ cl_int x
, y
, z
, w
, __spacer4
, __spacer5
, __spacer6
, __spacer7
, __spacer8
, __spacer9
, sa
, sb
, sc
, sd
, se
, sf
; };
778 __extension__
struct{ cl_int s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
, s8
, s9
, sA
, sB
, sC
, sD
, sE
, sF
; };
779 __extension__
struct{ cl_int8 lo
, hi
; };
781 #if defined( __CL_INT2__)
784 #if defined( __CL_INT4__)
787 #if defined( __CL_INT8__ )
790 #if defined( __CL_INT16__ )
796 /* ---- cl_uintn ---- */
799 cl_uint
CL_ALIGNED(8) s
[2];
800 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
801 __extension__
struct{ cl_uint x
, y
; };
802 __extension__
struct{ cl_uint s0
, s1
; };
803 __extension__
struct{ cl_uint lo
, hi
; };
805 #if defined( __CL_UINT2__)
812 cl_uint
CL_ALIGNED(16) s
[4];
813 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
814 __extension__
struct{ cl_uint x
, y
, z
, w
; };
815 __extension__
struct{ cl_uint s0
, s1
, s2
, s3
; };
816 __extension__
struct{ cl_uint2 lo
, hi
; };
818 #if defined( __CL_UINT2__)
821 #if defined( __CL_UINT4__)
826 /* cl_uint3 is identical in size, alignment and behavior to cl_uint4. See section 6.1.5. */
827 typedef cl_uint4 cl_uint3
;
831 cl_uint
CL_ALIGNED(32) s
[8];
832 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
833 __extension__
struct{ cl_uint x
, y
, z
, w
; };
834 __extension__
struct{ cl_uint s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
; };
835 __extension__
struct{ cl_uint4 lo
, hi
; };
837 #if defined( __CL_UINT2__)
840 #if defined( __CL_UINT4__)
843 #if defined( __CL_UINT8__ )
850 cl_uint
CL_ALIGNED(64) s
[16];
851 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
852 __extension__
struct{ cl_uint x
, y
, z
, w
, __spacer4
, __spacer5
, __spacer6
, __spacer7
, __spacer8
, __spacer9
, sa
, sb
, sc
, sd
, se
, sf
; };
853 __extension__
struct{ cl_uint s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
, s8
, s9
, sA
, sB
, sC
, sD
, sE
, sF
; };
854 __extension__
struct{ cl_uint8 lo
, hi
; };
856 #if defined( __CL_UINT2__)
859 #if defined( __CL_UINT4__)
862 #if defined( __CL_UINT8__ )
865 #if defined( __CL_UINT16__ )
870 /* ---- cl_longn ---- */
873 cl_long
CL_ALIGNED(16) s
[2];
874 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
875 __extension__
struct{ cl_long x
, y
; };
876 __extension__
struct{ cl_long s0
, s1
; };
877 __extension__
struct{ cl_long lo
, hi
; };
879 #if defined( __CL_LONG2__)
886 cl_long
CL_ALIGNED(32) s
[4];
887 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
888 __extension__
struct{ cl_long x
, y
, z
, w
; };
889 __extension__
struct{ cl_long s0
, s1
, s2
, s3
; };
890 __extension__
struct{ cl_long2 lo
, hi
; };
892 #if defined( __CL_LONG2__)
895 #if defined( __CL_LONG4__)
900 /* cl_long3 is identical in size, alignment and behavior to cl_long4. See section 6.1.5. */
901 typedef cl_long4 cl_long3
;
905 cl_long
CL_ALIGNED(64) s
[8];
906 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
907 __extension__
struct{ cl_long x
, y
, z
, w
; };
908 __extension__
struct{ cl_long s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
; };
909 __extension__
struct{ cl_long4 lo
, hi
; };
911 #if defined( __CL_LONG2__)
914 #if defined( __CL_LONG4__)
917 #if defined( __CL_LONG8__ )
924 cl_long
CL_ALIGNED(128) s
[16];
925 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
926 __extension__
struct{ cl_long x
, y
, z
, w
, __spacer4
, __spacer5
, __spacer6
, __spacer7
, __spacer8
, __spacer9
, sa
, sb
, sc
, sd
, se
, sf
; };
927 __extension__
struct{ cl_long s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
, s8
, s9
, sA
, sB
, sC
, sD
, sE
, sF
; };
928 __extension__
struct{ cl_long8 lo
, hi
; };
930 #if defined( __CL_LONG2__)
933 #if defined( __CL_LONG4__)
936 #if defined( __CL_LONG8__ )
939 #if defined( __CL_LONG16__ )
945 /* ---- cl_ulongn ---- */
948 cl_ulong
CL_ALIGNED(16) s
[2];
949 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
950 __extension__
struct{ cl_ulong x
, y
; };
951 __extension__
struct{ cl_ulong s0
, s1
; };
952 __extension__
struct{ cl_ulong lo
, hi
; };
954 #if defined( __CL_ULONG2__)
961 cl_ulong
CL_ALIGNED(32) s
[4];
962 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
963 __extension__
struct{ cl_ulong x
, y
, z
, w
; };
964 __extension__
struct{ cl_ulong s0
, s1
, s2
, s3
; };
965 __extension__
struct{ cl_ulong2 lo
, hi
; };
967 #if defined( __CL_ULONG2__)
970 #if defined( __CL_ULONG4__)
975 /* cl_ulong3 is identical in size, alignment and behavior to cl_ulong4. See section 6.1.5. */
976 typedef cl_ulong4 cl_ulong3
;
980 cl_ulong
CL_ALIGNED(64) s
[8];
981 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
982 __extension__
struct{ cl_ulong x
, y
, z
, w
; };
983 __extension__
struct{ cl_ulong s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
; };
984 __extension__
struct{ cl_ulong4 lo
, hi
; };
986 #if defined( __CL_ULONG2__)
989 #if defined( __CL_ULONG4__)
992 #if defined( __CL_ULONG8__ )
999 cl_ulong
CL_ALIGNED(128) s
[16];
1000 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1001 __extension__
struct{ cl_ulong x
, y
, z
, w
, __spacer4
, __spacer5
, __spacer6
, __spacer7
, __spacer8
, __spacer9
, sa
, sb
, sc
, sd
, se
, sf
; };
1002 __extension__
struct{ cl_ulong s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
, s8
, s9
, sA
, sB
, sC
, sD
, sE
, sF
; };
1003 __extension__
struct{ cl_ulong8 lo
, hi
; };
1005 #if defined( __CL_ULONG2__)
1008 #if defined( __CL_ULONG4__)
1011 #if defined( __CL_ULONG8__ )
1014 #if defined( __CL_ULONG16__ )
1020 /* --- cl_floatn ---- */
1024 cl_float
CL_ALIGNED(8) s
[2];
1025 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1026 __extension__
struct{ cl_float x
, y
; };
1027 __extension__
struct{ cl_float s0
, s1
; };
1028 __extension__
struct{ cl_float lo
, hi
; };
1030 #if defined( __CL_FLOAT2__)
1037 cl_float
CL_ALIGNED(16) s
[4];
1038 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1039 __extension__
struct{ cl_float x
, y
, z
, w
; };
1040 __extension__
struct{ cl_float s0
, s1
, s2
, s3
; };
1041 __extension__
struct{ cl_float2 lo
, hi
; };
1043 #if defined( __CL_FLOAT2__)
1046 #if defined( __CL_FLOAT4__)
1051 /* cl_float3 is identical in size, alignment and behavior to cl_float4. See section 6.1.5. */
1052 typedef cl_float4 cl_float3
;
1056 cl_float
CL_ALIGNED(32) s
[8];
1057 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1058 __extension__
struct{ cl_float x
, y
, z
, w
; };
1059 __extension__
struct{ cl_float s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
; };
1060 __extension__
struct{ cl_float4 lo
, hi
; };
1062 #if defined( __CL_FLOAT2__)
1065 #if defined( __CL_FLOAT4__)
1068 #if defined( __CL_FLOAT8__ )
1075 cl_float
CL_ALIGNED(64) s
[16];
1076 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1077 __extension__
struct{ cl_float x
, y
, z
, w
, __spacer4
, __spacer5
, __spacer6
, __spacer7
, __spacer8
, __spacer9
, sa
, sb
, sc
, sd
, se
, sf
; };
1078 __extension__
struct{ cl_float s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
, s8
, s9
, sA
, sB
, sC
, sD
, sE
, sF
; };
1079 __extension__
struct{ cl_float8 lo
, hi
; };
1081 #if defined( __CL_FLOAT2__)
1084 #if defined( __CL_FLOAT4__)
1087 #if defined( __CL_FLOAT8__ )
1090 #if defined( __CL_FLOAT16__ )
1095 /* --- cl_doublen ---- */
1099 cl_double
CL_ALIGNED(16) s
[2];
1100 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1101 __extension__
struct{ cl_double x
, y
; };
1102 __extension__
struct{ cl_double s0
, s1
; };
1103 __extension__
struct{ cl_double lo
, hi
; };
1105 #if defined( __CL_DOUBLE2__)
1112 cl_double
CL_ALIGNED(32) s
[4];
1113 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1114 __extension__
struct{ cl_double x
, y
, z
, w
; };
1115 __extension__
struct{ cl_double s0
, s1
, s2
, s3
; };
1116 __extension__
struct{ cl_double2 lo
, hi
; };
1118 #if defined( __CL_DOUBLE2__)
1121 #if defined( __CL_DOUBLE4__)
1126 /* cl_double3 is identical in size, alignment and behavior to cl_double4. See section 6.1.5. */
1127 typedef cl_double4 cl_double3
;
1131 cl_double
CL_ALIGNED(64) s
[8];
1132 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1133 __extension__
struct{ cl_double x
, y
, z
, w
; };
1134 __extension__
struct{ cl_double s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
; };
1135 __extension__
struct{ cl_double4 lo
, hi
; };
1137 #if defined( __CL_DOUBLE2__)
1140 #if defined( __CL_DOUBLE4__)
1143 #if defined( __CL_DOUBLE8__ )
1150 cl_double
CL_ALIGNED(128) s
[16];
1151 #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
1152 __extension__
struct{ cl_double x
, y
, z
, w
, __spacer4
, __spacer5
, __spacer6
, __spacer7
, __spacer8
, __spacer9
, sa
, sb
, sc
, sd
, se
, sf
; };
1153 __extension__
struct{ cl_double s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
, s8
, s9
, sA
, sB
, sC
, sD
, sE
, sF
; };
1154 __extension__
struct{ cl_double8 lo
, hi
; };
1156 #if defined( __CL_DOUBLE2__)
1159 #if defined( __CL_DOUBLE4__)
1162 #if defined( __CL_DOUBLE8__ )
1165 #if defined( __CL_DOUBLE16__ )
1170 /* Macro to facilitate debugging
1172 * Place CL_PROGRAM_STRING_DEBUG_INFO on the line before the first line of your source.
1173 * The first line ends with: CL_PROGRAM_STRING_BEGIN \"
1174 * Each line thereafter of OpenCL C source must end with: \n\
1175 * The last line ends in ";
1179 * const char *my_program = CL_PROGRAM_STRING_BEGIN "\
1180 * kernel void foo( int a, float * b ) \n\
1183 * *b[ get_global_id(0)] = a; \n\
1187 * This should correctly set up the line, (column) and file information for your source
1188 * string so you can do source level debugging.
1190 #define __CL_STRINGIFY( _x ) # _x
1191 #define _CL_STRINGIFY( _x ) __CL_STRINGIFY( _x )
1192 #define CL_PROGRAM_STRING_DEBUG_INFO "#line " _CL_STRINGIFY(__LINE__) " \"" __FILE__ "\" \n\n"
1198 #endif /* __CL_PLATFORM_H */