Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
52867 views
1
/**********************************************************************************
2
* Copyright (c) 2008-2012 The Khronos Group Inc.
3
*
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:
11
*
12
* The above copyright notice and this permission notice shall be included
13
* in all copies or substantial portions of the Materials.
14
*
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
**********************************************************************************/
23
24
/* $Revision: 11803 $ on $Date: 2010-06-25 10:02:12 -0700 (Fri, 25 Jun 2010) $ */
25
26
#ifndef __CL_PLATFORM_H
27
#define __CL_PLATFORM_H
28
29
#ifdef __APPLE__
30
/* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER below */
31
#include <AvailabilityMacros.h>
32
#endif
33
34
#ifdef __cplusplus
35
extern "C" {
36
#endif
37
38
#if defined(_WIN32)
39
#define CL_API_ENTRY
40
#define CL_API_CALL __stdcall
41
#define CL_CALLBACK __stdcall
42
#else
43
#define CL_API_ENTRY
44
#define CL_API_CALL
45
#define CL_CALLBACK
46
#endif
47
48
#ifdef __APPLE__
49
#define CL_EXTENSION_WEAK_LINK __attribute__((weak_import))
50
#ifndef UNAVAILABLE_ATTRIBUTE
51
#define UNAVAILABLE_ATTRIBUTE
52
#endif
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
56
#else
57
#define CL_API_SUFFIX__VERSION_1_0 UNAVAILABLE_ATTRIBUTE
58
#define CL_EXT_SUFFIX__VERSION_1_0 CL_EXTENSION_WEAK_LINK UNAVAILABLE_ATTRIBUTE
59
#endif
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
65
#else
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
70
#endif
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
77
#else
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
83
#endif
84
#else
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
92
93
#ifdef __GNUC__
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
97
#else
98
#define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED __attribute__((deprecated))
99
#define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
100
#endif
101
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
105
#else
106
#define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED __attribute__((deprecated))
107
#define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
108
#endif
109
#elif _WIN32
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
113
#else
114
#define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
115
#define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED __declspec(deprecated)
116
#endif
117
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
121
#else
122
#define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
123
#define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED __declspec(deprecated)
124
#endif
125
#else
126
#define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
127
#define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
128
129
#define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
130
#define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
131
#endif
132
#endif
133
134
#if (defined (_WIN32) && defined(_MSC_VER))
135
136
/* scalar types */
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;
145
146
typedef unsigned __int16 cl_half;
147
typedef float cl_float;
148
typedef double cl_double;
149
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)
166
167
#define CL_FLT_DIG 6
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
177
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
188
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
202
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
216
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
222
223
#else
224
225
#include <stdint.h>
226
227
/* scalar types */
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)));
236
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)));
240
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)
257
258
#define CL_FLT_DIG 6
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
268
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
279
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
293
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
307
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( "" )
312
#else
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( "" )
317
#endif
318
#define CL_MAXFLOAT CL_FLT_MAX
319
#define CL_INFINITY CL_HUGE_VALF
320
321
#endif
322
323
#include <stddef.h>
324
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;
329
330
/*
331
* Vector types
332
*
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.
342
*
343
* Maintaining proper alignment is the user's responsibility.
344
*/
345
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
363
#endif
364
365
#if defined( __SSE__ )
366
#if defined( __MINGW64__ )
367
#include <intrin.h>
368
#else
369
#include <xmmintrin.h>
370
#endif
371
#if defined( __GNUC__ )
372
typedef float __cl_float4 __attribute__((vector_size(16)));
373
#else
374
typedef __m128 __cl_float4;
375
#endif
376
#define __CL_FLOAT4__ 1
377
#endif
378
379
#if defined( __SSE2__ )
380
#if defined( __MINGW64__ )
381
#include <intrin.h>
382
#else
383
#include <emmintrin.h>
384
#endif
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)));
395
#else
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;
405
#endif
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
415
#endif
416
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)));
429
#else
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;
439
#endif
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
449
#endif
450
451
#if defined( __AVX__ )
452
#if defined( __MINGW64__ )
453
#include <intrin.h>
454
#else
455
#include <immintrin.h>
456
#endif
457
#if defined( __GNUC__ )
458
typedef cl_float __cl_float8 __attribute__((vector_size(32)));
459
typedef cl_double __cl_double4 __attribute__((vector_size(32)));
460
#else
461
typedef __m256 __cl_float8;
462
typedef __m256d __cl_double4;
463
#endif
464
#define __CL_FLOAT8__ 1
465
#define __CL_DOUBLE4__ 1
466
#endif
467
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)
477
#else
478
#warning Need to implement some method to align data here
479
#define CL_ALIGNED(_x)
480
#endif
481
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
488
#endif
489
490
/* Define cl_vector types */
491
492
/* ---- cl_charn ---- */
493
typedef union
494
{
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; };
500
#endif
501
#if defined( __CL_CHAR2__)
502
__cl_char2 v2;
503
#endif
504
}cl_char2;
505
506
typedef union
507
{
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; };
513
#endif
514
#if defined( __CL_CHAR2__)
515
__cl_char2 v2[2];
516
#endif
517
#if defined( __CL_CHAR4__)
518
__cl_char4 v4;
519
#endif
520
}cl_char4;
521
522
/* cl_char3 is identical in size, alignment and behavior to cl_char4. See section 6.1.5. */
523
typedef cl_char4 cl_char3;
524
525
typedef union
526
{
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; };
532
#endif
533
#if defined( __CL_CHAR2__)
534
__cl_char2 v2[4];
535
#endif
536
#if defined( __CL_CHAR4__)
537
__cl_char4 v4[2];
538
#endif
539
#if defined( __CL_CHAR8__ )
540
__cl_char8 v8;
541
#endif
542
}cl_char8;
543
544
typedef union
545
{
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; };
551
#endif
552
#if defined( __CL_CHAR2__)
553
__cl_char2 v2[8];
554
#endif
555
#if defined( __CL_CHAR4__)
556
__cl_char4 v4[4];
557
#endif
558
#if defined( __CL_CHAR8__ )
559
__cl_char8 v8[2];
560
#endif
561
#if defined( __CL_CHAR16__ )
562
__cl_char16 v16;
563
#endif
564
}cl_char16;
565
566
567
/* ---- cl_ucharn ---- */
568
typedef union
569
{
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; };
575
#endif
576
#if defined( __cl_uchar2__)
577
__cl_uchar2 v2;
578
#endif
579
}cl_uchar2;
580
581
typedef union
582
{
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; };
588
#endif
589
#if defined( __CL_UCHAR2__)
590
__cl_uchar2 v2[2];
591
#endif
592
#if defined( __CL_UCHAR4__)
593
__cl_uchar4 v4;
594
#endif
595
}cl_uchar4;
596
597
/* cl_uchar3 is identical in size, alignment and behavior to cl_uchar4. See section 6.1.5. */
598
typedef cl_uchar4 cl_uchar3;
599
600
typedef union
601
{
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; };
607
#endif
608
#if defined( __CL_UCHAR2__)
609
__cl_uchar2 v2[4];
610
#endif
611
#if defined( __CL_UCHAR4__)
612
__cl_uchar4 v4[2];
613
#endif
614
#if defined( __CL_UCHAR8__ )
615
__cl_uchar8 v8;
616
#endif
617
}cl_uchar8;
618
619
typedef union
620
{
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; };
626
#endif
627
#if defined( __CL_UCHAR2__)
628
__cl_uchar2 v2[8];
629
#endif
630
#if defined( __CL_UCHAR4__)
631
__cl_uchar4 v4[4];
632
#endif
633
#if defined( __CL_UCHAR8__ )
634
__cl_uchar8 v8[2];
635
#endif
636
#if defined( __CL_UCHAR16__ )
637
__cl_uchar16 v16;
638
#endif
639
}cl_uchar16;
640
641
642
/* ---- cl_shortn ---- */
643
typedef union
644
{
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; };
650
#endif
651
#if defined( __CL_SHORT2__)
652
__cl_short2 v2;
653
#endif
654
}cl_short2;
655
656
typedef union
657
{
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; };
663
#endif
664
#if defined( __CL_SHORT2__)
665
__cl_short2 v2[2];
666
#endif
667
#if defined( __CL_SHORT4__)
668
__cl_short4 v4;
669
#endif
670
}cl_short4;
671
672
/* cl_short3 is identical in size, alignment and behavior to cl_short4. See section 6.1.5. */
673
typedef cl_short4 cl_short3;
674
675
typedef union
676
{
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; };
682
#endif
683
#if defined( __CL_SHORT2__)
684
__cl_short2 v2[4];
685
#endif
686
#if defined( __CL_SHORT4__)
687
__cl_short4 v4[2];
688
#endif
689
#if defined( __CL_SHORT8__ )
690
__cl_short8 v8;
691
#endif
692
}cl_short8;
693
694
typedef union
695
{
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; };
701
#endif
702
#if defined( __CL_SHORT2__)
703
__cl_short2 v2[8];
704
#endif
705
#if defined( __CL_SHORT4__)
706
__cl_short4 v4[4];
707
#endif
708
#if defined( __CL_SHORT8__ )
709
__cl_short8 v8[2];
710
#endif
711
#if defined( __CL_SHORT16__ )
712
__cl_short16 v16;
713
#endif
714
}cl_short16;
715
716
717
/* ---- cl_ushortn ---- */
718
typedef union
719
{
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; };
725
#endif
726
#if defined( __CL_USHORT2__)
727
__cl_ushort2 v2;
728
#endif
729
}cl_ushort2;
730
731
typedef union
732
{
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; };
738
#endif
739
#if defined( __CL_USHORT2__)
740
__cl_ushort2 v2[2];
741
#endif
742
#if defined( __CL_USHORT4__)
743
__cl_ushort4 v4;
744
#endif
745
}cl_ushort4;
746
747
/* cl_ushort3 is identical in size, alignment and behavior to cl_ushort4. See section 6.1.5. */
748
typedef cl_ushort4 cl_ushort3;
749
750
typedef union
751
{
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; };
757
#endif
758
#if defined( __CL_USHORT2__)
759
__cl_ushort2 v2[4];
760
#endif
761
#if defined( __CL_USHORT4__)
762
__cl_ushort4 v4[2];
763
#endif
764
#if defined( __CL_USHORT8__ )
765
__cl_ushort8 v8;
766
#endif
767
}cl_ushort8;
768
769
typedef union
770
{
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; };
776
#endif
777
#if defined( __CL_USHORT2__)
778
__cl_ushort2 v2[8];
779
#endif
780
#if defined( __CL_USHORT4__)
781
__cl_ushort4 v4[4];
782
#endif
783
#if defined( __CL_USHORT8__ )
784
__cl_ushort8 v8[2];
785
#endif
786
#if defined( __CL_USHORT16__ )
787
__cl_ushort16 v16;
788
#endif
789
}cl_ushort16;
790
791
/* ---- cl_intn ---- */
792
typedef union
793
{
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; };
799
#endif
800
#if defined( __CL_INT2__)
801
__cl_int2 v2;
802
#endif
803
}cl_int2;
804
805
typedef union
806
{
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; };
812
#endif
813
#if defined( __CL_INT2__)
814
__cl_int2 v2[2];
815
#endif
816
#if defined( __CL_INT4__)
817
__cl_int4 v4;
818
#endif
819
}cl_int4;
820
821
/* cl_int3 is identical in size, alignment and behavior to cl_int4. See section 6.1.5. */
822
typedef cl_int4 cl_int3;
823
824
typedef union
825
{
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; };
831
#endif
832
#if defined( __CL_INT2__)
833
__cl_int2 v2[4];
834
#endif
835
#if defined( __CL_INT4__)
836
__cl_int4 v4[2];
837
#endif
838
#if defined( __CL_INT8__ )
839
__cl_int8 v8;
840
#endif
841
}cl_int8;
842
843
typedef union
844
{
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; };
850
#endif
851
#if defined( __CL_INT2__)
852
__cl_int2 v2[8];
853
#endif
854
#if defined( __CL_INT4__)
855
__cl_int4 v4[4];
856
#endif
857
#if defined( __CL_INT8__ )
858
__cl_int8 v8[2];
859
#endif
860
#if defined( __CL_INT16__ )
861
__cl_int16 v16;
862
#endif
863
}cl_int16;
864
865
866
/* ---- cl_uintn ---- */
867
typedef union
868
{
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; };
874
#endif
875
#if defined( __CL_UINT2__)
876
__cl_uint2 v2;
877
#endif
878
}cl_uint2;
879
880
typedef union
881
{
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; };
887
#endif
888
#if defined( __CL_UINT2__)
889
__cl_uint2 v2[2];
890
#endif
891
#if defined( __CL_UINT4__)
892
__cl_uint4 v4;
893
#endif
894
}cl_uint4;
895
896
/* cl_uint3 is identical in size, alignment and behavior to cl_uint4. See section 6.1.5. */
897
typedef cl_uint4 cl_uint3;
898
899
typedef union
900
{
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; };
906
#endif
907
#if defined( __CL_UINT2__)
908
__cl_uint2 v2[4];
909
#endif
910
#if defined( __CL_UINT4__)
911
__cl_uint4 v4[2];
912
#endif
913
#if defined( __CL_UINT8__ )
914
__cl_uint8 v8;
915
#endif
916
}cl_uint8;
917
918
typedef union
919
{
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; };
925
#endif
926
#if defined( __CL_UINT2__)
927
__cl_uint2 v2[8];
928
#endif
929
#if defined( __CL_UINT4__)
930
__cl_uint4 v4[4];
931
#endif
932
#if defined( __CL_UINT8__ )
933
__cl_uint8 v8[2];
934
#endif
935
#if defined( __CL_UINT16__ )
936
__cl_uint16 v16;
937
#endif
938
}cl_uint16;
939
940
/* ---- cl_longn ---- */
941
typedef union
942
{
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; };
948
#endif
949
#if defined( __CL_LONG2__)
950
__cl_long2 v2;
951
#endif
952
}cl_long2;
953
954
typedef union
955
{
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; };
961
#endif
962
#if defined( __CL_LONG2__)
963
__cl_long2 v2[2];
964
#endif
965
#if defined( __CL_LONG4__)
966
__cl_long4 v4;
967
#endif
968
}cl_long4;
969
970
/* cl_long3 is identical in size, alignment and behavior to cl_long4. See section 6.1.5. */
971
typedef cl_long4 cl_long3;
972
973
typedef union
974
{
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; };
980
#endif
981
#if defined( __CL_LONG2__)
982
__cl_long2 v2[4];
983
#endif
984
#if defined( __CL_LONG4__)
985
__cl_long4 v4[2];
986
#endif
987
#if defined( __CL_LONG8__ )
988
__cl_long8 v8;
989
#endif
990
}cl_long8;
991
992
typedef union
993
{
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; };
999
#endif
1000
#if defined( __CL_LONG2__)
1001
__cl_long2 v2[8];
1002
#endif
1003
#if defined( __CL_LONG4__)
1004
__cl_long4 v4[4];
1005
#endif
1006
#if defined( __CL_LONG8__ )
1007
__cl_long8 v8[2];
1008
#endif
1009
#if defined( __CL_LONG16__ )
1010
__cl_long16 v16;
1011
#endif
1012
}cl_long16;
1013
1014
1015
/* ---- cl_ulongn ---- */
1016
typedef union
1017
{
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; };
1023
#endif
1024
#if defined( __CL_ULONG2__)
1025
__cl_ulong2 v2;
1026
#endif
1027
}cl_ulong2;
1028
1029
typedef union
1030
{
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; };
1036
#endif
1037
#if defined( __CL_ULONG2__)
1038
__cl_ulong2 v2[2];
1039
#endif
1040
#if defined( __CL_ULONG4__)
1041
__cl_ulong4 v4;
1042
#endif
1043
}cl_ulong4;
1044
1045
/* cl_ulong3 is identical in size, alignment and behavior to cl_ulong4. See section 6.1.5. */
1046
typedef cl_ulong4 cl_ulong3;
1047
1048
typedef union
1049
{
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; };
1055
#endif
1056
#if defined( __CL_ULONG2__)
1057
__cl_ulong2 v2[4];
1058
#endif
1059
#if defined( __CL_ULONG4__)
1060
__cl_ulong4 v4[2];
1061
#endif
1062
#if defined( __CL_ULONG8__ )
1063
__cl_ulong8 v8;
1064
#endif
1065
}cl_ulong8;
1066
1067
typedef union
1068
{
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; };
1074
#endif
1075
#if defined( __CL_ULONG2__)
1076
__cl_ulong2 v2[8];
1077
#endif
1078
#if defined( __CL_ULONG4__)
1079
__cl_ulong4 v4[4];
1080
#endif
1081
#if defined( __CL_ULONG8__ )
1082
__cl_ulong8 v8[2];
1083
#endif
1084
#if defined( __CL_ULONG16__ )
1085
__cl_ulong16 v16;
1086
#endif
1087
}cl_ulong16;
1088
1089
1090
/* --- cl_floatn ---- */
1091
1092
typedef union
1093
{
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; };
1099
#endif
1100
#if defined( __CL_FLOAT2__)
1101
__cl_float2 v2;
1102
#endif
1103
}cl_float2;
1104
1105
typedef union
1106
{
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; };
1112
#endif
1113
#if defined( __CL_FLOAT2__)
1114
__cl_float2 v2[2];
1115
#endif
1116
#if defined( __CL_FLOAT4__)
1117
__cl_float4 v4;
1118
#endif
1119
}cl_float4;
1120
1121
/* cl_float3 is identical in size, alignment and behavior to cl_float4. See section 6.1.5. */
1122
typedef cl_float4 cl_float3;
1123
1124
typedef union
1125
{
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; };
1131
#endif
1132
#if defined( __CL_FLOAT2__)
1133
__cl_float2 v2[4];
1134
#endif
1135
#if defined( __CL_FLOAT4__)
1136
__cl_float4 v4[2];
1137
#endif
1138
#if defined( __CL_FLOAT8__ )
1139
__cl_float8 v8;
1140
#endif
1141
}cl_float8;
1142
1143
typedef union
1144
{
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; };
1150
#endif
1151
#if defined( __CL_FLOAT2__)
1152
__cl_float2 v2[8];
1153
#endif
1154
#if defined( __CL_FLOAT4__)
1155
__cl_float4 v4[4];
1156
#endif
1157
#if defined( __CL_FLOAT8__ )
1158
__cl_float8 v8[2];
1159
#endif
1160
#if defined( __CL_FLOAT16__ )
1161
__cl_float16 v16;
1162
#endif
1163
}cl_float16;
1164
1165
/* --- cl_doublen ---- */
1166
1167
typedef union
1168
{
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; };
1174
#endif
1175
#if defined( __CL_DOUBLE2__)
1176
__cl_double2 v2;
1177
#endif
1178
}cl_double2;
1179
1180
typedef union
1181
{
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; };
1187
#endif
1188
#if defined( __CL_DOUBLE2__)
1189
__cl_double2 v2[2];
1190
#endif
1191
#if defined( __CL_DOUBLE4__)
1192
__cl_double4 v4;
1193
#endif
1194
}cl_double4;
1195
1196
/* cl_double3 is identical in size, alignment and behavior to cl_double4. See section 6.1.5. */
1197
typedef cl_double4 cl_double3;
1198
1199
typedef union
1200
{
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; };
1206
#endif
1207
#if defined( __CL_DOUBLE2__)
1208
__cl_double2 v2[4];
1209
#endif
1210
#if defined( __CL_DOUBLE4__)
1211
__cl_double4 v4[2];
1212
#endif
1213
#if defined( __CL_DOUBLE8__ )
1214
__cl_double8 v8;
1215
#endif
1216
}cl_double8;
1217
1218
typedef union
1219
{
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; };
1225
#endif
1226
#if defined( __CL_DOUBLE2__)
1227
__cl_double2 v2[8];
1228
#endif
1229
#if defined( __CL_DOUBLE4__)
1230
__cl_double4 v4[4];
1231
#endif
1232
#if defined( __CL_DOUBLE8__ )
1233
__cl_double8 v8[2];
1234
#endif
1235
#if defined( __CL_DOUBLE16__ )
1236
__cl_double16 v16;
1237
#endif
1238
}cl_double16;
1239
1240
/* Macro to facilitate debugging
1241
* Usage:
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 ";
1246
*
1247
* Example:
1248
*
1249
* const char *my_program = CL_PROGRAM_STRING_DEBUG_INFO "\
1250
* kernel void foo( int a, float * b ) \n\
1251
* { \n\
1252
* // my comment \n\
1253
* *b[ get_global_id(0)] = a; \n\
1254
* } \n\
1255
* ";
1256
*
1257
* This should correctly set up the line, (column) and file information for your source
1258
* string so you can do source level debugging.
1259
*/
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"
1263
1264
#ifdef __cplusplus
1265
}
1266
#endif
1267
1268
#endif /* __CL_PLATFORM_H */
1269
1270