Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 1 | //===----- opencl-c-base.h - OpenCL C language base definitions -----------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef _OPENCL_BASE_H_ |
| 10 | #define _OPENCL_BASE_H_ |
| 11 | |
Pirama Arumuga Nainar | 986b880 | 2021-06-03 16:00:34 -0700 | [diff] [blame] | 12 | // Define extension macros |
| 13 | |
| 14 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) |
Pirama Arumuga Nainar | ec8c89d | 2022-02-23 09:26:16 -0800 | [diff] [blame] | 15 | // For SPIR and SPIR-V all extensions are supported. |
| 16 | #if defined(__SPIR__) || defined(__SPIRV__) |
Pirama Arumuga Nainar | 986b880 | 2021-06-03 16:00:34 -0700 | [diff] [blame] | 17 | #define cl_khr_subgroup_extended_types 1 |
| 18 | #define cl_khr_subgroup_non_uniform_vote 1 |
| 19 | #define cl_khr_subgroup_ballot 1 |
| 20 | #define cl_khr_subgroup_non_uniform_arithmetic 1 |
| 21 | #define cl_khr_subgroup_shuffle 1 |
| 22 | #define cl_khr_subgroup_shuffle_relative 1 |
| 23 | #define cl_khr_subgroup_clustered_reduce 1 |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 24 | #define cl_khr_extended_bit_ops 1 |
| 25 | #define cl_khr_integer_dot_product 1 |
| 26 | #define __opencl_c_integer_dot_product_input_4x8bit 1 |
| 27 | #define __opencl_c_integer_dot_product_input_4x8bit_packed 1 |
Pirama Arumuga Nainar | ec8c89d | 2022-02-23 09:26:16 -0800 | [diff] [blame] | 28 | #define cl_ext_float_atomics 1 |
| 29 | #ifdef cl_khr_fp16 |
| 30 | #define __opencl_c_ext_fp16_global_atomic_load_store 1 |
| 31 | #define __opencl_c_ext_fp16_local_atomic_load_store 1 |
| 32 | #define __opencl_c_ext_fp16_global_atomic_add 1 |
| 33 | #define __opencl_c_ext_fp16_local_atomic_add 1 |
| 34 | #define __opencl_c_ext_fp16_global_atomic_min_max 1 |
| 35 | #define __opencl_c_ext_fp16_local_atomic_min_max 1 |
| 36 | #endif |
| 37 | #ifdef cl_khr_fp64 |
| 38 | #define __opencl_c_ext_fp64_global_atomic_add 1 |
| 39 | #define __opencl_c_ext_fp64_local_atomic_add 1 |
| 40 | #define __opencl_c_ext_fp64_global_atomic_min_max 1 |
| 41 | #define __opencl_c_ext_fp64_local_atomic_min_max 1 |
| 42 | #endif |
| 43 | #define __opencl_c_ext_fp32_global_atomic_add 1 |
| 44 | #define __opencl_c_ext_fp32_local_atomic_add 1 |
| 45 | #define __opencl_c_ext_fp32_global_atomic_min_max 1 |
| 46 | #define __opencl_c_ext_fp32_local_atomic_min_max 1 |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 47 | |
Pirama Arumuga Nainar | ec8c89d | 2022-02-23 09:26:16 -0800 | [diff] [blame] | 48 | #endif // defined(__SPIR__) || defined(__SPIRV__) |
Pirama Arumuga Nainar | 986b880 | 2021-06-03 16:00:34 -0700 | [diff] [blame] | 49 | #endif // (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) |
| 50 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 51 | // Define feature macros for OpenCL C 2.0 |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 52 | #if (__OPENCL_CPP_VERSION__ == 100 || __OPENCL_C_VERSION__ == 200) |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 53 | #define __opencl_c_pipes 1 |
| 54 | #define __opencl_c_generic_address_space 1 |
| 55 | #define __opencl_c_work_group_collective_functions 1 |
| 56 | #define __opencl_c_atomic_order_acq_rel 1 |
| 57 | #define __opencl_c_atomic_order_seq_cst 1 |
| 58 | #define __opencl_c_atomic_scope_device 1 |
| 59 | #define __opencl_c_atomic_scope_all_devices 1 |
| 60 | #define __opencl_c_device_enqueue 1 |
| 61 | #define __opencl_c_read_write_images 1 |
| 62 | #define __opencl_c_program_scope_global_variables 1 |
| 63 | #define __opencl_c_images 1 |
| 64 | #endif |
| 65 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 66 | // Define header-only feature macros for OpenCL C 3.0. |
| 67 | #if (__OPENCL_CPP_VERSION__ == 202100 || __OPENCL_C_VERSION__ == 300) |
Pirama Arumuga Nainar | ec8c89d | 2022-02-23 09:26:16 -0800 | [diff] [blame] | 68 | // For the SPIR and SPIR-V target all features are supported. |
| 69 | #if defined(__SPIR__) || defined(__SPIRV__) |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 70 | #define __opencl_c_atomic_scope_all_devices 1 |
| 71 | #endif // defined(__SPIR__) |
| 72 | #endif // (__OPENCL_CPP_VERSION__ == 202100 || __OPENCL_C_VERSION__ == 300) |
| 73 | |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 74 | // built-in scalar data types: |
| 75 | |
| 76 | /** |
| 77 | * An unsigned 8-bit integer. |
| 78 | */ |
| 79 | typedef unsigned char uchar; |
| 80 | |
| 81 | /** |
| 82 | * An unsigned 16-bit integer. |
| 83 | */ |
| 84 | typedef unsigned short ushort; |
| 85 | |
| 86 | /** |
| 87 | * An unsigned 32-bit integer. |
| 88 | */ |
| 89 | typedef unsigned int uint; |
| 90 | |
| 91 | /** |
| 92 | * An unsigned 64-bit integer. |
| 93 | */ |
| 94 | typedef unsigned long ulong; |
| 95 | |
| 96 | /** |
| 97 | * The unsigned integer type of the result of the sizeof operator. This |
| 98 | * is a 32-bit unsigned integer if CL_DEVICE_ADDRESS_BITS |
| 99 | * defined in table 4.3 is 32-bits and is a 64-bit unsigned integer if |
| 100 | * CL_DEVICE_ADDRESS_BITS is 64-bits. |
| 101 | */ |
| 102 | typedef __SIZE_TYPE__ size_t; |
| 103 | |
| 104 | /** |
| 105 | * A signed integer type that is the result of subtracting two pointers. |
| 106 | * This is a 32-bit signed integer if CL_DEVICE_ADDRESS_BITS |
| 107 | * defined in table 4.3 is 32-bits and is a 64-bit signed integer if |
| 108 | * CL_DEVICE_ADDRESS_BITS is 64-bits. |
| 109 | */ |
| 110 | typedef __PTRDIFF_TYPE__ ptrdiff_t; |
| 111 | |
| 112 | /** |
| 113 | * A signed integer type with the property that any valid pointer to |
| 114 | * void can be converted to this type, then converted back to pointer |
| 115 | * to void, and the result will compare equal to the original pointer. |
| 116 | */ |
| 117 | typedef __INTPTR_TYPE__ intptr_t; |
| 118 | |
| 119 | /** |
| 120 | * An unsigned integer type with the property that any valid pointer to |
| 121 | * void can be converted to this type, then converted back to pointer |
| 122 | * to void, and the result will compare equal to the original pointer. |
| 123 | */ |
| 124 | typedef __UINTPTR_TYPE__ uintptr_t; |
| 125 | |
| 126 | // built-in vector data types: |
| 127 | typedef char char2 __attribute__((ext_vector_type(2))); |
| 128 | typedef char char3 __attribute__((ext_vector_type(3))); |
| 129 | typedef char char4 __attribute__((ext_vector_type(4))); |
| 130 | typedef char char8 __attribute__((ext_vector_type(8))); |
| 131 | typedef char char16 __attribute__((ext_vector_type(16))); |
| 132 | typedef uchar uchar2 __attribute__((ext_vector_type(2))); |
| 133 | typedef uchar uchar3 __attribute__((ext_vector_type(3))); |
| 134 | typedef uchar uchar4 __attribute__((ext_vector_type(4))); |
| 135 | typedef uchar uchar8 __attribute__((ext_vector_type(8))); |
| 136 | typedef uchar uchar16 __attribute__((ext_vector_type(16))); |
| 137 | typedef short short2 __attribute__((ext_vector_type(2))); |
| 138 | typedef short short3 __attribute__((ext_vector_type(3))); |
| 139 | typedef short short4 __attribute__((ext_vector_type(4))); |
| 140 | typedef short short8 __attribute__((ext_vector_type(8))); |
| 141 | typedef short short16 __attribute__((ext_vector_type(16))); |
| 142 | typedef ushort ushort2 __attribute__((ext_vector_type(2))); |
| 143 | typedef ushort ushort3 __attribute__((ext_vector_type(3))); |
| 144 | typedef ushort ushort4 __attribute__((ext_vector_type(4))); |
| 145 | typedef ushort ushort8 __attribute__((ext_vector_type(8))); |
| 146 | typedef ushort ushort16 __attribute__((ext_vector_type(16))); |
| 147 | typedef int int2 __attribute__((ext_vector_type(2))); |
| 148 | typedef int int3 __attribute__((ext_vector_type(3))); |
| 149 | typedef int int4 __attribute__((ext_vector_type(4))); |
| 150 | typedef int int8 __attribute__((ext_vector_type(8))); |
| 151 | typedef int int16 __attribute__((ext_vector_type(16))); |
| 152 | typedef uint uint2 __attribute__((ext_vector_type(2))); |
| 153 | typedef uint uint3 __attribute__((ext_vector_type(3))); |
| 154 | typedef uint uint4 __attribute__((ext_vector_type(4))); |
| 155 | typedef uint uint8 __attribute__((ext_vector_type(8))); |
| 156 | typedef uint uint16 __attribute__((ext_vector_type(16))); |
| 157 | typedef long long2 __attribute__((ext_vector_type(2))); |
| 158 | typedef long long3 __attribute__((ext_vector_type(3))); |
| 159 | typedef long long4 __attribute__((ext_vector_type(4))); |
| 160 | typedef long long8 __attribute__((ext_vector_type(8))); |
| 161 | typedef long long16 __attribute__((ext_vector_type(16))); |
| 162 | typedef ulong ulong2 __attribute__((ext_vector_type(2))); |
| 163 | typedef ulong ulong3 __attribute__((ext_vector_type(3))); |
| 164 | typedef ulong ulong4 __attribute__((ext_vector_type(4))); |
| 165 | typedef ulong ulong8 __attribute__((ext_vector_type(8))); |
| 166 | typedef ulong ulong16 __attribute__((ext_vector_type(16))); |
| 167 | typedef float float2 __attribute__((ext_vector_type(2))); |
| 168 | typedef float float3 __attribute__((ext_vector_type(3))); |
| 169 | typedef float float4 __attribute__((ext_vector_type(4))); |
| 170 | typedef float float8 __attribute__((ext_vector_type(8))); |
| 171 | typedef float float16 __attribute__((ext_vector_type(16))); |
| 172 | #ifdef cl_khr_fp16 |
| 173 | #pragma OPENCL EXTENSION cl_khr_fp16 : enable |
| 174 | typedef half half2 __attribute__((ext_vector_type(2))); |
| 175 | typedef half half3 __attribute__((ext_vector_type(3))); |
| 176 | typedef half half4 __attribute__((ext_vector_type(4))); |
| 177 | typedef half half8 __attribute__((ext_vector_type(8))); |
| 178 | typedef half half16 __attribute__((ext_vector_type(16))); |
| 179 | #endif |
| 180 | #ifdef cl_khr_fp64 |
| 181 | #if __OPENCL_C_VERSION__ < CL_VERSION_1_2 |
| 182 | #pragma OPENCL EXTENSION cl_khr_fp64 : enable |
| 183 | #endif |
| 184 | typedef double double2 __attribute__((ext_vector_type(2))); |
| 185 | typedef double double3 __attribute__((ext_vector_type(3))); |
| 186 | typedef double double4 __attribute__((ext_vector_type(4))); |
| 187 | typedef double double8 __attribute__((ext_vector_type(8))); |
| 188 | typedef double double16 __attribute__((ext_vector_type(16))); |
| 189 | #endif |
| 190 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 191 | #if defined(__OPENCL_CPP_VERSION__) |
| 192 | #define NULL nullptr |
| 193 | #elif defined(__OPENCL_C_VERSION__) |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 194 | #define NULL ((void*)0) |
| 195 | #endif |
| 196 | |
| 197 | /** |
| 198 | * Value of maximum non-infinite single-precision floating-point |
| 199 | * number. |
| 200 | */ |
| 201 | #define MAXFLOAT 0x1.fffffep127f |
| 202 | |
| 203 | /** |
| 204 | * A positive float constant expression. HUGE_VALF evaluates |
| 205 | * to +infinity. Used as an error value returned by the built-in |
| 206 | * math functions. |
| 207 | */ |
| 208 | #define HUGE_VALF (__builtin_huge_valf()) |
| 209 | |
| 210 | /** |
| 211 | * A positive double constant expression. HUGE_VAL evaluates |
| 212 | * to +infinity. Used as an error value returned by the built-in |
| 213 | * math functions. |
| 214 | */ |
| 215 | #define HUGE_VAL (__builtin_huge_val()) |
| 216 | |
| 217 | /** |
| 218 | * A constant expression of type float representing positive or |
| 219 | * unsigned infinity. |
| 220 | */ |
| 221 | #define INFINITY (__builtin_inff()) |
| 222 | |
| 223 | /** |
| 224 | * A constant expression of type float representing a quiet NaN. |
| 225 | */ |
| 226 | #define NAN as_float(INT_MAX) |
| 227 | |
| 228 | #define FP_ILOGB0 INT_MIN |
| 229 | #define FP_ILOGBNAN INT_MAX |
| 230 | |
| 231 | #define FLT_DIG 6 |
| 232 | #define FLT_MANT_DIG 24 |
| 233 | #define FLT_MAX_10_EXP +38 |
| 234 | #define FLT_MAX_EXP +128 |
| 235 | #define FLT_MIN_10_EXP -37 |
| 236 | #define FLT_MIN_EXP -125 |
| 237 | #define FLT_RADIX 2 |
| 238 | #define FLT_MAX 0x1.fffffep127f |
| 239 | #define FLT_MIN 0x1.0p-126f |
| 240 | #define FLT_EPSILON 0x1.0p-23f |
| 241 | |
| 242 | #define M_E_F 2.71828182845904523536028747135266250f |
| 243 | #define M_LOG2E_F 1.44269504088896340735992468100189214f |
| 244 | #define M_LOG10E_F 0.434294481903251827651128918916605082f |
| 245 | #define M_LN2_F 0.693147180559945309417232121458176568f |
| 246 | #define M_LN10_F 2.30258509299404568401799145468436421f |
| 247 | #define M_PI_F 3.14159265358979323846264338327950288f |
| 248 | #define M_PI_2_F 1.57079632679489661923132169163975144f |
| 249 | #define M_PI_4_F 0.785398163397448309615660845819875721f |
| 250 | #define M_1_PI_F 0.318309886183790671537767526745028724f |
| 251 | #define M_2_PI_F 0.636619772367581343075535053490057448f |
| 252 | #define M_2_SQRTPI_F 1.12837916709551257389615890312154517f |
| 253 | #define M_SQRT2_F 1.41421356237309504880168872420969808f |
| 254 | #define M_SQRT1_2_F 0.707106781186547524400844362104849039f |
| 255 | |
| 256 | #define DBL_DIG 15 |
| 257 | #define DBL_MANT_DIG 53 |
| 258 | #define DBL_MAX_10_EXP +308 |
| 259 | #define DBL_MAX_EXP +1024 |
| 260 | #define DBL_MIN_10_EXP -307 |
| 261 | #define DBL_MIN_EXP -1021 |
| 262 | #define DBL_RADIX 2 |
| 263 | #define DBL_MAX 0x1.fffffffffffffp1023 |
| 264 | #define DBL_MIN 0x1.0p-1022 |
| 265 | #define DBL_EPSILON 0x1.0p-52 |
| 266 | |
| 267 | #define M_E 0x1.5bf0a8b145769p+1 |
| 268 | #define M_LOG2E 0x1.71547652b82fep+0 |
| 269 | #define M_LOG10E 0x1.bcb7b1526e50ep-2 |
| 270 | #define M_LN2 0x1.62e42fefa39efp-1 |
| 271 | #define M_LN10 0x1.26bb1bbb55516p+1 |
| 272 | #define M_PI 0x1.921fb54442d18p+1 |
| 273 | #define M_PI_2 0x1.921fb54442d18p+0 |
| 274 | #define M_PI_4 0x1.921fb54442d18p-1 |
| 275 | #define M_1_PI 0x1.45f306dc9c883p-2 |
| 276 | #define M_2_PI 0x1.45f306dc9c883p-1 |
| 277 | #define M_2_SQRTPI 0x1.20dd750429b6dp+0 |
| 278 | #define M_SQRT2 0x1.6a09e667f3bcdp+0 |
| 279 | #define M_SQRT1_2 0x1.6a09e667f3bcdp-1 |
| 280 | |
| 281 | #ifdef cl_khr_fp16 |
| 282 | |
| 283 | #define HALF_DIG 3 |
| 284 | #define HALF_MANT_DIG 11 |
| 285 | #define HALF_MAX_10_EXP +4 |
| 286 | #define HALF_MAX_EXP +16 |
| 287 | #define HALF_MIN_10_EXP -4 |
| 288 | #define HALF_MIN_EXP -13 |
| 289 | #define HALF_RADIX 2 |
| 290 | #define HALF_MAX ((0x1.ffcp15h)) |
| 291 | #define HALF_MIN ((0x1.0p-14h)) |
| 292 | #define HALF_EPSILON ((0x1.0p-10h)) |
| 293 | |
| 294 | #define M_E_H 2.71828182845904523536028747135266250h |
| 295 | #define M_LOG2E_H 1.44269504088896340735992468100189214h |
| 296 | #define M_LOG10E_H 0.434294481903251827651128918916605082h |
| 297 | #define M_LN2_H 0.693147180559945309417232121458176568h |
| 298 | #define M_LN10_H 2.30258509299404568401799145468436421h |
| 299 | #define M_PI_H 3.14159265358979323846264338327950288h |
| 300 | #define M_PI_2_H 1.57079632679489661923132169163975144h |
| 301 | #define M_PI_4_H 0.785398163397448309615660845819875721h |
| 302 | #define M_1_PI_H 0.318309886183790671537767526745028724h |
| 303 | #define M_2_PI_H 0.636619772367581343075535053490057448h |
| 304 | #define M_2_SQRTPI_H 1.12837916709551257389615890312154517h |
| 305 | #define M_SQRT2_H 1.41421356237309504880168872420969808h |
| 306 | #define M_SQRT1_2_H 0.707106781186547524400844362104849039h |
| 307 | |
| 308 | #endif //cl_khr_fp16 |
| 309 | |
| 310 | #define CHAR_BIT 8 |
| 311 | #define SCHAR_MAX 127 |
| 312 | #define SCHAR_MIN (-128) |
| 313 | #define UCHAR_MAX 255 |
| 314 | #define CHAR_MAX SCHAR_MAX |
| 315 | #define CHAR_MIN SCHAR_MIN |
| 316 | #define USHRT_MAX 65535 |
| 317 | #define SHRT_MAX 32767 |
| 318 | #define SHRT_MIN (-32768) |
| 319 | #define UINT_MAX 0xffffffff |
| 320 | #define INT_MAX 2147483647 |
| 321 | #define INT_MIN (-2147483647-1) |
| 322 | #define ULONG_MAX 0xffffffffffffffffUL |
| 323 | #define LONG_MAX 0x7fffffffffffffffL |
| 324 | #define LONG_MIN (-0x7fffffffffffffffL-1) |
| 325 | |
| 326 | // OpenCL v1.1 s6.11.8, v1.2 s6.12.8, v2.0 s6.13.8 - Synchronization Functions |
| 327 | |
| 328 | // Flag type and values for barrier, mem_fence, read_mem_fence, write_mem_fence |
| 329 | typedef uint cl_mem_fence_flags; |
| 330 | |
| 331 | /** |
| 332 | * Queue a memory fence to ensure correct |
| 333 | * ordering of memory operations to local memory |
| 334 | */ |
| 335 | #define CLK_LOCAL_MEM_FENCE 0x01 |
| 336 | |
| 337 | /** |
| 338 | * Queue a memory fence to ensure correct |
| 339 | * ordering of memory operations to global memory |
| 340 | */ |
| 341 | #define CLK_GLOBAL_MEM_FENCE 0x02 |
| 342 | |
Logan Chien | bedbf4f | 2020-01-06 19:35:19 -0800 | [diff] [blame] | 343 | #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 344 | |
| 345 | typedef enum memory_scope { |
| 346 | memory_scope_work_item = __OPENCL_MEMORY_SCOPE_WORK_ITEM, |
| 347 | memory_scope_work_group = __OPENCL_MEMORY_SCOPE_WORK_GROUP, |
| 348 | memory_scope_device = __OPENCL_MEMORY_SCOPE_DEVICE, |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 349 | #if defined(__opencl_c_atomic_scope_all_devices) |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 350 | memory_scope_all_svm_devices = __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES, |
Pirama Arumuga Nainar | ec8c89d | 2022-02-23 09:26:16 -0800 | [diff] [blame] | 351 | #if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0 || __OPENCL_CPP_VERSION__ >= 202100) |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 352 | memory_scope_all_devices = memory_scope_all_svm_devices, |
Pirama Arumuga Nainar | ec8c89d | 2022-02-23 09:26:16 -0800 | [diff] [blame] | 353 | #endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0 || __OPENCL_CPP_VERSION__ >= 202100) |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 354 | #endif // defined(__opencl_c_atomic_scope_all_devices) |
| 355 | /** |
| 356 | * Subgroups have different requirements on forward progress, so just test |
| 357 | * all the relevant macros. |
| 358 | * CL 3.0 sub-groups "they are not guaranteed to make independent forward progress" |
| 359 | * KHR subgroups "Subgroups within a workgroup are independent, make forward progress with respect to each other" |
| 360 | */ |
| 361 | #if defined(cl_intel_subgroups) || defined(cl_khr_subgroups) || defined(__opencl_c_subgroups) |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 362 | memory_scope_sub_group = __OPENCL_MEMORY_SCOPE_SUB_GROUP |
| 363 | #endif |
| 364 | } memory_scope; |
| 365 | |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 366 | /** |
| 367 | * Queue a memory fence to ensure correct ordering of memory |
| 368 | * operations between work-items of a work-group to |
| 369 | * image memory. |
| 370 | */ |
| 371 | #define CLK_IMAGE_MEM_FENCE 0x04 |
| 372 | |
| 373 | #ifndef ATOMIC_VAR_INIT |
| 374 | #define ATOMIC_VAR_INIT(x) (x) |
| 375 | #endif //ATOMIC_VAR_INIT |
| 376 | #define ATOMIC_FLAG_INIT 0 |
| 377 | |
| 378 | // enum values aligned with what clang uses in EmitAtomicExpr() |
| 379 | typedef enum memory_order |
| 380 | { |
| 381 | memory_order_relaxed = __ATOMIC_RELAXED, |
| 382 | memory_order_acquire = __ATOMIC_ACQUIRE, |
| 383 | memory_order_release = __ATOMIC_RELEASE, |
| 384 | memory_order_acq_rel = __ATOMIC_ACQ_REL, |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 385 | #if defined(__opencl_c_atomic_order_seq_cst) |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 386 | memory_order_seq_cst = __ATOMIC_SEQ_CST |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 387 | #endif |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 388 | } memory_order; |
| 389 | |
Logan Chien | bedbf4f | 2020-01-06 19:35:19 -0800 | [diff] [blame] | 390 | #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 391 | |
| 392 | // OpenCL v1.1 s6.11.3, v1.2 s6.12.14, v2.0 s6.13.14 - Image Read and Write Functions |
| 393 | |
| 394 | // These values need to match the runtime equivalent |
| 395 | // |
| 396 | // Addressing Mode. |
| 397 | // |
| 398 | #define CLK_ADDRESS_NONE 0 |
| 399 | #define CLK_ADDRESS_CLAMP_TO_EDGE 2 |
| 400 | #define CLK_ADDRESS_CLAMP 4 |
| 401 | #define CLK_ADDRESS_REPEAT 6 |
| 402 | #define CLK_ADDRESS_MIRRORED_REPEAT 8 |
| 403 | |
| 404 | // |
| 405 | // Coordination Normalization |
| 406 | // |
| 407 | #define CLK_NORMALIZED_COORDS_FALSE 0 |
| 408 | #define CLK_NORMALIZED_COORDS_TRUE 1 |
| 409 | |
| 410 | // |
| 411 | // Filtering Mode. |
| 412 | // |
| 413 | #define CLK_FILTER_NEAREST 0x10 |
| 414 | #define CLK_FILTER_LINEAR 0x20 |
| 415 | |
| 416 | #ifdef cl_khr_gl_msaa_sharing |
| 417 | #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable |
| 418 | #endif //cl_khr_gl_msaa_sharing |
| 419 | |
| 420 | // |
| 421 | // Channel Datatype. |
| 422 | // |
| 423 | #define CLK_SNORM_INT8 0x10D0 |
| 424 | #define CLK_SNORM_INT16 0x10D1 |
| 425 | #define CLK_UNORM_INT8 0x10D2 |
| 426 | #define CLK_UNORM_INT16 0x10D3 |
| 427 | #define CLK_UNORM_SHORT_565 0x10D4 |
| 428 | #define CLK_UNORM_SHORT_555 0x10D5 |
| 429 | #define CLK_UNORM_INT_101010 0x10D6 |
| 430 | #define CLK_SIGNED_INT8 0x10D7 |
| 431 | #define CLK_SIGNED_INT16 0x10D8 |
| 432 | #define CLK_SIGNED_INT32 0x10D9 |
| 433 | #define CLK_UNSIGNED_INT8 0x10DA |
| 434 | #define CLK_UNSIGNED_INT16 0x10DB |
| 435 | #define CLK_UNSIGNED_INT32 0x10DC |
| 436 | #define CLK_HALF_FLOAT 0x10DD |
| 437 | #define CLK_FLOAT 0x10DE |
| 438 | #define CLK_UNORM_INT24 0x10DF |
| 439 | |
| 440 | // Channel order, numbering must be aligned with cl_channel_order in cl.h |
| 441 | // |
| 442 | #define CLK_R 0x10B0 |
| 443 | #define CLK_A 0x10B1 |
| 444 | #define CLK_RG 0x10B2 |
| 445 | #define CLK_RA 0x10B3 |
| 446 | #define CLK_RGB 0x10B4 |
| 447 | #define CLK_RGBA 0x10B5 |
| 448 | #define CLK_BGRA 0x10B6 |
| 449 | #define CLK_ARGB 0x10B7 |
| 450 | #define CLK_INTENSITY 0x10B8 |
| 451 | #define CLK_LUMINANCE 0x10B9 |
| 452 | #define CLK_Rx 0x10BA |
| 453 | #define CLK_RGx 0x10BB |
| 454 | #define CLK_RGBx 0x10BC |
| 455 | #define CLK_DEPTH 0x10BD |
| 456 | #define CLK_DEPTH_STENCIL 0x10BE |
| 457 | #if __OPENCL_C_VERSION__ >= CL_VERSION_2_0 |
| 458 | #define CLK_sRGB 0x10BF |
| 459 | #define CLK_sRGBx 0x10C0 |
| 460 | #define CLK_sRGBA 0x10C1 |
| 461 | #define CLK_sBGRA 0x10C2 |
| 462 | #define CLK_ABGR 0x10C3 |
| 463 | #endif //__OPENCL_C_VERSION__ >= CL_VERSION_2_0 |
| 464 | |
| 465 | // OpenCL v2.0 s6.13.16 - Pipe Functions |
Logan Chien | bedbf4f | 2020-01-06 19:35:19 -0800 | [diff] [blame] | 466 | #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 467 | #define CLK_NULL_RESERVE_ID (__builtin_astype(((void*)(__SIZE_MAX__)), reserve_id_t)) |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 468 | |
| 469 | // OpenCL v2.0 s6.13.17 - Enqueue Kernels |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 470 | #define CL_COMPLETE 0x0 |
| 471 | #define CL_RUNNING 0x1 |
| 472 | #define CL_SUBMITTED 0x2 |
| 473 | #define CL_QUEUED 0x3 |
| 474 | |
| 475 | #define CLK_SUCCESS 0 |
| 476 | #define CLK_ENQUEUE_FAILURE -101 |
| 477 | #define CLK_INVALID_QUEUE -102 |
| 478 | #define CLK_INVALID_NDRANGE -160 |
| 479 | #define CLK_INVALID_EVENT_WAIT_LIST -57 |
| 480 | #define CLK_DEVICE_QUEUE_FULL -161 |
| 481 | #define CLK_INVALID_ARG_SIZE -51 |
| 482 | #define CLK_EVENT_ALLOCATION_FAILURE -100 |
| 483 | #define CLK_OUT_OF_RESOURCES -5 |
| 484 | |
| 485 | #define CLK_NULL_QUEUE 0 |
Logan Chien | bedbf4f | 2020-01-06 19:35:19 -0800 | [diff] [blame] | 486 | #define CLK_NULL_EVENT (__builtin_astype(((__SIZE_MAX__)), clk_event_t)) |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 487 | |
| 488 | // execution model related definitions |
| 489 | #define CLK_ENQUEUE_FLAGS_NO_WAIT 0x0 |
| 490 | #define CLK_ENQUEUE_FLAGS_WAIT_KERNEL 0x1 |
| 491 | #define CLK_ENQUEUE_FLAGS_WAIT_WORK_GROUP 0x2 |
| 492 | |
| 493 | typedef int kernel_enqueue_flags_t; |
| 494 | typedef int clk_profiling_info; |
| 495 | |
| 496 | // Profiling info name (see capture_event_profiling_info) |
| 497 | #define CLK_PROFILING_COMMAND_EXEC_TIME 0x1 |
| 498 | |
| 499 | #define MAX_WORK_DIM 3 |
| 500 | |
| 501 | typedef struct { |
| 502 | unsigned int workDimension; |
| 503 | size_t globalWorkOffset[MAX_WORK_DIM]; |
| 504 | size_t globalWorkSize[MAX_WORK_DIM]; |
| 505 | size_t localWorkSize[MAX_WORK_DIM]; |
| 506 | } ndrange_t; |
| 507 | |
Logan Chien | bedbf4f | 2020-01-06 19:35:19 -0800 | [diff] [blame] | 508 | #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 509 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 510 | /** |
| 511 | * OpenCL v1.1/1.2/2.0 s6.2.4.2 - as_type operators |
| 512 | * Reinterprets a data type as another data type of the same size |
| 513 | */ |
| 514 | #define as_char(x) __builtin_astype((x), char) |
| 515 | #define as_char2(x) __builtin_astype((x), char2) |
| 516 | #define as_char3(x) __builtin_astype((x), char3) |
| 517 | #define as_char4(x) __builtin_astype((x), char4) |
| 518 | #define as_char8(x) __builtin_astype((x), char8) |
| 519 | #define as_char16(x) __builtin_astype((x), char16) |
| 520 | |
| 521 | #define as_uchar(x) __builtin_astype((x), uchar) |
| 522 | #define as_uchar2(x) __builtin_astype((x), uchar2) |
| 523 | #define as_uchar3(x) __builtin_astype((x), uchar3) |
| 524 | #define as_uchar4(x) __builtin_astype((x), uchar4) |
| 525 | #define as_uchar8(x) __builtin_astype((x), uchar8) |
| 526 | #define as_uchar16(x) __builtin_astype((x), uchar16) |
| 527 | |
| 528 | #define as_short(x) __builtin_astype((x), short) |
| 529 | #define as_short2(x) __builtin_astype((x), short2) |
| 530 | #define as_short3(x) __builtin_astype((x), short3) |
| 531 | #define as_short4(x) __builtin_astype((x), short4) |
| 532 | #define as_short8(x) __builtin_astype((x), short8) |
| 533 | #define as_short16(x) __builtin_astype((x), short16) |
| 534 | |
| 535 | #define as_ushort(x) __builtin_astype((x), ushort) |
| 536 | #define as_ushort2(x) __builtin_astype((x), ushort2) |
| 537 | #define as_ushort3(x) __builtin_astype((x), ushort3) |
| 538 | #define as_ushort4(x) __builtin_astype((x), ushort4) |
| 539 | #define as_ushort8(x) __builtin_astype((x), ushort8) |
| 540 | #define as_ushort16(x) __builtin_astype((x), ushort16) |
| 541 | |
| 542 | #define as_int(x) __builtin_astype((x), int) |
| 543 | #define as_int2(x) __builtin_astype((x), int2) |
| 544 | #define as_int3(x) __builtin_astype((x), int3) |
| 545 | #define as_int4(x) __builtin_astype((x), int4) |
| 546 | #define as_int8(x) __builtin_astype((x), int8) |
| 547 | #define as_int16(x) __builtin_astype((x), int16) |
| 548 | |
| 549 | #define as_uint(x) __builtin_astype((x), uint) |
| 550 | #define as_uint2(x) __builtin_astype((x), uint2) |
| 551 | #define as_uint3(x) __builtin_astype((x), uint3) |
| 552 | #define as_uint4(x) __builtin_astype((x), uint4) |
| 553 | #define as_uint8(x) __builtin_astype((x), uint8) |
| 554 | #define as_uint16(x) __builtin_astype((x), uint16) |
| 555 | |
| 556 | #define as_long(x) __builtin_astype((x), long) |
| 557 | #define as_long2(x) __builtin_astype((x), long2) |
| 558 | #define as_long3(x) __builtin_astype((x), long3) |
| 559 | #define as_long4(x) __builtin_astype((x), long4) |
| 560 | #define as_long8(x) __builtin_astype((x), long8) |
| 561 | #define as_long16(x) __builtin_astype((x), long16) |
| 562 | |
| 563 | #define as_ulong(x) __builtin_astype((x), ulong) |
| 564 | #define as_ulong2(x) __builtin_astype((x), ulong2) |
| 565 | #define as_ulong3(x) __builtin_astype((x), ulong3) |
| 566 | #define as_ulong4(x) __builtin_astype((x), ulong4) |
| 567 | #define as_ulong8(x) __builtin_astype((x), ulong8) |
| 568 | #define as_ulong16(x) __builtin_astype((x), ulong16) |
| 569 | |
| 570 | #define as_float(x) __builtin_astype((x), float) |
| 571 | #define as_float2(x) __builtin_astype((x), float2) |
| 572 | #define as_float3(x) __builtin_astype((x), float3) |
| 573 | #define as_float4(x) __builtin_astype((x), float4) |
| 574 | #define as_float8(x) __builtin_astype((x), float8) |
| 575 | #define as_float16(x) __builtin_astype((x), float16) |
| 576 | |
| 577 | #ifdef cl_khr_fp64 |
| 578 | #define as_double(x) __builtin_astype((x), double) |
| 579 | #define as_double2(x) __builtin_astype((x), double2) |
| 580 | #define as_double3(x) __builtin_astype((x), double3) |
| 581 | #define as_double4(x) __builtin_astype((x), double4) |
| 582 | #define as_double8(x) __builtin_astype((x), double8) |
| 583 | #define as_double16(x) __builtin_astype((x), double16) |
| 584 | #endif // cl_khr_fp64 |
| 585 | |
| 586 | #ifdef cl_khr_fp16 |
| 587 | #define as_half(x) __builtin_astype((x), half) |
| 588 | #define as_half2(x) __builtin_astype((x), half2) |
| 589 | #define as_half3(x) __builtin_astype((x), half3) |
| 590 | #define as_half4(x) __builtin_astype((x), half4) |
| 591 | #define as_half8(x) __builtin_astype((x), half8) |
| 592 | #define as_half16(x) __builtin_astype((x), half16) |
| 593 | #endif // cl_khr_fp16 |
| 594 | |
| 595 | #define as_size_t(x) __builtin_astype((x), size_t) |
| 596 | #define as_ptrdiff_t(x) __builtin_astype((x), ptrdiff_t) |
| 597 | #define as_intptr_t(x) __builtin_astype((x), intptr_t) |
| 598 | #define as_uintptr_t(x) __builtin_astype((x), uintptr_t) |
| 599 | |
Pirama Arumuga Nainar | 494f645 | 2021-12-02 10:42:14 -0800 | [diff] [blame] | 600 | // C++ for OpenCL - __remove_address_space |
| 601 | #if defined(__OPENCL_CPP_VERSION__) |
| 602 | template <typename _Tp> struct __remove_address_space { using type = _Tp; }; |
| 603 | template <typename _Tp> struct __remove_address_space<__generic _Tp> { |
| 604 | using type = _Tp; |
| 605 | }; |
| 606 | template <typename _Tp> struct __remove_address_space<__global _Tp> { |
| 607 | using type = _Tp; |
| 608 | }; |
| 609 | template <typename _Tp> struct __remove_address_space<__private _Tp> { |
| 610 | using type = _Tp; |
| 611 | }; |
| 612 | template <typename _Tp> struct __remove_address_space<__local _Tp> { |
| 613 | using type = _Tp; |
| 614 | }; |
| 615 | template <typename _Tp> struct __remove_address_space<__constant _Tp> { |
| 616 | using type = _Tp; |
| 617 | }; |
| 618 | #endif |
| 619 | |
Pirama Arumuga Nainar | 7e1f839 | 2021-08-16 17:30:48 -0700 | [diff] [blame] | 620 | // OpenCL v1.1 s6.9, v1.2/2.0 s6.10 - Function qualifiers |
| 621 | |
| 622 | #define __kernel_exec(X, typen) __kernel \ |
| 623 | __attribute__((work_group_size_hint(X, 1, 1))) \ |
| 624 | __attribute__((vec_type_hint(typen))) |
| 625 | |
| 626 | #define kernel_exec(X, typen) __kernel \ |
| 627 | __attribute__((work_group_size_hint(X, 1, 1))) \ |
| 628 | __attribute__((vec_type_hint(typen))) |
| 629 | |
| 630 | #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2) |
| 631 | // OpenCL v1.2 s6.12.13, v2.0 s6.13.13 - printf |
| 632 | |
| 633 | int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2))); |
| 634 | #endif |
| 635 | |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 636 | #ifdef cl_intel_device_side_avc_motion_estimation |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 637 | |
| 638 | #define CLK_AVC_ME_MAJOR_16x16_INTEL 0x0 |
| 639 | #define CLK_AVC_ME_MAJOR_16x8_INTEL 0x1 |
| 640 | #define CLK_AVC_ME_MAJOR_8x16_INTEL 0x2 |
| 641 | #define CLK_AVC_ME_MAJOR_8x8_INTEL 0x3 |
| 642 | |
| 643 | #define CLK_AVC_ME_MINOR_8x8_INTEL 0x0 |
| 644 | #define CLK_AVC_ME_MINOR_8x4_INTEL 0x1 |
| 645 | #define CLK_AVC_ME_MINOR_4x8_INTEL 0x2 |
| 646 | #define CLK_AVC_ME_MINOR_4x4_INTEL 0x3 |
| 647 | |
| 648 | #define CLK_AVC_ME_MAJOR_FORWARD_INTEL 0x0 |
| 649 | #define CLK_AVC_ME_MAJOR_BACKWARD_INTEL 0x1 |
| 650 | #define CLK_AVC_ME_MAJOR_BIDIRECTIONAL_INTEL 0x2 |
| 651 | |
| 652 | #define CLK_AVC_ME_PARTITION_MASK_ALL_INTEL 0x0 |
| 653 | #define CLK_AVC_ME_PARTITION_MASK_16x16_INTEL 0x7E |
| 654 | #define CLK_AVC_ME_PARTITION_MASK_16x8_INTEL 0x7D |
| 655 | #define CLK_AVC_ME_PARTITION_MASK_8x16_INTEL 0x7B |
| 656 | #define CLK_AVC_ME_PARTITION_MASK_8x8_INTEL 0x77 |
| 657 | #define CLK_AVC_ME_PARTITION_MASK_8x4_INTEL 0x6F |
| 658 | #define CLK_AVC_ME_PARTITION_MASK_4x8_INTEL 0x5F |
| 659 | #define CLK_AVC_ME_PARTITION_MASK_4x4_INTEL 0x3F |
| 660 | |
| 661 | #define CLK_AVC_ME_SLICE_TYPE_PRED_INTEL 0x0 |
| 662 | #define CLK_AVC_ME_SLICE_TYPE_BPRED_INTEL 0x1 |
| 663 | #define CLK_AVC_ME_SLICE_TYPE_INTRA_INTEL 0x2 |
| 664 | |
| 665 | #define CLK_AVC_ME_SEARCH_WINDOW_EXHAUSTIVE_INTEL 0x0 |
| 666 | #define CLK_AVC_ME_SEARCH_WINDOW_SMALL_INTEL 0x1 |
| 667 | #define CLK_AVC_ME_SEARCH_WINDOW_TINY_INTEL 0x2 |
| 668 | #define CLK_AVC_ME_SEARCH_WINDOW_EXTRA_TINY_INTEL 0x3 |
| 669 | #define CLK_AVC_ME_SEARCH_WINDOW_DIAMOND_INTEL 0x4 |
| 670 | #define CLK_AVC_ME_SEARCH_WINDOW_LARGE_DIAMOND_INTEL 0x5 |
| 671 | #define CLK_AVC_ME_SEARCH_WINDOW_RESERVED0_INTEL 0x6 |
| 672 | #define CLK_AVC_ME_SEARCH_WINDOW_RESERVED1_INTEL 0x7 |
| 673 | #define CLK_AVC_ME_SEARCH_WINDOW_CUSTOM_INTEL 0x8 |
| 674 | |
| 675 | #define CLK_AVC_ME_SAD_ADJUST_MODE_NONE_INTEL 0x0 |
| 676 | #define CLK_AVC_ME_SAD_ADJUST_MODE_HAAR_INTEL 0x2 |
| 677 | |
| 678 | #define CLK_AVC_ME_SUBPIXEL_MODE_INTEGER_INTEL 0x0 |
| 679 | #define CLK_AVC_ME_SUBPIXEL_MODE_HPEL_INTEL 0x1 |
| 680 | #define CLK_AVC_ME_SUBPIXEL_MODE_QPEL_INTEL 0x3 |
| 681 | |
| 682 | #define CLK_AVC_ME_COST_PRECISION_QPEL_INTEL 0x0 |
| 683 | #define CLK_AVC_ME_COST_PRECISION_HPEL_INTEL 0x1 |
| 684 | #define CLK_AVC_ME_COST_PRECISION_PEL_INTEL 0x2 |
| 685 | #define CLK_AVC_ME_COST_PRECISION_DPEL_INTEL 0x3 |
| 686 | |
| 687 | #define CLK_AVC_ME_BIDIR_WEIGHT_QUARTER_INTEL 0x10 |
| 688 | #define CLK_AVC_ME_BIDIR_WEIGHT_THIRD_INTEL 0x15 |
| 689 | #define CLK_AVC_ME_BIDIR_WEIGHT_HALF_INTEL 0x20 |
| 690 | #define CLK_AVC_ME_BIDIR_WEIGHT_TWO_THIRD_INTEL 0x2B |
| 691 | #define CLK_AVC_ME_BIDIR_WEIGHT_THREE_QUARTER_INTEL 0x30 |
| 692 | |
| 693 | #define CLK_AVC_ME_BORDER_REACHED_LEFT_INTEL 0x0 |
| 694 | #define CLK_AVC_ME_BORDER_REACHED_RIGHT_INTEL 0x2 |
| 695 | #define CLK_AVC_ME_BORDER_REACHED_TOP_INTEL 0x4 |
| 696 | #define CLK_AVC_ME_BORDER_REACHED_BOTTOM_INTEL 0x8 |
| 697 | |
| 698 | #define CLK_AVC_ME_INTRA_16x16_INTEL 0x0 |
| 699 | #define CLK_AVC_ME_INTRA_8x8_INTEL 0x1 |
| 700 | #define CLK_AVC_ME_INTRA_4x4_INTEL 0x2 |
| 701 | |
| 702 | #define CLK_AVC_ME_SKIP_BLOCK_PARTITION_16x16_INTEL 0x0 |
| 703 | #define CLK_AVC_ME_SKIP_BLOCK_PARTITION_8x8_INTEL 0x4000 |
| 704 | |
| 705 | #define CLK_AVC_ME_SKIP_BLOCK_16x16_FORWARD_ENABLE_INTEL (0x1 << 24) |
| 706 | #define CLK_AVC_ME_SKIP_BLOCK_16x16_BACKWARD_ENABLE_INTEL (0x2 << 24) |
| 707 | #define CLK_AVC_ME_SKIP_BLOCK_16x16_DUAL_ENABLE_INTEL (0x3 << 24) |
| 708 | #define CLK_AVC_ME_SKIP_BLOCK_8x8_FORWARD_ENABLE_INTEL (0x55 << 24) |
| 709 | #define CLK_AVC_ME_SKIP_BLOCK_8x8_BACKWARD_ENABLE_INTEL (0xAA << 24) |
| 710 | #define CLK_AVC_ME_SKIP_BLOCK_8x8_DUAL_ENABLE_INTEL (0xFF << 24) |
| 711 | #define CLK_AVC_ME_SKIP_BLOCK_8x8_0_FORWARD_ENABLE_INTEL (0x1 << 24) |
| 712 | #define CLK_AVC_ME_SKIP_BLOCK_8x8_0_BACKWARD_ENABLE_INTEL (0x2 << 24) |
| 713 | #define CLK_AVC_ME_SKIP_BLOCK_8x8_1_FORWARD_ENABLE_INTEL (0x1 << 26) |
| 714 | #define CLK_AVC_ME_SKIP_BLOCK_8x8_1_BACKWARD_ENABLE_INTEL (0x2 << 26) |
| 715 | #define CLK_AVC_ME_SKIP_BLOCK_8x8_2_FORWARD_ENABLE_INTEL (0x1 << 28) |
| 716 | #define CLK_AVC_ME_SKIP_BLOCK_8x8_2_BACKWARD_ENABLE_INTEL (0x2 << 28) |
| 717 | #define CLK_AVC_ME_SKIP_BLOCK_8x8_3_FORWARD_ENABLE_INTEL (0x1 << 30) |
| 718 | #define CLK_AVC_ME_SKIP_BLOCK_8x8_3_BACKWARD_ENABLE_INTEL (0x2 << 30) |
| 719 | |
| 720 | #define CLK_AVC_ME_BLOCK_BASED_SKIP_4x4_INTEL 0x00 |
| 721 | #define CLK_AVC_ME_BLOCK_BASED_SKIP_8x8_INTEL 0x80 |
| 722 | |
| 723 | #define CLK_AVC_ME_INTRA_LUMA_PARTITION_MASK_ALL_INTEL 0x0 |
| 724 | #define CLK_AVC_ME_INTRA_LUMA_PARTITION_MASK_16x16_INTEL 0x6 |
| 725 | #define CLK_AVC_ME_INTRA_LUMA_PARTITION_MASK_8x8_INTEL 0x5 |
| 726 | #define CLK_AVC_ME_INTRA_LUMA_PARTITION_MASK_4x4_INTEL 0x3 |
| 727 | |
| 728 | #define CLK_AVC_ME_INTRA_NEIGHBOR_LEFT_MASK_ENABLE_INTEL 0x60 |
| 729 | #define CLK_AVC_ME_INTRA_NEIGHBOR_UPPER_MASK_ENABLE_INTEL 0x10 |
| 730 | #define CLK_AVC_ME_INTRA_NEIGHBOR_UPPER_RIGHT_MASK_ENABLE_INTEL 0x8 |
| 731 | #define CLK_AVC_ME_INTRA_NEIGHBOR_UPPER_LEFT_MASK_ENABLE_INTEL 0x4 |
| 732 | |
| 733 | #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_INTEL 0x0 |
| 734 | #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1 |
| 735 | #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_DC_INTEL 0x2 |
| 736 | #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_LEFT_INTEL 0x3 |
| 737 | #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_RIGHT_INTEL 0x4 |
| 738 | #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_PLANE_INTEL 0x4 |
| 739 | #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_RIGHT_INTEL 0x5 |
| 740 | #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_DOWN_INTEL 0x6 |
| 741 | #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_LEFT_INTEL 0x7 |
| 742 | #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_UP_INTEL 0x8 |
| 743 | #define CLK_AVC_ME_CHROMA_PREDICTOR_MODE_DC_INTEL 0x0 |
| 744 | #define CLK_AVC_ME_CHROMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1 |
| 745 | #define CLK_AVC_ME_CHROMA_PREDICTOR_MODE_VERTICAL_INTEL 0x2 |
| 746 | #define CLK_AVC_ME_CHROMA_PREDICTOR_MODE_PLANE_INTEL 0x3 |
| 747 | |
| 748 | #define CLK_AVC_ME_FRAME_FORWARD_INTEL 0x1 |
| 749 | #define CLK_AVC_ME_FRAME_BACKWARD_INTEL 0x2 |
| 750 | #define CLK_AVC_ME_FRAME_DUAL_INTEL 0x3 |
| 751 | |
| 752 | #define CLK_AVC_ME_INTERLACED_SCAN_TOP_FIELD_INTEL 0x0 |
| 753 | #define CLK_AVC_ME_INTERLACED_SCAN_BOTTOM_FIELD_INTEL 0x1 |
| 754 | |
| 755 | #define CLK_AVC_ME_INITIALIZE_INTEL 0x0 |
| 756 | |
| 757 | #define CLK_AVC_IME_PAYLOAD_INITIALIZE_INTEL 0x0 |
| 758 | #define CLK_AVC_REF_PAYLOAD_INITIALIZE_INTEL 0x0 |
| 759 | #define CLK_AVC_SIC_PAYLOAD_INITIALIZE_INTEL 0x0 |
| 760 | |
| 761 | #define CLK_AVC_IME_RESULT_INITIALIZE_INTEL 0x0 |
| 762 | #define CLK_AVC_REF_RESULT_INITIALIZE_INTEL 0x0 |
| 763 | #define CLK_AVC_SIC_RESULT_INITIALIZE_INTEL 0x0 |
| 764 | |
| 765 | #define CLK_AVC_IME_RESULT_SINGLE_REFERENCE_STREAMOUT_INITIALIZE_INTEL 0x0 |
| 766 | #define CLK_AVC_IME_RESULT_SINGLE_REFERENCE_STREAMIN_INITIALIZE_INTEL 0x0 |
| 767 | #define CLK_AVC_IME_RESULT_DUAL_REFERENCE_STREAMOUT_INITIALIZE_INTEL 0x0 |
| 768 | #define CLK_AVC_IME_RESULT_DUAL_REFERENCE_STREAMIN_INITIALIZE_INTEL 0x0 |
| 769 | |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 770 | #endif // cl_intel_device_side_avc_motion_estimation |
| 771 | |
Pirama Arumuga Nainar | 986b880 | 2021-06-03 16:00:34 -0700 | [diff] [blame] | 772 | // Disable any extensions we may have enabled previously. |
| 773 | #pragma OPENCL EXTENSION all : disable |
| 774 | |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 775 | #endif //_OPENCL_BASE_H_ |