9 #ifndef _OPENCL_BASE_H_
10 #define _OPENCL_BASE_H_
111 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
119 #if __OPENCL_C_VERSION__ < CL_VERSION_1_2
120 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
126 typedef double double16
__attribute__((ext_vector_type(16)));
129 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
130 #define NULL ((void*)0)
137 #define MAXFLOAT 0x1.fffffep127f
144 #define HUGE_VALF (__builtin_huge_valf())
151 #define HUGE_VAL (__builtin_huge_val())
157 #define INFINITY (__builtin_inff())
162 #define NAN as_float(INT_MAX)
164 #define FP_ILOGB0 INT_MIN
165 #define FP_ILOGBNAN INT_MAX
168 #define FLT_MANT_DIG 24
169 #define FLT_MAX_10_EXP +38
170 #define FLT_MAX_EXP +128
171 #define FLT_MIN_10_EXP -37
172 #define FLT_MIN_EXP -125
174 #define FLT_MAX 0x1.fffffep127f
175 #define FLT_MIN 0x1.0p-126f
176 #define FLT_EPSILON 0x1.0p-23f
178 #define M_E_F 2.71828182845904523536028747135266250f
179 #define M_LOG2E_F 1.44269504088896340735992468100189214f
180 #define M_LOG10E_F 0.434294481903251827651128918916605082f
181 #define M_LN2_F 0.693147180559945309417232121458176568f
182 #define M_LN10_F 2.30258509299404568401799145468436421f
183 #define M_PI_F 3.14159265358979323846264338327950288f
184 #define M_PI_2_F 1.57079632679489661923132169163975144f
185 #define M_PI_4_F 0.785398163397448309615660845819875721f
186 #define M_1_PI_F 0.318309886183790671537767526745028724f
187 #define M_2_PI_F 0.636619772367581343075535053490057448f
188 #define M_2_SQRTPI_F 1.12837916709551257389615890312154517f
189 #define M_SQRT2_F 1.41421356237309504880168872420969808f
190 #define M_SQRT1_2_F 0.707106781186547524400844362104849039f
193 #define DBL_MANT_DIG 53
194 #define DBL_MAX_10_EXP +308
195 #define DBL_MAX_EXP +1024
196 #define DBL_MIN_10_EXP -307
197 #define DBL_MIN_EXP -1021
199 #define DBL_MAX 0x1.fffffffffffffp1023
200 #define DBL_MIN 0x1.0p-1022
201 #define DBL_EPSILON 0x1.0p-52
203 #define M_E 0x1.5bf0a8b145769p+1
204 #define M_LOG2E 0x1.71547652b82fep+0
205 #define M_LOG10E 0x1.bcb7b1526e50ep-2
206 #define M_LN2 0x1.62e42fefa39efp-1
207 #define M_LN10 0x1.26bb1bbb55516p+1
208 #define M_PI 0x1.921fb54442d18p+1
209 #define M_PI_2 0x1.921fb54442d18p+0
210 #define M_PI_4 0x1.921fb54442d18p-1
211 #define M_1_PI 0x1.45f306dc9c883p-2
212 #define M_2_PI 0x1.45f306dc9c883p-1
213 #define M_2_SQRTPI 0x1.20dd750429b6dp+0
214 #define M_SQRT2 0x1.6a09e667f3bcdp+0
215 #define M_SQRT1_2 0x1.6a09e667f3bcdp-1
220 #define HALF_MANT_DIG 11
221 #define HALF_MAX_10_EXP +4
222 #define HALF_MAX_EXP +16
223 #define HALF_MIN_10_EXP -4
224 #define HALF_MIN_EXP -13
226 #define HALF_MAX ((0x1.ffcp15h))
227 #define HALF_MIN ((0x1.0p-14h))
228 #define HALF_EPSILON ((0x1.0p-10h))
230 #define M_E_H 2.71828182845904523536028747135266250h
231 #define M_LOG2E_H 1.44269504088896340735992468100189214h
232 #define M_LOG10E_H 0.434294481903251827651128918916605082h
233 #define M_LN2_H 0.693147180559945309417232121458176568h
234 #define M_LN10_H 2.30258509299404568401799145468436421h
235 #define M_PI_H 3.14159265358979323846264338327950288h
236 #define M_PI_2_H 1.57079632679489661923132169163975144h
237 #define M_PI_4_H 0.785398163397448309615660845819875721h
238 #define M_1_PI_H 0.318309886183790671537767526745028724h
239 #define M_2_PI_H 0.636619772367581343075535053490057448h
240 #define M_2_SQRTPI_H 1.12837916709551257389615890312154517h
241 #define M_SQRT2_H 1.41421356237309504880168872420969808h
242 #define M_SQRT1_2_H 0.707106781186547524400844362104849039h
247 #define SCHAR_MAX 127
248 #define SCHAR_MIN (-128)
249 #define UCHAR_MAX 255
250 #define CHAR_MAX SCHAR_MAX
251 #define CHAR_MIN SCHAR_MIN
252 #define USHRT_MAX 65535
253 #define SHRT_MAX 32767
254 #define SHRT_MIN (-32768)
255 #define UINT_MAX 0xffffffff
256 #define INT_MAX 2147483647
257 #define INT_MIN (-2147483647-1)
258 #define ULONG_MAX 0xffffffffffffffffUL
259 #define LONG_MAX 0x7fffffffffffffffL
260 #define LONG_MIN (-0x7fffffffffffffffL-1)
271 #define CLK_LOCAL_MEM_FENCE 0x01
277 #define CLK_GLOBAL_MEM_FENCE 0x02
279 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
286 #if defined(cl_intel_subgroups) || defined(cl_khr_subgroups)
287 memory_scope_sub_group = __OPENCL_MEMORY_SCOPE_SUB_GROUP
296 #define CLK_IMAGE_MEM_FENCE 0x04
298 #ifndef ATOMIC_VAR_INIT
299 #define ATOMIC_VAR_INIT(x) (x)
301 #define ATOMIC_FLAG_INIT 0
321 #define CLK_ADDRESS_NONE 0
322 #define CLK_ADDRESS_CLAMP_TO_EDGE 2
323 #define CLK_ADDRESS_CLAMP 4
324 #define CLK_ADDRESS_REPEAT 6
325 #define CLK_ADDRESS_MIRRORED_REPEAT 8
330 #define CLK_NORMALIZED_COORDS_FALSE 0
331 #define CLK_NORMALIZED_COORDS_TRUE 1
336 #define CLK_FILTER_NEAREST 0x10
337 #define CLK_FILTER_LINEAR 0x20
339 #ifdef cl_khr_gl_msaa_sharing
340 #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable
346 #define CLK_SNORM_INT8 0x10D0
347 #define CLK_SNORM_INT16 0x10D1
348 #define CLK_UNORM_INT8 0x10D2
349 #define CLK_UNORM_INT16 0x10D3
350 #define CLK_UNORM_SHORT_565 0x10D4
351 #define CLK_UNORM_SHORT_555 0x10D5
352 #define CLK_UNORM_INT_101010 0x10D6
353 #define CLK_SIGNED_INT8 0x10D7
354 #define CLK_SIGNED_INT16 0x10D8
355 #define CLK_SIGNED_INT32 0x10D9
356 #define CLK_UNSIGNED_INT8 0x10DA
357 #define CLK_UNSIGNED_INT16 0x10DB
358 #define CLK_UNSIGNED_INT32 0x10DC
359 #define CLK_HALF_FLOAT 0x10DD
360 #define CLK_FLOAT 0x10DE
361 #define CLK_UNORM_INT24 0x10DF
367 #define CLK_RG 0x10B2
368 #define CLK_RA 0x10B3
369 #define CLK_RGB 0x10B4
370 #define CLK_RGBA 0x10B5
371 #define CLK_BGRA 0x10B6
372 #define CLK_ARGB 0x10B7
373 #define CLK_INTENSITY 0x10B8
374 #define CLK_LUMINANCE 0x10B9
375 #define CLK_Rx 0x10BA
376 #define CLK_RGx 0x10BB
377 #define CLK_RGBx 0x10BC
378 #define CLK_DEPTH 0x10BD
379 #define CLK_DEPTH_STENCIL 0x10BE
380 #if __OPENCL_C_VERSION__ >= CL_VERSION_2_0
381 #define CLK_sRGB 0x10BF
382 #define CLK_sRGBx 0x10C0
383 #define CLK_sRGBA 0x10C1
384 #define CLK_sBGRA 0x10C2
385 #define CLK_ABGR 0x10C3
389 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
390 #define CLK_NULL_RESERVE_ID (__builtin_astype(((void*)(__SIZE_MAX__)), reserve_id_t))
393 #define CL_COMPLETE 0x0
394 #define CL_RUNNING 0x1
395 #define CL_SUBMITTED 0x2
396 #define CL_QUEUED 0x3
398 #define CLK_SUCCESS 0
399 #define CLK_ENQUEUE_FAILURE -101
400 #define CLK_INVALID_QUEUE -102
401 #define CLK_INVALID_NDRANGE -160
402 #define CLK_INVALID_EVENT_WAIT_LIST -57
403 #define CLK_DEVICE_QUEUE_FULL -161
404 #define CLK_INVALID_ARG_SIZE -51
405 #define CLK_EVENT_ALLOCATION_FAILURE -100
406 #define CLK_OUT_OF_RESOURCES -5
408 #define CLK_NULL_QUEUE 0
409 #define CLK_NULL_EVENT (__builtin_astype(((__SIZE_MAX__)), clk_event_t))
412 #define CLK_ENQUEUE_FLAGS_NO_WAIT 0x0
413 #define CLK_ENQUEUE_FLAGS_WAIT_KERNEL 0x1
414 #define CLK_ENQUEUE_FLAGS_WAIT_WORK_GROUP 0x2
420 #define CLK_PROFILING_COMMAND_EXEC_TIME 0x1
422 #define MAX_WORK_DIM 3
433 #ifdef cl_intel_device_side_avc_motion_estimation
434 #pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : begin
436 #define CLK_AVC_ME_MAJOR_16x16_INTEL 0x0
437 #define CLK_AVC_ME_MAJOR_16x8_INTEL 0x1
438 #define CLK_AVC_ME_MAJOR_8x16_INTEL 0x2
439 #define CLK_AVC_ME_MAJOR_8x8_INTEL 0x3
441 #define CLK_AVC_ME_MINOR_8x8_INTEL 0x0
442 #define CLK_AVC_ME_MINOR_8x4_INTEL 0x1
443 #define CLK_AVC_ME_MINOR_4x8_INTEL 0x2
444 #define CLK_AVC_ME_MINOR_4x4_INTEL 0x3
446 #define CLK_AVC_ME_MAJOR_FORWARD_INTEL 0x0
447 #define CLK_AVC_ME_MAJOR_BACKWARD_INTEL 0x1
448 #define CLK_AVC_ME_MAJOR_BIDIRECTIONAL_INTEL 0x2
450 #define CLK_AVC_ME_PARTITION_MASK_ALL_INTEL 0x0
451 #define CLK_AVC_ME_PARTITION_MASK_16x16_INTEL 0x7E
452 #define CLK_AVC_ME_PARTITION_MASK_16x8_INTEL 0x7D
453 #define CLK_AVC_ME_PARTITION_MASK_8x16_INTEL 0x7B
454 #define CLK_AVC_ME_PARTITION_MASK_8x8_INTEL 0x77
455 #define CLK_AVC_ME_PARTITION_MASK_8x4_INTEL 0x6F
456 #define CLK_AVC_ME_PARTITION_MASK_4x8_INTEL 0x5F
457 #define CLK_AVC_ME_PARTITION_MASK_4x4_INTEL 0x3F
459 #define CLK_AVC_ME_SLICE_TYPE_PRED_INTEL 0x0
460 #define CLK_AVC_ME_SLICE_TYPE_BPRED_INTEL 0x1
461 #define CLK_AVC_ME_SLICE_TYPE_INTRA_INTEL 0x2
463 #define CLK_AVC_ME_SEARCH_WINDOW_EXHAUSTIVE_INTEL 0x0
464 #define CLK_AVC_ME_SEARCH_WINDOW_SMALL_INTEL 0x1
465 #define CLK_AVC_ME_SEARCH_WINDOW_TINY_INTEL 0x2
466 #define CLK_AVC_ME_SEARCH_WINDOW_EXTRA_TINY_INTEL 0x3
467 #define CLK_AVC_ME_SEARCH_WINDOW_DIAMOND_INTEL 0x4
468 #define CLK_AVC_ME_SEARCH_WINDOW_LARGE_DIAMOND_INTEL 0x5
469 #define CLK_AVC_ME_SEARCH_WINDOW_RESERVED0_INTEL 0x6
470 #define CLK_AVC_ME_SEARCH_WINDOW_RESERVED1_INTEL 0x7
471 #define CLK_AVC_ME_SEARCH_WINDOW_CUSTOM_INTEL 0x8
473 #define CLK_AVC_ME_SAD_ADJUST_MODE_NONE_INTEL 0x0
474 #define CLK_AVC_ME_SAD_ADJUST_MODE_HAAR_INTEL 0x2
476 #define CLK_AVC_ME_SUBPIXEL_MODE_INTEGER_INTEL 0x0
477 #define CLK_AVC_ME_SUBPIXEL_MODE_HPEL_INTEL 0x1
478 #define CLK_AVC_ME_SUBPIXEL_MODE_QPEL_INTEL 0x3
480 #define CLK_AVC_ME_COST_PRECISION_QPEL_INTEL 0x0
481 #define CLK_AVC_ME_COST_PRECISION_HPEL_INTEL 0x1
482 #define CLK_AVC_ME_COST_PRECISION_PEL_INTEL 0x2
483 #define CLK_AVC_ME_COST_PRECISION_DPEL_INTEL 0x3
485 #define CLK_AVC_ME_BIDIR_WEIGHT_QUARTER_INTEL 0x10
486 #define CLK_AVC_ME_BIDIR_WEIGHT_THIRD_INTEL 0x15
487 #define CLK_AVC_ME_BIDIR_WEIGHT_HALF_INTEL 0x20
488 #define CLK_AVC_ME_BIDIR_WEIGHT_TWO_THIRD_INTEL 0x2B
489 #define CLK_AVC_ME_BIDIR_WEIGHT_THREE_QUARTER_INTEL 0x30
491 #define CLK_AVC_ME_BORDER_REACHED_LEFT_INTEL 0x0
492 #define CLK_AVC_ME_BORDER_REACHED_RIGHT_INTEL 0x2
493 #define CLK_AVC_ME_BORDER_REACHED_TOP_INTEL 0x4
494 #define CLK_AVC_ME_BORDER_REACHED_BOTTOM_INTEL 0x8
496 #define CLK_AVC_ME_INTRA_16x16_INTEL 0x0
497 #define CLK_AVC_ME_INTRA_8x8_INTEL 0x1
498 #define CLK_AVC_ME_INTRA_4x4_INTEL 0x2
500 #define CLK_AVC_ME_SKIP_BLOCK_PARTITION_16x16_INTEL 0x0
501 #define CLK_AVC_ME_SKIP_BLOCK_PARTITION_8x8_INTEL 0x4000
503 #define CLK_AVC_ME_SKIP_BLOCK_16x16_FORWARD_ENABLE_INTEL (0x1 << 24)
504 #define CLK_AVC_ME_SKIP_BLOCK_16x16_BACKWARD_ENABLE_INTEL (0x2 << 24)
505 #define CLK_AVC_ME_SKIP_BLOCK_16x16_DUAL_ENABLE_INTEL (0x3 << 24)
506 #define CLK_AVC_ME_SKIP_BLOCK_8x8_FORWARD_ENABLE_INTEL (0x55 << 24)
507 #define CLK_AVC_ME_SKIP_BLOCK_8x8_BACKWARD_ENABLE_INTEL (0xAA << 24)
508 #define CLK_AVC_ME_SKIP_BLOCK_8x8_DUAL_ENABLE_INTEL (0xFF << 24)
509 #define CLK_AVC_ME_SKIP_BLOCK_8x8_0_FORWARD_ENABLE_INTEL (0x1 << 24)
510 #define CLK_AVC_ME_SKIP_BLOCK_8x8_0_BACKWARD_ENABLE_INTEL (0x2 << 24)
511 #define CLK_AVC_ME_SKIP_BLOCK_8x8_1_FORWARD_ENABLE_INTEL (0x1 << 26)
512 #define CLK_AVC_ME_SKIP_BLOCK_8x8_1_BACKWARD_ENABLE_INTEL (0x2 << 26)
513 #define CLK_AVC_ME_SKIP_BLOCK_8x8_2_FORWARD_ENABLE_INTEL (0x1 << 28)
514 #define CLK_AVC_ME_SKIP_BLOCK_8x8_2_BACKWARD_ENABLE_INTEL (0x2 << 28)
515 #define CLK_AVC_ME_SKIP_BLOCK_8x8_3_FORWARD_ENABLE_INTEL (0x1 << 30)
516 #define CLK_AVC_ME_SKIP_BLOCK_8x8_3_BACKWARD_ENABLE_INTEL (0x2 << 30)
518 #define CLK_AVC_ME_BLOCK_BASED_SKIP_4x4_INTEL 0x00
519 #define CLK_AVC_ME_BLOCK_BASED_SKIP_8x8_INTEL 0x80
521 #define CLK_AVC_ME_INTRA_LUMA_PARTITION_MASK_ALL_INTEL 0x0
522 #define CLK_AVC_ME_INTRA_LUMA_PARTITION_MASK_16x16_INTEL 0x6
523 #define CLK_AVC_ME_INTRA_LUMA_PARTITION_MASK_8x8_INTEL 0x5
524 #define CLK_AVC_ME_INTRA_LUMA_PARTITION_MASK_4x4_INTEL 0x3
526 #define CLK_AVC_ME_INTRA_NEIGHBOR_LEFT_MASK_ENABLE_INTEL 0x60
527 #define CLK_AVC_ME_INTRA_NEIGHBOR_UPPER_MASK_ENABLE_INTEL 0x10
528 #define CLK_AVC_ME_INTRA_NEIGHBOR_UPPER_RIGHT_MASK_ENABLE_INTEL 0x8
529 #define CLK_AVC_ME_INTRA_NEIGHBOR_UPPER_LEFT_MASK_ENABLE_INTEL 0x4
531 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_INTEL 0x0
532 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1
533 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_DC_INTEL 0x2
534 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_LEFT_INTEL 0x3
535 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_RIGHT_INTEL 0x4
536 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_PLANE_INTEL 0x4
537 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_RIGHT_INTEL 0x5
538 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_DOWN_INTEL 0x6
539 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_LEFT_INTEL 0x7
540 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_UP_INTEL 0x8
541 #define CLK_AVC_ME_CHROMA_PREDICTOR_MODE_DC_INTEL 0x0
542 #define CLK_AVC_ME_CHROMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1
543 #define CLK_AVC_ME_CHROMA_PREDICTOR_MODE_VERTICAL_INTEL 0x2
544 #define CLK_AVC_ME_CHROMA_PREDICTOR_MODE_PLANE_INTEL 0x3
546 #define CLK_AVC_ME_FRAME_FORWARD_INTEL 0x1
547 #define CLK_AVC_ME_FRAME_BACKWARD_INTEL 0x2
548 #define CLK_AVC_ME_FRAME_DUAL_INTEL 0x3
550 #define CLK_AVC_ME_INTERLACED_SCAN_TOP_FIELD_INTEL 0x0
551 #define CLK_AVC_ME_INTERLACED_SCAN_BOTTOM_FIELD_INTEL 0x1
553 #define CLK_AVC_ME_INITIALIZE_INTEL 0x0
555 #define CLK_AVC_IME_PAYLOAD_INITIALIZE_INTEL 0x0
556 #define CLK_AVC_REF_PAYLOAD_INITIALIZE_INTEL 0x0
557 #define CLK_AVC_SIC_PAYLOAD_INITIALIZE_INTEL 0x0
559 #define CLK_AVC_IME_RESULT_INITIALIZE_INTEL 0x0
560 #define CLK_AVC_REF_RESULT_INITIALIZE_INTEL 0x0
561 #define CLK_AVC_SIC_RESULT_INITIALIZE_INTEL 0x0
563 #define CLK_AVC_IME_RESULT_SINGLE_REFERENCE_STREAMOUT_INITIALIZE_INTEL 0x0
564 #define CLK_AVC_IME_RESULT_SINGLE_REFERENCE_STREAMIN_INITIALIZE_INTEL 0x0
565 #define CLK_AVC_IME_RESULT_DUAL_REFERENCE_STREAMOUT_INITIALIZE_INTEL 0x0
566 #define CLK_AVC_IME_RESULT_DUAL_REFERENCE_STREAMIN_INITIALIZE_INTEL 0x0
568 #pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : end
__INTPTR_TYPE__ intptr_t
A signed integer type with the property that any valid pointer to void can be converted to this type,...
int kernel_enqueue_flags_t
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
char char2 __attribute__((ext_vector_type(2)))
unsigned char uchar
An unsigned 8-bit integer.
__PTRDIFF_TYPE__ ptrdiff_t
A signed integer type that is the result of subtracting two pointers.
unsigned long ulong
An unsigned 64-bit integer.
unsigned int uint
An unsigned 32-bit integer.
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
@ memory_scope_all_svm_devices
@ memory_scope_work_group
unsigned short ushort
An unsigned 16-bit integer.
unsigned int workDimension