Debian Codegraph @

include/CL/cl_platform.h

raw
1 /*******************************************************************************
2 * Copyright (c) 2008-2020 The Khronos Group Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 ******************************************************************************/
16
17 #ifndef __CL_PLATFORM_H
18 #define __CL_PLATFORM_H
19
20 #include <CL/cl_version.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 #if defined(_WIN32)
27 #if !defined(CL_API_ENTRY)
28 #define CL_API_ENTRY
29 #endif
30 #if !defined(CL_API_CALL)
31 #define CL_API_CALL __stdcall
32 #endif
33 #if !defined(CL_CALLBACK)
34 #define CL_CALLBACK __stdcall
35 #endif
36 #else
37 #if !defined(CL_API_ENTRY)
38 #define CL_API_ENTRY
39 #endif
40 #if !defined(CL_API_CALL)
41 #define CL_API_CALL
42 #endif
43 #if !defined(CL_CALLBACK)
44 #define CL_CALLBACK
45 #endif
46 #endif
47
48 /*
49 * Deprecation flags refer to the last version of the header in which the
50 * feature was not deprecated.
51 *
52 * E.g. VERSION_1_1_DEPRECATED means the feature is present in 1.1 without
53 * deprecation but is deprecated in versions later than 1.1.
54 */
55
56 #ifndef CL_API_SUFFIX_USER
57 #define CL_API_SUFFIX_USER
58 #endif
59
60 #ifndef CL_API_PREFIX_USER
61 #define CL_API_PREFIX_USER
62 #endif
63
64 #define CL_API_SUFFIX_COMMON CL_API_SUFFIX_USER
65 #define CL_API_PREFIX_COMMON CL_API_PREFIX_USER
66
67 #define CL_API_SUFFIX__VERSION_1_0 CL_API_SUFFIX_COMMON
68 #define CL_API_SUFFIX__VERSION_1_1 CL_API_SUFFIX_COMMON
69 #define CL_API_SUFFIX__VERSION_1_2 CL_API_SUFFIX_COMMON
70 #define CL_API_SUFFIX__VERSION_2_0 CL_API_SUFFIX_COMMON
71 #define CL_API_SUFFIX__VERSION_2_1 CL_API_SUFFIX_COMMON
72 #define CL_API_SUFFIX__VERSION_2_2 CL_API_SUFFIX_COMMON
73 #define CL_API_SUFFIX__VERSION_3_0 CL_API_SUFFIX_COMMON
74 #define CL_API_SUFFIX__EXPERIMENTAL CL_API_SUFFIX_COMMON
75
76
77 #ifdef __GNUC__
78 #define CL_API_SUFFIX_DEPRECATED __attribute__((deprecated))
79 #define CL_API_PREFIX_DEPRECATED
80 #elif defined(_MSC_VER) && !defined(__clang__)
81 #define CL_API_SUFFIX_DEPRECATED
82 #define CL_API_PREFIX_DEPRECATED __declspec(deprecated)
83 #else
84 #define CL_API_SUFFIX_DEPRECATED
85 #define CL_API_PREFIX_DEPRECATED
86 #endif
87
88 #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
89 #define CL_API_SUFFIX__VERSION_1_0_DEPRECATED CL_API_SUFFIX_COMMON
90 #define CL_API_PREFIX__VERSION_1_0_DEPRECATED CL_API_PREFIX_COMMON
91 #else
92 #define CL_API_SUFFIX__VERSION_1_0_DEPRECATED CL_API_SUFFIX_COMMON CL_API_SUFFIX_DEPRECATED
93 #define CL_API_PREFIX__VERSION_1_0_DEPRECATED CL_API_PREFIX_COMMON CL_API_PREFIX_DEPRECATED
94 #endif
95
96 #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
97 #define CL_API_SUFFIX__VERSION_1_1_DEPRECATED CL_API_SUFFIX_COMMON
98 #define CL_API_PREFIX__VERSION_1_1_DEPRECATED CL_API_PREFIX_COMMON
99 #else
100 #define CL_API_SUFFIX__VERSION_1_1_DEPRECATED CL_API_SUFFIX_COMMON CL_API_SUFFIX_DEPRECATED
101 #define CL_API_PREFIX__VERSION_1_1_DEPRECATED CL_API_PREFIX_COMMON CL_API_PREFIX_DEPRECATED
102 #endif
103
104 #ifdef CL_USE_DEPRECATED_OPENCL_1_2_APIS
105 #define CL_API_SUFFIX__VERSION_1_2_DEPRECATED CL_API_SUFFIX_COMMON
106 #define CL_API_PREFIX__VERSION_1_2_DEPRECATED CL_API_PREFIX_COMMON
107 #else
108 #define CL_API_SUFFIX__VERSION_1_2_DEPRECATED CL_API_SUFFIX_COMMON CL_API_SUFFIX_DEPRECATED
109 #define CL_API_PREFIX__VERSION_1_2_DEPRECATED CL_API_PREFIX_COMMON CL_API_PREFIX_DEPRECATED
110 #endif
111
112 #ifdef CL_USE_DEPRECATED_OPENCL_2_0_APIS
113 #define CL_API_SUFFIX__VERSION_2_0_DEPRECATED CL_API_SUFFIX_COMMON
114 #define CL_API_PREFIX__VERSION_2_0_DEPRECATED CL_API_PREFIX_COMMON
115 #else
116 #define CL_API_SUFFIX__VERSION_2_0_DEPRECATED CL_API_SUFFIX_COMMON CL_API_SUFFIX_DEPRECATED
117 #define CL_API_PREFIX__VERSION_2_0_DEPRECATED CL_API_PREFIX_COMMON CL_API_PREFIX_DEPRECATED
118 #endif
119
120 #ifdef CL_USE_DEPRECATED_OPENCL_2_1_APIS
121 #define CL_API_SUFFIX__VERSION_2_1_DEPRECATED CL_API_SUFFIX_COMMON
122 #define CL_API_PREFIX__VERSION_2_1_DEPRECATED CL_API_PREFIX_COMMON
123 #else
124 #define CL_API_SUFFIX__VERSION_2_1_DEPRECATED CL_API_SUFFIX_COMMON CL_API_SUFFIX_DEPRECATED
125 #define CL_API_PREFIX__VERSION_2_1_DEPRECATED CL_API_PREFIX_COMMON CL_API_PREFIX_DEPRECATED
126 #endif
127
128 #ifdef CL_USE_DEPRECATED_OPENCL_2_2_APIS
129 #define CL_API_SUFFIX__VERSION_2_2_DEPRECATED CL_API_SUFFIX_COMMON
130 #define CL_API_PREFIX__VERSION_2_2_DEPRECATED CL_API_PREFIX_COMMON
131 #else
132 #define CL_API_SUFFIX__VERSION_2_2_DEPRECATED CL_API_SUFFIX_COMMON CL_API_SUFFIX_DEPRECATED
133 #define CL_API_PREFIX__VERSION_2_2_DEPRECATED CL_API_PREFIX_COMMON CL_API_PREFIX_DEPRECATED
134 #endif
135
136 #if (defined (_WIN32) && defined(_MSC_VER))
137
138 #if defined(__clang__)
139 #pragma clang diagnostic push
140 #pragma clang diagnostic ignored "-Wlanguage-extension-token"
141 #endif
142
143 /* intptr_t is used in cl.h and provided by stddef.h in Visual C++, but not in clang */
144 /* stdint.h was missing before Visual Studio 2010, include it for later versions and for clang */
145 #if defined(__clang__) || _MSC_VER >= 1600
146 #include <stdint.h>
147 #endif
148
149 /* scalar types */
150 typedef signed __int8 cl_char;
151 typedef unsigned __int8 cl_uchar;
152 typedef signed __int16 cl_short;
153 typedef unsigned __int16 cl_ushort;
154 typedef signed __int32 cl_int;
155 typedef unsigned __int32 cl_uint;
156 typedef signed __int64 cl_long;
157 typedef unsigned __int64 cl_ulong;
158
159 typedef unsigned __int16 cl_half;
160 typedef float cl_float;
161 typedef double cl_double;
162
163 #if defined(__clang__)
164 #pragma clang diagnostic pop
165 #endif
166
167 /* Macro names and corresponding values defined by OpenCL */
168 #define CL_CHAR_BIT 8
169 #define CL_SCHAR_MAX 127
170 #define CL_SCHAR_MIN (-127-1)
171 #define CL_CHAR_MAX CL_SCHAR_MAX
172 #define CL_CHAR_MIN CL_SCHAR_MIN
173 #define CL_UCHAR_MAX 255
174 #define CL_SHRT_MAX 32767
175 #define CL_SHRT_MIN (-32767-1)
176 #define CL_USHRT_MAX 65535
177 #define CL_INT_MAX 2147483647
178 #define CL_INT_MIN (-2147483647-1)
179 #define CL_UINT_MAX 0xffffffffU
180 #define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
181 #define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
182 #define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
183
184 #define CL_FLT_DIG 6
185 #define CL_FLT_MANT_DIG 24
186 #define CL_FLT_MAX_10_EXP +38
187 #define CL_FLT_MAX_EXP +128
188 #define CL_FLT_MIN_10_EXP -37
189 #define CL_FLT_MIN_EXP -125
190 #define CL_FLT_RADIX 2
191 #define CL_FLT_MAX 340282346638528859811704183484516925440.0f
192 #define CL_FLT_MIN 1.175494350822287507969e-38f
193 #define CL_FLT_EPSILON 1.1920928955078125e-7f
194
195 #define CL_HALF_DIG 3
196 #define CL_HALF_MANT_DIG 11
197 #define CL_HALF_MAX_10_EXP +4
198 #define CL_HALF_MAX_EXP +16
199 #define CL_HALF_MIN_10_EXP -4
200 #define CL_HALF_MIN_EXP -13
201 #define CL_HALF_RADIX 2
202 #define CL_HALF_MAX 65504.0f
203 #define CL_HALF_MIN 6.103515625e-05f
204 #define CL_HALF_EPSILON 9.765625e-04f
205
206 #define CL_DBL_DIG 15
207 #define CL_DBL_MANT_DIG 53
208 #define CL_DBL_MAX_10_EXP +308
209 #define CL_DBL_MAX_EXP +1024
210 #define CL_DBL_MIN_10_EXP -307
211 #define CL_DBL_MIN_EXP -1021
212 #define CL_DBL_RADIX 2
213 #define CL_DBL_MAX 1.7976931348623158e+308
214 #define CL_DBL_MIN 2.225073858507201383090e-308
215 #define CL_DBL_EPSILON 2.220446049250313080847e-16
216
217 #define CL_M_E 2.7182818284590452354
218 #define CL_M_LOG2E 1.4426950408889634074
219 #define CL_M_LOG10E 0.43429448190325182765
220 #define CL_M_LN2 0.69314718055994530942
221 #define CL_M_LN10 2.30258509299404568402
222 #define CL_M_PI 3.14159265358979323846
223 #define CL_M_PI_2 1.57079632679489661923
224 #define CL_M_PI_4 0.78539816339744830962
225 #define CL_M_1_PI 0.31830988618379067154
226 #define CL_M_2_PI 0.63661977236758134308
227 #define CL_M_2_SQRTPI 1.12837916709551257390
228 #define CL_M_SQRT2 1.41421356237309504880
229 #define CL_M_SQRT1_2 0.70710678118654752440
230
231 #define CL_M_E_F 2.718281828f
232 #define CL_M_LOG2E_F 1.442695041f
233 #define CL_M_LOG10E_F 0.434294482f
234 #define CL_M_LN2_F 0.693147181f
235 #define CL_M_LN10_F 2.302585093f
236 #define CL_M_PI_F 3.141592654f
237 #define CL_M_PI_2_F 1.570796327f
238 #define CL_M_PI_4_F 0.785398163f
239 #define CL_M_1_PI_F 0.318309886f
240 #define CL_M_2_PI_F 0.636619772f
241 #define CL_M_2_SQRTPI_F 1.128379167f
242 #define CL_M_SQRT2_F 1.414213562f
243 #define CL_M_SQRT1_2_F 0.707106781f
244
245 #define CL_NAN (CL_INFINITY - CL_INFINITY)
246 #define CL_HUGE_VALF ((cl_float) 1e50)
247 #define CL_HUGE_VAL ((cl_double) 1e500)
248 #define CL_MAXFLOAT CL_FLT_MAX
249 #define CL_INFINITY CL_HUGE_VALF
250
251 #else
252
253 #include <stdint.h>
254
255 /* scalar types */
256 typedef int8_t cl_char;
257 typedef uint8_t cl_uchar;
258 typedef int16_t cl_short;
259 typedef uint16_t cl_ushort;
260 typedef int32_t cl_int;
261 typedef uint32_t cl_uint;
262 typedef int64_t cl_long;
263 typedef uint64_t cl_ulong;
264
265 typedef uint16_t cl_half;
266 typedef float cl_float;
267 typedef double cl_double;
268
269 /* Macro names and corresponding values defined by OpenCL */
270 #define CL_CHAR_BIT 8
271 #define CL_SCHAR_MAX 127
272 #define CL_SCHAR_MIN (-127-1)
273 #define CL_CHAR_MAX CL_SCHAR_MAX
274 #define CL_CHAR_MIN CL_SCHAR_MIN
275 #define CL_UCHAR_MAX 255
276 #define CL_SHRT_MAX 32767
277 #define CL_SHRT_MIN (-32767-1)
278 #define CL_USHRT_MAX 65535
279 #define CL_INT_MAX 2147483647
280 #define CL_INT_MIN (-2147483647-1)
281 #define CL_UINT_MAX 0xffffffffU
282 #define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
283 #define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
284 #define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
285
286 #define CL_FLT_DIG 6
287 #define CL_FLT_MANT_DIG 24
288 #define CL_FLT_MAX_10_EXP +38
289 #define CL_FLT_MAX_EXP +128
290 #define CL_FLT_MIN_10_EXP -37
291 #define CL_FLT_MIN_EXP -125
292 #define CL_FLT_RADIX 2
293 #define CL_FLT_MAX 340282346638528859811704183484516925440.0f
294 #define CL_FLT_MIN 1.175494350822287507969e-38f
295 #define CL_FLT_EPSILON 1.1920928955078125e-7f
296
297 #define CL_HALF_DIG 3
298 #define CL_HALF_MANT_DIG 11
299 #define CL_HALF_MAX_10_EXP +4
300 #define CL_HALF_MAX_EXP +16
301 #define CL_HALF_MIN_10_EXP -4
302 #define CL_HALF_MIN_EXP -13
303 #define CL_HALF_RADIX 2
304 #define CL_HALF_MAX 65504.0f
305 #define CL_HALF_MIN 6.103515625e-05f
306 #define CL_HALF_EPSILON 9.765625e-04f
307
308 #define CL_DBL_DIG 15
309 #define CL_DBL_MANT_DIG 53
310 #define CL_DBL_MAX_10_EXP +308
311 #define CL_DBL_MAX_EXP +1024
312 #define CL_DBL_MIN_10_EXP -307
313 #define CL_DBL_MIN_EXP -1021
314 #define CL_DBL_RADIX 2
315 #define CL_DBL_MAX 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
316 #define CL_DBL_MIN 2.225073858507201383090e-308
317 #define CL_DBL_EPSILON 2.220446049250313080847e-16
318
319 #define CL_M_E 2.7182818284590452354
320 #define CL_M_LOG2E 1.4426950408889634074
321 #define CL_M_LOG10E 0.43429448190325182765
322 #define CL_M_LN2 0.69314718055994530942
323 #define CL_M_LN10 2.30258509299404568402
324 #define CL_M_PI 3.14159265358979323846
325 #define CL_M_PI_2 1.57079632679489661923
326 #define CL_M_PI_4 0.78539816339744830962
327 #define CL_M_1_PI 0.31830988618379067154
328 #define CL_M_2_PI 0.63661977236758134308
329 #define CL_M_2_SQRTPI 1.12837916709551257390
330 #define CL_M_SQRT2 1.41421356237309504880
331 #define CL_M_SQRT1_2 0.70710678118654752440
332
333 #define CL_M_E_F 2.718281828f
334 #define CL_M_LOG2E_F 1.442695041f
335 #define CL_M_LOG10E_F 0.434294482f
336 #define CL_M_LN2_F 0.693147181f
337 #define CL_M_LN10_F 2.302585093f
338 #define CL_M_PI_F 3.141592654f
339 #define CL_M_PI_2_F 1.570796327f
340 #define CL_M_PI_4_F 0.785398163f
341 #define CL_M_1_PI_F 0.318309886f
342 #define CL_M_2_PI_F 0.636619772f
343 #define CL_M_2_SQRTPI_F 1.128379167f
344 #define CL_M_SQRT2_F 1.414213562f
345 #define CL_M_SQRT1_2_F 0.707106781f
346
347 #if defined( __GNUC__ )
348 #define CL_HUGE_VALF __builtin_huge_valf()
349 #define CL_HUGE_VAL __builtin_huge_val()
350 #define CL_NAN __builtin_nanf( "" )
351 #else
352 #define CL_HUGE_VALF ((cl_float) 1e50)
353 #define CL_HUGE_VAL ((cl_double) 1e500)
354 float nanf( const char * );
355 #define CL_NAN nanf( "" )
356 #endif
357 #define CL_MAXFLOAT CL_FLT_MAX
358 #define CL_INFINITY CL_HUGE_VALF
359
360 #endif
361
362 #include <stddef.h>
363
364 /*
365 * Vector types
366 *
367 * Note: OpenCL requires that all types be naturally aligned.
368 * This means that vector types must be naturally aligned.
369 * For example, a vector of four floats must be aligned to
370 * a 16 byte boundary (calculated as 4 * the natural 4-byte
371 * alignment of the float). The alignment qualifiers here
372 * will only function properly if your compiler supports them
373 * and if you don't actively work to defeat them. For example,
374 * in order for a cl_float4 to be 16 byte aligned in a struct,
375 * the start of the struct must itself be 16-byte aligned.
376 *
377 * Maintaining proper alignment is the user's responsibility.
378 */
379
380 /* Define basic vector types */
381 #if defined( __VEC__ )
382 #if !defined(__clang__)
383 #include <altivec.h> /* may be omitted depending on compiler. AltiVec spec provides no way to detect whether the header is required. */
384 #endif
385 typedef __vector unsigned char __cl_uchar16;
386 typedef __vector signed char __cl_char16;
387 typedef __vector unsigned short __cl_ushort8;
388 typedef __vector signed short __cl_short8;
389 typedef __vector unsigned int __cl_uint4;
390 typedef __vector signed int __cl_int4;
391 typedef __vector float __cl_float4;
392 #define __CL_UCHAR16__ 1
393 #define __CL_CHAR16__ 1
394 #define __CL_USHORT8__ 1
395 #define __CL_SHORT8__ 1
396 #define __CL_UINT4__ 1
397 #define __CL_INT4__ 1
398 #define __CL_FLOAT4__ 1
399 #endif
400
401 #if defined( __SSE__ )
402 #if defined( __MINGW64__ )
403 #include <intrin.h>
404 #else
405 #include <xmmintrin.h>
406 #endif
407 #if defined( __GNUC__ )
408 typedef float __cl_float4 __attribute__((vector_size(16)));
409 #else
410 typedef __m128 __cl_float4;
411 #endif
412 #define __CL_FLOAT4__ 1
413 #endif
414
415 #if defined( __SSE2__ )
416 #if defined( __MINGW64__ )
417 #include <intrin.h>
418 #else
419 #include <emmintrin.h>
420 #endif
421 #if defined( __GNUC__ )
422 typedef cl_uchar __cl_uchar16 __attribute__((vector_size(16)));
423 typedef cl_char __cl_char16 __attribute__((vector_size(16)));
424 typedef cl_ushort __cl_ushort8 __attribute__((vector_size(16)));
425 typedef cl_short __cl_short8 __attribute__((vector_size(16)));
426 typedef cl_uint __cl_uint4 __attribute__((vector_size(16)));
427 typedef cl_int __cl_int4 __attribute__((vector_size(16)));
428 typedef cl_ulong __cl_ulong2 __attribute__((vector_size(16)));
429 typedef cl_long __cl_long2 __attribute__((vector_size(16)));
430 typedef cl_double __cl_double2 __attribute__((vector_size(16)));
431 #else
432 typedef __m128i __cl_uchar16;
433 typedef __m128i __cl_char16;
434 typedef __m128i __cl_ushort8;
435 typedef __m128i __cl_short8;
436 typedef __m128i __cl_uint4;
437 typedef __m128i __cl_int4;
438 typedef __m128i __cl_ulong2;
439 typedef __m128i __cl_long2;
440 typedef __m128d __cl_double2;
441 #endif
442 #define __CL_UCHAR16__ 1
443 #define __CL_CHAR16__ 1
444 #define __CL_USHORT8__ 1
445 #define __CL_SHORT8__ 1
446 #define __CL_INT4__ 1
447 #define __CL_UINT4__ 1
448 #define __CL_ULONG2__ 1
449 #define __CL_LONG2__ 1
450 #define __CL_DOUBLE2__ 1
451 #endif
452
453 #if defined( __MMX__ )
454 #include <mmintrin.h>
455 #if defined( __GNUC__ )
456 typedef cl_uchar __cl_uchar8 __attribute__((vector_size(8)));
457 typedef cl_char __cl_char8 __attribute__((vector_size(8)));
458 typedef cl_ushort __cl_ushort4 __attribute__((vector_size(8)));
459 typedef cl_short __cl_short4 __attribute__((vector_size(8)));
460 typedef cl_uint __cl_uint2 __attribute__((vector_size(8)));
461 typedef cl_int __cl_int2 __attribute__((vector_size(8)));
462 typedef cl_ulong __cl_ulong1 __attribute__((vector_size(8)));
463 typedef cl_long __cl_long1 __attribute__((vector_size(8)));
464 typedef cl_float __cl_float2 __attribute__((vector_size(8)));
465 #else
466 typedef __m64 __cl_uchar8;
467 typedef __m64 __cl_char8;
468 typedef __m64 __cl_ushort4;
469 typedef __m64 __cl_short4;
470 typedef __m64 __cl_uint2;
471 typedef __m64 __cl_int2;
472 typedef __m64 __cl_ulong1;
473 typedef __m64 __cl_long1;
474 typedef __m64 __cl_float2;
475 #endif
476 #define __CL_UCHAR8__ 1
477 #define __CL_CHAR8__ 1
478 #define __CL_USHORT4__ 1
479 #define __CL_SHORT4__ 1
480 #define __CL_INT2__ 1
481 #define __CL_UINT2__ 1
482 #define __CL_ULONG1__ 1
483 #define __CL_LONG1__ 1
484 #define __CL_FLOAT2__ 1
485 #endif
486
487 #if defined( __AVX__ )
488 #if defined( __MINGW64__ )
489 #include <intrin.h>
490 #else
491 #include <immintrin.h>
492 #endif
493 #if defined( __GNUC__ )
494 typedef cl_float __cl_float8 __attribute__((vector_size(32)));
495 typedef cl_double __cl_double4 __attribute__((vector_size(32)));
496 #else
497 typedef __m256 __cl_float8;
498 typedef __m256d __cl_double4;
499 #endif
500 #define __CL_FLOAT8__ 1
501 #define __CL_DOUBLE4__ 1
502 #endif
503
504 /* Define capabilities for anonymous struct members. */
505 #if !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
506 #define __CL_HAS_ANON_STRUCT__ 1
507 #define __CL_ANON_STRUCT__
508 #elif defined(_WIN32) && defined(_MSC_VER) && !defined(__STDC__)
509 #define __CL_HAS_ANON_STRUCT__ 1
510 #define __CL_ANON_STRUCT__
511 #elif defined(__GNUC__) && ! defined(__STRICT_ANSI__)
512 #define __CL_HAS_ANON_STRUCT__ 1
513 #define __CL_ANON_STRUCT__ __extension__
514 #elif defined(__clang__)
515 #define __CL_HAS_ANON_STRUCT__ 1
516 #define __CL_ANON_STRUCT__ __extension__
517 #else
518 #define __CL_HAS_ANON_STRUCT__ 0
519 #define __CL_ANON_STRUCT__
520 #endif
521
522 /* Define capabilities for anonymous union members. */
523 #if defined(__cplusplus) && __cplusplus >= 201103L
524 #define __CL_HAS_ANON_UNION__ 1
525 #define __CL_ANON_UNION__
526 #else
527 /* Follow anonymous struct logic */
528 #define __CL_HAS_ANON_UNION__ __CL_HAS_ANON_STRUCT__
529 #define __CL_ANON_UNION__ __CL_ANON_STRUCT__
530 #endif
531
532 #if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__
533 /* Disable warning C4201: nonstandard extension used : nameless struct/union */
534 #pragma warning( push )
535 #pragma warning( disable : 4201 )
536 #endif
537
538 /* Define alignment keys */
539 #if defined( __GNUC__ ) || defined(__INTEGRITY)
540 #define CL_ALIGNED(_x) __attribute__ ((aligned(_x)))
541 #elif defined( _WIN32) && (_MSC_VER)
542 /* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements */
543 /* http://msdn.microsoft.com/en-us/library/373ak2y1%28VS.71%29.aspx */
544 /* #include <crtdefs.h> */
545 /* #define CL_ALIGNED(_x) _CRT_ALIGN(_x) */
546 #define CL_ALIGNED(_x)
547 #else
548 #warning Need to implement some method to align data here
549 #define CL_ALIGNED(_x)
550 #endif
551
552 /* Indicate whether .xyzw, .s0123 and .hi.lo are supported */
553 #if __CL_HAS_ANON_STRUCT__
554 /* .xyzw and .s0123...{f|F} are supported */
555 #define CL_HAS_NAMED_VECTOR_FIELDS 1
556 /* .hi and .lo are supported */
557 #define CL_HAS_HI_LO_VECTOR_FIELDS 1
558 #endif
559
560 /* Define cl_vector types */
561
562 /* ---- cl_charn ---- */
563 typedef union
564 {
565 cl_char CL_ALIGNED(2) s[2];
566 #if __CL_HAS_ANON_STRUCT__
567 __CL_ANON_STRUCT__ struct{ cl_char x, y; };
568 __CL_ANON_STRUCT__ struct{ cl_char s0, s1; };
569 __CL_ANON_STRUCT__ struct{ cl_char lo, hi; };
570 #endif
571 #if defined( __CL_CHAR2__)
572 __cl_char2 v2;
573 #endif
574 }cl_char2;
575
576 typedef union
577 {
578 cl_char CL_ALIGNED(4) s[4];
579 #if __CL_HAS_ANON_STRUCT__
580 __CL_ANON_STRUCT__ struct{ cl_char x, y, z, w; };
581 __CL_ANON_STRUCT__ struct{ cl_char s0, s1, s2, s3; };
582 __CL_ANON_STRUCT__ struct{ cl_char2 lo, hi; };
583 #endif
584 #if defined( __CL_CHAR2__)
585 __cl_char2 v2[2];
586 #endif
587 #if defined( __CL_CHAR4__)
588 __cl_char4 v4;
589 #endif
590 }cl_char4;
591
592 /* cl_char3 is identical in size, alignment and behavior to cl_char4. See section 6.1.5. */
593 typedef cl_char4 cl_char3;
594
595 typedef union
596 {
597 cl_char CL_ALIGNED(8) s[8];
598 #if __CL_HAS_ANON_STRUCT__
599 __CL_ANON_STRUCT__ struct{ cl_char x, y, z, w; };
600 __CL_ANON_STRUCT__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7; };
601 __CL_ANON_STRUCT__ struct{ cl_char4 lo, hi; };
602 #endif
603 #if defined( __CL_CHAR2__)
604 __cl_char2 v2[4];
605 #endif
606 #if defined( __CL_CHAR4__)
607 __cl_char4 v4[2];
608 #endif
609 #if defined( __CL_CHAR8__ )
610 __cl_char8 v8;
611 #endif
612 }cl_char8;
613
614 typedef union
615 {
616 cl_char CL_ALIGNED(16) s[16];
617 #if __CL_HAS_ANON_STRUCT__
618 __CL_ANON_STRUCT__ struct{ cl_char x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
619 __CL_ANON_STRUCT__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
620 __CL_ANON_STRUCT__ struct{ cl_char8 lo, hi; };
621 #endif
622 #if defined( __CL_CHAR2__)
623 __cl_char2 v2[8];
624 #endif
625 #if defined( __CL_CHAR4__)
626 __cl_char4 v4[4];
627 #endif
628 #if defined( __CL_CHAR8__ )
629 __cl_char8 v8[2];
630 #endif
631 #if defined( __CL_CHAR16__ )
632 __cl_char16 v16;
633 #endif
634 }cl_char16;
635
636
637 /* ---- cl_ucharn ---- */
638 typedef union
639 {
640 cl_uchar CL_ALIGNED(2) s[2];
641 #if __CL_HAS_ANON_STRUCT__
642 __CL_ANON_STRUCT__ struct{ cl_uchar x, y; };
643 __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1; };
644 __CL_ANON_STRUCT__ struct{ cl_uchar lo, hi; };
645 #endif
646 #if defined( __cl_uchar2__)
647 __cl_uchar2 v2;
648 #endif
649 }cl_uchar2;
650
651 typedef union
652 {
653 cl_uchar CL_ALIGNED(4) s[4];
654 #if __CL_HAS_ANON_STRUCT__
655 __CL_ANON_STRUCT__ struct{ cl_uchar x, y, z, w; };
656 __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1, s2, s3; };
657 __CL_ANON_STRUCT__ struct{ cl_uchar2 lo, hi; };
658 #endif
659 #if defined( __CL_UCHAR2__)
660 __cl_uchar2 v2[2];
661 #endif
662 #if defined( __CL_UCHAR4__)
663 __cl_uchar4 v4;
664 #endif
665 }cl_uchar4;
666
667 /* cl_uchar3 is identical in size, alignment and behavior to cl_uchar4. See section 6.1.5. */
668 typedef cl_uchar4 cl_uchar3;
669
670 typedef union
671 {
672 cl_uchar CL_ALIGNED(8) s[8];
673 #if __CL_HAS_ANON_STRUCT__
674 __CL_ANON_STRUCT__ struct{ cl_uchar x, y, z, w; };
675 __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7; };
676 __CL_ANON_STRUCT__ struct{ cl_uchar4 lo, hi; };
677 #endif
678 #if defined( __CL_UCHAR2__)
679 __cl_uchar2 v2[4];
680 #endif
681 #if defined( __CL_UCHAR4__)
682 __cl_uchar4 v4[2];
683 #endif
684 #if defined( __CL_UCHAR8__ )
685 __cl_uchar8 v8;
686 #endif
687 }cl_uchar8;
688
689 typedef union
690 {
691 cl_uchar CL_ALIGNED(16) s[16];
692 #if __CL_HAS_ANON_STRUCT__
693 __CL_ANON_STRUCT__ struct{ cl_uchar x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
694 __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
695 __CL_ANON_STRUCT__ struct{ cl_uchar8 lo, hi; };
696 #endif
697 #if defined( __CL_UCHAR2__)
698 __cl_uchar2 v2[8];
699 #endif
700 #if defined( __CL_UCHAR4__)
701 __cl_uchar4 v4[4];
702 #endif
703 #if defined( __CL_UCHAR8__ )
704 __cl_uchar8 v8[2];
705 #endif
706 #if defined( __CL_UCHAR16__ )
707 __cl_uchar16 v16;
708 #endif
709 }cl_uchar16;
710
711
712 /* ---- cl_shortn ---- */
713 typedef union
714 {
715 cl_short CL_ALIGNED(4) s[2];
716 #if __CL_HAS_ANON_STRUCT__
717 __CL_ANON_STRUCT__ struct{ cl_short x, y; };
718 __CL_ANON_STRUCT__ struct{ cl_short s0, s1; };
719 __CL_ANON_STRUCT__ struct{ cl_short lo, hi; };
720 #endif
721 #if defined( __CL_SHORT2__)
722 __cl_short2 v2;
723 #endif
724 }cl_short2;
725
726 typedef union
727 {
728 cl_short CL_ALIGNED(8) s[4];
729 #if __CL_HAS_ANON_STRUCT__
730 __CL_ANON_STRUCT__ struct{ cl_short x, y, z, w; };
731 __CL_ANON_STRUCT__ struct{ cl_short s0, s1, s2, s3; };
732 __CL_ANON_STRUCT__ struct{ cl_short2 lo, hi; };
733 #endif
734 #if defined( __CL_SHORT2__)
735 __cl_short2 v2[2];
736 #endif
737 #if defined( __CL_SHORT4__)
738 __cl_short4 v4;
739 #endif
740 }cl_short4;
741
742 /* cl_short3 is identical in size, alignment and behavior to cl_short4. See section 6.1.5. */
743 typedef cl_short4 cl_short3;
744
745 typedef union
746 {
747 cl_short CL_ALIGNED(16) s[8];
748 #if __CL_HAS_ANON_STRUCT__
749 __CL_ANON_STRUCT__ struct{ cl_short x, y, z, w; };
750 __CL_ANON_STRUCT__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7; };
751 __CL_ANON_STRUCT__ struct{ cl_short4 lo, hi; };
752 #endif
753 #if defined( __CL_SHORT2__)
754 __cl_short2 v2[4];
755 #endif
756 #if defined( __CL_SHORT4__)
757 __cl_short4 v4[2];
758 #endif
759 #if defined( __CL_SHORT8__ )
760 __cl_short8 v8;
761 #endif
762 }cl_short8;
763
764 typedef union
765 {
766 cl_short CL_ALIGNED(32) s[16];
767 #if __CL_HAS_ANON_STRUCT__
768 __CL_ANON_STRUCT__ struct{ cl_short x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
769 __CL_ANON_STRUCT__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
770 __CL_ANON_STRUCT__ struct{ cl_short8 lo, hi; };
771 #endif
772 #if defined( __CL_SHORT2__)
773 __cl_short2 v2[8];
774 #endif
775 #if defined( __CL_SHORT4__)
776 __cl_short4 v4[4];
777 #endif
778 #if defined( __CL_SHORT8__ )
779 __cl_short8 v8[2];
780 #endif
781 #if defined( __CL_SHORT16__ )
782 __cl_short16 v16;
783 #endif
784 }cl_short16;
785
786
787 /* ---- cl_ushortn ---- */
788 typedef union
789 {
790 cl_ushort CL_ALIGNED(4) s[2];
791 #if __CL_HAS_ANON_STRUCT__
792 __CL_ANON_STRUCT__ struct{ cl_ushort x, y; };
793 __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1; };
794 __CL_ANON_STRUCT__ struct{ cl_ushort lo, hi; };
795 #endif
796 #if defined( __CL_USHORT2__)
797 __cl_ushort2 v2;
798 #endif
799 }cl_ushort2;
800
801 typedef union
802 {
803 cl_ushort CL_ALIGNED(8) s[4];
804 #if __CL_HAS_ANON_STRUCT__
805 __CL_ANON_STRUCT__ struct{ cl_ushort x, y, z, w; };
806 __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1, s2, s3; };
807 __CL_ANON_STRUCT__ struct{ cl_ushort2 lo, hi; };
808 #endif
809 #if defined( __CL_USHORT2__)
810 __cl_ushort2 v2[2];
811 #endif
812 #if defined( __CL_USHORT4__)
813 __cl_ushort4 v4;
814 #endif
815 }cl_ushort4;
816
817 /* cl_ushort3 is identical in size, alignment and behavior to cl_ushort4. See section 6.1.5. */
818 typedef cl_ushort4 cl_ushort3;
819
820 typedef union
821 {
822 cl_ushort CL_ALIGNED(16) s[8];
823 #if __CL_HAS_ANON_STRUCT__
824 __CL_ANON_STRUCT__ struct{ cl_ushort x, y, z, w; };
825 __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7; };
826 __CL_ANON_STRUCT__ struct{ cl_ushort4 lo, hi; };
827 #endif
828 #if defined( __CL_USHORT2__)
829 __cl_ushort2 v2[4];
830 #endif
831 #if defined( __CL_USHORT4__)
832 __cl_ushort4 v4[2];
833 #endif
834 #if defined( __CL_USHORT8__ )
835 __cl_ushort8 v8;
836 #endif
837 }cl_ushort8;
838
839 typedef union
840 {
841 cl_ushort CL_ALIGNED(32) s[16];
842 #if __CL_HAS_ANON_STRUCT__
843 __CL_ANON_STRUCT__ struct{ cl_ushort x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
844 __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
845 __CL_ANON_STRUCT__ struct{ cl_ushort8 lo, hi; };
846 #endif
847 #if defined( __CL_USHORT2__)
848 __cl_ushort2 v2[8];
849 #endif
850 #if defined( __CL_USHORT4__)
851 __cl_ushort4 v4[4];
852 #endif
853 #if defined( __CL_USHORT8__ )
854 __cl_ushort8 v8[2];
855 #endif
856 #if defined( __CL_USHORT16__ )
857 __cl_ushort16 v16;
858 #endif
859 }cl_ushort16;
860
861
862 /* ---- cl_halfn ---- */
863 typedef union
864 {
865 cl_half CL_ALIGNED(4) s[2];
866 #if __CL_HAS_ANON_STRUCT__
867 __CL_ANON_STRUCT__ struct{ cl_half x, y; };
868 __CL_ANON_STRUCT__ struct{ cl_half s0, s1; };
869 __CL_ANON_STRUCT__ struct{ cl_half lo, hi; };
870 #endif
871 #if defined( __CL_HALF2__)
872 __cl_half2 v2;
873 #endif
874 }cl_half2;
875
876 typedef union
877 {
878 cl_half CL_ALIGNED(8) s[4];
879 #if __CL_HAS_ANON_STRUCT__
880 __CL_ANON_STRUCT__ struct{ cl_half x, y, z, w; };
881 __CL_ANON_STRUCT__ struct{ cl_half s0, s1, s2, s3; };
882 __CL_ANON_STRUCT__ struct{ cl_half2 lo, hi; };
883 #endif
884 #if defined( __CL_HALF2__)
885 __cl_half2 v2[2];
886 #endif
887 #if defined( __CL_HALF4__)
888 __cl_half4 v4;
889 #endif
890 }cl_half4;
891
892 /* cl_half3 is identical in size, alignment and behavior to cl_half4. See section 6.1.5. */
893 typedef cl_half4 cl_half3;
894
895 typedef union
896 {
897 cl_half CL_ALIGNED(16) s[8];
898 #if __CL_HAS_ANON_STRUCT__
899 __CL_ANON_STRUCT__ struct{ cl_half x, y, z, w; };
900 __CL_ANON_STRUCT__ struct{ cl_half s0, s1, s2, s3, s4, s5, s6, s7; };
901 __CL_ANON_STRUCT__ struct{ cl_half4 lo, hi; };
902 #endif
903 #if defined( __CL_HALF2__)
904 __cl_half2 v2[4];
905 #endif
906 #if defined( __CL_HALF4__)
907 __cl_half4 v4[2];
908 #endif
909 #if defined( __CL_HALF8__ )
910 __cl_half8 v8;
911 #endif
912 }cl_half8;
913
914 typedef union
915 {
916 cl_half CL_ALIGNED(32) s[16];
917 #if __CL_HAS_ANON_STRUCT__
918 __CL_ANON_STRUCT__ struct{ cl_half x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
919 __CL_ANON_STRUCT__ struct{ cl_half s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
920 __CL_ANON_STRUCT__ struct{ cl_half8 lo, hi; };
921 #endif
922 #if defined( __CL_HALF2__)
923 __cl_half2 v2[8];
924 #endif
925 #if defined( __CL_HALF4__)
926 __cl_half4 v4[4];
927 #endif
928 #if defined( __CL_HALF8__ )
929 __cl_half8 v8[2];
930 #endif
931 #if defined( __CL_HALF16__ )
932 __cl_half16 v16;
933 #endif
934 }cl_half16;
935
936 /* ---- cl_intn ---- */
937 typedef union
938 {
939 cl_int CL_ALIGNED(8) s[2];
940 #if __CL_HAS_ANON_STRUCT__
941 __CL_ANON_STRUCT__ struct{ cl_int x, y; };
942 __CL_ANON_STRUCT__ struct{ cl_int s0, s1; };
943 __CL_ANON_STRUCT__ struct{ cl_int lo, hi; };
944 #endif
945 #if defined( __CL_INT2__)
946 __cl_int2 v2;
947 #endif
948 }cl_int2;
949
950 typedef union
951 {
952 cl_int CL_ALIGNED(16) s[4];
953 #if __CL_HAS_ANON_STRUCT__
954 __CL_ANON_STRUCT__ struct{ cl_int x, y, z, w; };
955 __CL_ANON_STRUCT__ struct{ cl_int s0, s1, s2, s3; };
956 __CL_ANON_STRUCT__ struct{ cl_int2 lo, hi; };
957 #endif
958 #if defined( __CL_INT2__)
959 __cl_int2 v2[2];
960 #endif
961 #if defined( __CL_INT4__)
962 __cl_int4 v4;
963 #endif
964 }cl_int4;
965
966 /* cl_int3 is identical in size, alignment and behavior to cl_int4. See section 6.1.5. */
967 typedef cl_int4 cl_int3;
968
969 typedef union
970 {
971 cl_int CL_ALIGNED(32) s[8];
972 #if __CL_HAS_ANON_STRUCT__
973 __CL_ANON_STRUCT__ struct{ cl_int x, y, z, w; };
974 __CL_ANON_STRUCT__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7; };
975 __CL_ANON_STRUCT__ struct{ cl_int4 lo, hi; };
976 #endif
977 #if defined( __CL_INT2__)
978 __cl_int2 v2[4];
979 #endif
980 #if defined( __CL_INT4__)
981 __cl_int4 v4[2];
982 #endif
983 #if defined( __CL_INT8__ )
984 __cl_int8 v8;
985 #endif
986 }cl_int8;
987
988 typedef union
989 {
990 cl_int CL_ALIGNED(64) s[16];
991 #if __CL_HAS_ANON_STRUCT__
992 __CL_ANON_STRUCT__ struct{ cl_int x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
993 __CL_ANON_STRUCT__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
994 __CL_ANON_STRUCT__ struct{ cl_int8 lo, hi; };
995 #endif
996 #if defined( __CL_INT2__)
997 __cl_int2 v2[8];
998 #endif
999 #if defined( __CL_INT4__)
1000 __cl_int4 v4[4];
1001 #endif
1002 #if defined( __CL_INT8__ )
1003 __cl_int8 v8[2];
1004 #endif
1005 #if defined( __CL_INT16__ )
1006 __cl_int16 v16;
1007 #endif
1008 }cl_int16;
1009
1010
1011 /* ---- cl_uintn ---- */
1012 typedef union
1013 {
1014 cl_uint CL_ALIGNED(8) s[2];
1015 #if __CL_HAS_ANON_STRUCT__
1016 __CL_ANON_STRUCT__ struct{ cl_uint x, y; };
1017 __CL_ANON_STRUCT__ struct{ cl_uint s0, s1; };
1018 __CL_ANON_STRUCT__ struct{ cl_uint lo, hi; };
1019 #endif
1020 #if defined( __CL_UINT2__)
1021 __cl_uint2 v2;
1022 #endif
1023 }cl_uint2;
1024
1025 typedef union
1026 {
1027 cl_uint CL_ALIGNED(16) s[4];
1028 #if __CL_HAS_ANON_STRUCT__
1029 __CL_ANON_STRUCT__ struct{ cl_uint x, y, z, w; };
1030 __CL_ANON_STRUCT__ struct{ cl_uint s0, s1, s2, s3; };
1031 __CL_ANON_STRUCT__ struct{ cl_uint2 lo, hi; };
1032 #endif
1033 #if defined( __CL_UINT2__)
1034 __cl_uint2 v2[2];
1035 #endif
1036 #if defined( __CL_UINT4__)
1037 __cl_uint4 v4;
1038 #endif
1039 }cl_uint4;
1040
1041 /* cl_uint3 is identical in size, alignment and behavior to cl_uint4. See section 6.1.5. */
1042 typedef cl_uint4 cl_uint3;
1043
1044 typedef union
1045 {
1046 cl_uint CL_ALIGNED(32) s[8];
1047 #if __CL_HAS_ANON_STRUCT__
1048 __CL_ANON_STRUCT__ struct{ cl_uint x, y, z, w; };
1049 __CL_ANON_STRUCT__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7; };
1050 __CL_ANON_STRUCT__ struct{ cl_uint4 lo, hi; };
1051 #endif
1052 #if defined( __CL_UINT2__)
1053 __cl_uint2 v2[4];
1054 #endif
1055 #if defined( __CL_UINT4__)
1056 __cl_uint4 v4[2];
1057 #endif
1058 #if defined( __CL_UINT8__ )
1059 __cl_uint8 v8;
1060 #endif
1061 }cl_uint8;
1062
1063 typedef union
1064 {
1065 cl_uint CL_ALIGNED(64) s[16];
1066 #if __CL_HAS_ANON_STRUCT__
1067 __CL_ANON_STRUCT__ struct{ cl_uint x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1068 __CL_ANON_STRUCT__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1069 __CL_ANON_STRUCT__ struct{ cl_uint8 lo, hi; };
1070 #endif
1071 #if defined( __CL_UINT2__)
1072 __cl_uint2 v2[8];
1073 #endif
1074 #if defined( __CL_UINT4__)
1075 __cl_uint4 v4[4];
1076 #endif
1077 #if defined( __CL_UINT8__ )
1078 __cl_uint8 v8[2];
1079 #endif
1080 #if defined( __CL_UINT16__ )
1081 __cl_uint16 v16;
1082 #endif
1083 }cl_uint16;
1084
1085 /* ---- cl_longn ---- */
1086 typedef union
1087 {
1088 cl_long CL_ALIGNED(16) s[2];
1089 #if __CL_HAS_ANON_STRUCT__
1090 __CL_ANON_STRUCT__ struct{ cl_long x, y; };
1091 __CL_ANON_STRUCT__ struct{ cl_long s0, s1; };
1092 __CL_ANON_STRUCT__ struct{ cl_long lo, hi; };
1093 #endif
1094 #if defined( __CL_LONG2__)
1095 __cl_long2 v2;
1096 #endif
1097 }cl_long2;
1098
1099 typedef union
1100 {
1101 cl_long CL_ALIGNED(32) s[4];
1102 #if __CL_HAS_ANON_STRUCT__
1103 __CL_ANON_STRUCT__ struct{ cl_long x, y, z, w; };
1104 __CL_ANON_STRUCT__ struct{ cl_long s0, s1, s2, s3; };
1105 __CL_ANON_STRUCT__ struct{ cl_long2 lo, hi; };
1106 #endif
1107 #if defined( __CL_LONG2__)
1108 __cl_long2 v2[2];
1109 #endif
1110 #if defined( __CL_LONG4__)
1111 __cl_long4 v4;
1112 #endif
1113 }cl_long4;
1114
1115 /* cl_long3 is identical in size, alignment and behavior to cl_long4. See section 6.1.5. */
1116 typedef cl_long4 cl_long3;
1117
1118 typedef union
1119 {
1120 cl_long CL_ALIGNED(64) s[8];
1121 #if __CL_HAS_ANON_STRUCT__
1122 __CL_ANON_STRUCT__ struct{ cl_long x, y, z, w; };
1123 __CL_ANON_STRUCT__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7; };
1124 __CL_ANON_STRUCT__ struct{ cl_long4 lo, hi; };
1125 #endif
1126 #if defined( __CL_LONG2__)
1127 __cl_long2 v2[4];
1128 #endif
1129 #if defined( __CL_LONG4__)
1130 __cl_long4 v4[2];
1131 #endif
1132 #if defined( __CL_LONG8__ )
1133 __cl_long8 v8;
1134 #endif
1135 }cl_long8;
1136
1137 typedef union
1138 {
1139 cl_long CL_ALIGNED(128) s[16];
1140 #if __CL_HAS_ANON_STRUCT__
1141 __CL_ANON_STRUCT__ struct{ cl_long x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1142 __CL_ANON_STRUCT__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1143 __CL_ANON_STRUCT__ struct{ cl_long8 lo, hi; };
1144 #endif
1145 #if defined( __CL_LONG2__)
1146 __cl_long2 v2[8];
1147 #endif
1148 #if defined( __CL_LONG4__)
1149 __cl_long4 v4[4];
1150 #endif
1151 #if defined( __CL_LONG8__ )
1152 __cl_long8 v8[2];
1153 #endif
1154 #if defined( __CL_LONG16__ )
1155 __cl_long16 v16;
1156 #endif
1157 }cl_long16;
1158
1159
1160 /* ---- cl_ulongn ---- */
1161 typedef union
1162 {
1163 cl_ulong CL_ALIGNED(16) s[2];
1164 #if __CL_HAS_ANON_STRUCT__
1165 __CL_ANON_STRUCT__ struct{ cl_ulong x, y; };
1166 __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1; };
1167 __CL_ANON_STRUCT__ struct{ cl_ulong lo, hi; };
1168 #endif
1169 #if defined( __CL_ULONG2__)
1170 __cl_ulong2 v2;
1171 #endif
1172 }cl_ulong2;
1173
1174 typedef union
1175 {
1176 cl_ulong CL_ALIGNED(32) s[4];
1177 #if __CL_HAS_ANON_STRUCT__
1178 __CL_ANON_STRUCT__ struct{ cl_ulong x, y, z, w; };
1179 __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1, s2, s3; };
1180 __CL_ANON_STRUCT__ struct{ cl_ulong2 lo, hi; };
1181 #endif
1182 #if defined( __CL_ULONG2__)
1183 __cl_ulong2 v2[2];
1184 #endif
1185 #if defined( __CL_ULONG4__)
1186 __cl_ulong4 v4;
1187 #endif
1188 }cl_ulong4;
1189
1190 /* cl_ulong3 is identical in size, alignment and behavior to cl_ulong4. See section 6.1.5. */
1191 typedef cl_ulong4 cl_ulong3;
1192
1193 typedef union
1194 {
1195 cl_ulong CL_ALIGNED(64) s[8];
1196 #if __CL_HAS_ANON_STRUCT__
1197 __CL_ANON_STRUCT__ struct{ cl_ulong x, y, z, w; };
1198 __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7; };
1199 __CL_ANON_STRUCT__ struct{ cl_ulong4 lo, hi; };
1200 #endif
1201 #if defined( __CL_ULONG2__)
1202 __cl_ulong2 v2[4];
1203 #endif
1204 #if defined( __CL_ULONG4__)
1205 __cl_ulong4 v4[2];
1206 #endif
1207 #if defined( __CL_ULONG8__ )
1208 __cl_ulong8 v8;
1209 #endif
1210 }cl_ulong8;
1211
1212 typedef union
1213 {
1214 cl_ulong CL_ALIGNED(128) s[16];
1215 #if __CL_HAS_ANON_STRUCT__
1216 __CL_ANON_STRUCT__ struct{ cl_ulong x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1217 __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1218 __CL_ANON_STRUCT__ struct{ cl_ulong8 lo, hi; };
1219 #endif
1220 #if defined( __CL_ULONG2__)
1221 __cl_ulong2 v2[8];
1222 #endif
1223 #if defined( __CL_ULONG4__)
1224 __cl_ulong4 v4[4];
1225 #endif
1226 #if defined( __CL_ULONG8__ )
1227 __cl_ulong8 v8[2];
1228 #endif
1229 #if defined( __CL_ULONG16__ )
1230 __cl_ulong16 v16;
1231 #endif
1232 }cl_ulong16;
1233
1234
1235 /* --- cl_floatn ---- */
1236
1237 typedef union
1238 {
1239 cl_float CL_ALIGNED(8) s[2];
1240 #if __CL_HAS_ANON_STRUCT__
1241 __CL_ANON_STRUCT__ struct{ cl_float x, y; };
1242 __CL_ANON_STRUCT__ struct{ cl_float s0, s1; };
1243 __CL_ANON_STRUCT__ struct{ cl_float lo, hi; };
1244 #endif
1245 #if defined( __CL_FLOAT2__)
1246 __cl_float2 v2;
1247 #endif
1248 }cl_float2;
1249
1250 typedef union
1251 {
1252 cl_float CL_ALIGNED(16) s[4];
1253 #if __CL_HAS_ANON_STRUCT__
1254 __CL_ANON_STRUCT__ struct{ cl_float x, y, z, w; };
1255 __CL_ANON_STRUCT__ struct{ cl_float s0, s1, s2, s3; };
1256 __CL_ANON_STRUCT__ struct{ cl_float2 lo, hi; };
1257 #endif
1258 #if defined( __CL_FLOAT2__)
1259 __cl_float2 v2[2];
1260 #endif
1261 #if defined( __CL_FLOAT4__)
1262 __cl_float4 v4;
1263 #endif
1264 }cl_float4;
1265
1266 /* cl_float3 is identical in size, alignment and behavior to cl_float4. See section 6.1.5. */
1267 typedef cl_float4 cl_float3;
1268
1269 typedef union
1270 {
1271 cl_float CL_ALIGNED(32) s[8];
1272 #if __CL_HAS_ANON_STRUCT__
1273 __CL_ANON_STRUCT__ struct{ cl_float x, y, z, w; };
1274 __CL_ANON_STRUCT__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7; };
1275 __CL_ANON_STRUCT__ struct{ cl_float4 lo, hi; };
1276 #endif
1277 #if defined( __CL_FLOAT2__)
1278 __cl_float2 v2[4];
1279 #endif
1280 #if defined( __CL_FLOAT4__)
1281 __cl_float4 v4[2];
1282 #endif
1283 #if defined( __CL_FLOAT8__ )
1284 __cl_float8 v8;
1285 #endif
1286 }cl_float8;
1287
1288 typedef union
1289 {
1290 cl_float CL_ALIGNED(64) s[16];
1291 #if __CL_HAS_ANON_STRUCT__
1292 __CL_ANON_STRUCT__ struct{ cl_float x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1293 __CL_ANON_STRUCT__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1294 __CL_ANON_STRUCT__ struct{ cl_float8 lo, hi; };
1295 #endif
1296 #if defined( __CL_FLOAT2__)
1297 __cl_float2 v2[8];
1298 #endif
1299 #if defined( __CL_FLOAT4__)
1300 __cl_float4 v4[4];
1301 #endif
1302 #if defined( __CL_FLOAT8__ )
1303 __cl_float8 v8[2];
1304 #endif
1305 #if defined( __CL_FLOAT16__ )
1306 __cl_float16 v16;
1307 #endif
1308 }cl_float16;
1309
1310 /* --- cl_doublen ---- */
1311
1312 typedef union
1313 {
1314 cl_double CL_ALIGNED(16) s[2];
1315 #if __CL_HAS_ANON_STRUCT__
1316 __CL_ANON_STRUCT__ struct{ cl_double x, y; };
1317 __CL_ANON_STRUCT__ struct{ cl_double s0, s1; };
1318 __CL_ANON_STRUCT__ struct{ cl_double lo, hi; };
1319 #endif
1320 #if defined( __CL_DOUBLE2__)
1321 __cl_double2 v2;
1322 #endif
1323 }cl_double2;
1324
1325 typedef union
1326 {
1327 cl_double CL_ALIGNED(32) s[4];
1328 #if __CL_HAS_ANON_STRUCT__
1329 __CL_ANON_STRUCT__ struct{ cl_double x, y, z, w; };
1330 __CL_ANON_STRUCT__ struct{ cl_double s0, s1, s2, s3; };
1331 __CL_ANON_STRUCT__ struct{ cl_double2 lo, hi; };
1332 #endif
1333 #if defined( __CL_DOUBLE2__)
1334 __cl_double2 v2[2];
1335 #endif
1336 #if defined( __CL_DOUBLE4__)
1337 __cl_double4 v4;
1338 #endif
1339 }cl_double4;
1340
1341 /* cl_double3 is identical in size, alignment and behavior to cl_double4. See section 6.1.5. */
1342 typedef cl_double4 cl_double3;
1343
1344 typedef union
1345 {
1346 cl_double CL_ALIGNED(64) s[8];
1347 #if __CL_HAS_ANON_STRUCT__
1348 __CL_ANON_STRUCT__ struct{ cl_double x, y, z, w; };
1349 __CL_ANON_STRUCT__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7; };
1350 __CL_ANON_STRUCT__ struct{ cl_double4 lo, hi; };
1351 #endif
1352 #if defined( __CL_DOUBLE2__)
1353 __cl_double2 v2[4];
1354 #endif
1355 #if defined( __CL_DOUBLE4__)
1356 __cl_double4 v4[2];
1357 #endif
1358 #if defined( __CL_DOUBLE8__ )
1359 __cl_double8 v8;
1360 #endif
1361 }cl_double8;
1362
1363 typedef union
1364 {
1365 cl_double CL_ALIGNED(128) s[16];
1366 #if __CL_HAS_ANON_STRUCT__
1367 __CL_ANON_STRUCT__ struct{ cl_double x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1368 __CL_ANON_STRUCT__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1369 __CL_ANON_STRUCT__ struct{ cl_double8 lo, hi; };
1370 #endif
1371 #if defined( __CL_DOUBLE2__)
1372 __cl_double2 v2[8];
1373 #endif
1374 #if defined( __CL_DOUBLE4__)
1375 __cl_double4 v4[4];
1376 #endif
1377 #if defined( __CL_DOUBLE8__ )
1378 __cl_double8 v8[2];
1379 #endif
1380 #if defined( __CL_DOUBLE16__ )
1381 __cl_double16 v16;
1382 #endif
1383 }cl_double16;
1384
1385 /* Macro to facilitate debugging
1386 * Usage:
1387 * Place CL_PROGRAM_STRING_DEBUG_INFO on the line before the first line of your source.
1388 * The first line ends with: CL_PROGRAM_STRING_DEBUG_INFO \"
1389 * Each line thereafter of OpenCL C source must end with: \n\
1390 * The last line ends in ";
1391 *
1392 * Example:
1393 *
1394 * const char *my_program = CL_PROGRAM_STRING_DEBUG_INFO "\
1395 * kernel void foo( int a, float * b ) \n\
1396 * { \n\
1397 * // my comment \n\
1398 * *b[ get_global_id(0)] = a; \n\
1399 * } \n\
1400 * ";
1401 *
1402 * This should correctly set up the line, (column) and file information for your source
1403 * string so you can do source level debugging.
1404 */
1405 #define __CL_STRINGIFY( _x ) # _x
1406 #define _CL_STRINGIFY( _x ) __CL_STRINGIFY( _x )
1407 #define CL_PROGRAM_STRING_DEBUG_INFO "#line " _CL_STRINGIFY(__LINE__) " \"" __FILE__ "\" \n\n"
1408
1409 #ifdef __cplusplus
1410 }
1411 #endif
1412
1413 #if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__
1414 #pragma warning( pop )
1415 #endif
1416
1417 #endif /* __CL_PLATFORM_H */