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