| 
 | 1 | +//==-------- generic_type_lists.hpp - SYCL Generic type lists --------------==//  | 
 | 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 | +#include <CL/sycl/access/access.hpp>  | 
 | 10 | +#include <CL/sycl/detail/stl_type_traits.hpp>  | 
 | 11 | +#include <CL/sycl/detail/type_list.hpp>  | 
 | 12 | +#include <CL/sycl/half_type.hpp>  | 
 | 13 | + | 
 | 14 | +// Generic type name description, which serves as a description for all valid  | 
 | 15 | +// types of parameters to kernel functions  | 
 | 16 | + | 
 | 17 | +// Forward declaration  | 
 | 18 | +namespace cl {  | 
 | 19 | +namespace sycl {  | 
 | 20 | +template <typename T, int N> class vec;  | 
 | 21 | +} // namespace sycl  | 
 | 22 | +} // namespace cl  | 
 | 23 | + | 
 | 24 | +namespace cl {  | 
 | 25 | +namespace sycl {  | 
 | 26 | +namespace detail {  | 
 | 27 | +namespace gtl {  | 
 | 28 | +// floating point types  | 
 | 29 | +using scalar_half_list = type_list<half>;  | 
 | 30 | + | 
 | 31 | +using vector_half_list = type_list<vec<half, 1>, vec<half, 2>, vec<half, 3>,  | 
 | 32 | +                                   vec<half, 4>, vec<half, 8>, vec<half, 16>>;  | 
 | 33 | + | 
 | 34 | +using half_list = type_list<scalar_half_list, vector_half_list>;  | 
 | 35 | + | 
 | 36 | +using scalar_float_list = type_list<float>;  | 
 | 37 | + | 
 | 38 | +using vector_float_list =  | 
 | 39 | +    type_list<vec<float, 1>, vec<float, 2>, vec<float, 3>, vec<float, 4>,  | 
 | 40 | +              vec<float, 8>, vec<float, 16>>;  | 
 | 41 | + | 
 | 42 | +using float_list = type_list<scalar_float_list, vector_float_list>;  | 
 | 43 | + | 
 | 44 | +using scalar_double_list = type_list<double>;  | 
 | 45 | + | 
 | 46 | +using vector_double_list =  | 
 | 47 | +    type_list<vec<double, 1>, vec<double, 2>, vec<double, 3>, vec<double, 4>,  | 
 | 48 | +              vec<double, 8>, vec<double, 16>>;  | 
 | 49 | + | 
 | 50 | +using double_list = type_list<scalar_double_list, vector_double_list>;  | 
 | 51 | + | 
 | 52 | +using scalar_floating_list =  | 
 | 53 | +    type_list<scalar_float_list, scalar_double_list, scalar_half_list>;  | 
 | 54 | + | 
 | 55 | +using vector_floating_list =  | 
 | 56 | +    type_list<vector_float_list, vector_double_list, vector_half_list>;  | 
 | 57 | + | 
 | 58 | +using floating_list = type_list<scalar_floating_list, vector_floating_list>;  | 
 | 59 | + | 
 | 60 | +// geometric floating point types  | 
 | 61 | +using scalar_geo_half_list = type_list<half>;  | 
 | 62 | + | 
 | 63 | +using scalar_geo_float_list = type_list<float>;  | 
 | 64 | + | 
 | 65 | +using scalar_geo_double_list = type_list<double>;  | 
 | 66 | + | 
 | 67 | +using vector_geo_half_list =  | 
 | 68 | +    type_list<vec<half, 1>, vec<half, 2>, vec<half, 3>, vec<half, 4>>;  | 
 | 69 | + | 
 | 70 | +using vector_geo_float_list =  | 
 | 71 | +    type_list<vec<float, 1>, vec<float, 2>, vec<float, 3>, vec<float, 4>>;  | 
 | 72 | + | 
 | 73 | +using vector_geo_double_list =  | 
 | 74 | +    type_list<vec<double, 1>, vec<double, 2>, vec<double, 3>, vec<double, 4>>;  | 
 | 75 | + | 
 | 76 | +using geo_half_list = type_list<scalar_geo_half_list, vector_geo_half_list>;  | 
 | 77 | + | 
 | 78 | +using geo_float_list = type_list<scalar_geo_float_list, vector_geo_float_list>;  | 
 | 79 | + | 
 | 80 | +using geo_double_list =  | 
 | 81 | +    type_list<scalar_geo_double_list, vector_geo_double_list>;  | 
 | 82 | + | 
 | 83 | +using scalar_geo_list = type_list<scalar_geo_half_list, scalar_geo_float_list,  | 
 | 84 | +                                  scalar_geo_double_list>;  | 
 | 85 | + | 
 | 86 | +using vector_geo_list = type_list<vector_geo_half_list, vector_geo_float_list,  | 
 | 87 | +                                  vector_geo_double_list>;  | 
 | 88 | + | 
 | 89 | +using geo_list = type_list<scalar_geo_list, vector_geo_list>;  | 
 | 90 | + | 
 | 91 | +// cross floating point types  | 
 | 92 | +using cross_half_list = type_list<vec<half, 3>, vec<half, 4>>;  | 
 | 93 | + | 
 | 94 | +using cross_float_list = type_list<vec<float, 3>, vec<float, 4>>;  | 
 | 95 | + | 
 | 96 | +using cross_double_list = type_list<vec<double, 3>, vec<double, 4>>;  | 
 | 97 | + | 
 | 98 | +using cross_floating_list =  | 
 | 99 | +    type_list<cross_float_list, cross_double_list, cross_half_list>;  | 
 | 100 | + | 
 | 101 | +using scalar_default_char_list = type_list<char>;  | 
 | 102 | + | 
 | 103 | +using vector_default_char_list =  | 
 | 104 | +    type_list<vec<char, 1>, vec<char, 2>, vec<char, 3>, vec<char, 4>,  | 
 | 105 | +              vec<char, 8>, vec<char, 16>>;  | 
 | 106 | + | 
 | 107 | +using default_char_list =  | 
 | 108 | +    type_list<scalar_default_char_list, vector_default_char_list>;  | 
 | 109 | + | 
 | 110 | +using scalar_signed_char_list = type_list<signed char>;  | 
 | 111 | + | 
 | 112 | +using vector_signed_char_list =  | 
 | 113 | +    type_list<vec<signed char, 1>, vec<signed char, 2>, vec<signed char, 3>,  | 
 | 114 | +              vec<signed char, 4>, vec<signed char, 8>, vec<signed char, 16>>;  | 
 | 115 | + | 
 | 116 | +using signed_char_list =  | 
 | 117 | +    type_list<scalar_signed_char_list, vector_signed_char_list>;  | 
 | 118 | + | 
 | 119 | +using scalar_unsigned_char_list = type_list<unsigned char>;  | 
 | 120 | + | 
 | 121 | +using vector_unsigned_char_list =  | 
 | 122 | +    type_list<vec<unsigned char, 1>, vec<unsigned char, 2>,  | 
 | 123 | +              vec<unsigned char, 3>, vec<unsigned char, 4>,  | 
 | 124 | +              vec<unsigned char, 8>, vec<unsigned char, 16>>;  | 
 | 125 | + | 
 | 126 | +using unsigned_char_list =  | 
 | 127 | +    type_list<scalar_unsigned_char_list, vector_unsigned_char_list>;  | 
 | 128 | + | 
 | 129 | +using scalar_char_list =  | 
 | 130 | +    type_list<scalar_default_char_list, scalar_signed_char_list,  | 
 | 131 | +              scalar_unsigned_char_list>;  | 
 | 132 | + | 
 | 133 | +using vector_char_list =  | 
 | 134 | +    type_list<vector_default_char_list, vector_signed_char_list,  | 
 | 135 | +              vector_unsigned_char_list>;  | 
 | 136 | + | 
 | 137 | +using char_list = type_list<scalar_char_list, vector_char_list>;  | 
 | 138 | + | 
 | 139 | +// short int types  | 
 | 140 | +using scalar_signed_short_list = type_list<signed short>;  | 
 | 141 | + | 
 | 142 | +using vector_signed_short_list =  | 
 | 143 | +    type_list<vec<signed short, 1>, vec<signed short, 2>, vec<signed short, 3>,  | 
 | 144 | +              vec<signed short, 4>, vec<signed short, 8>,  | 
 | 145 | +              vec<signed short, 16>>;  | 
 | 146 | + | 
 | 147 | +using signed_short_list =  | 
 | 148 | +    type_list<scalar_signed_short_list, vector_signed_short_list>;  | 
 | 149 | + | 
 | 150 | +using scalar_unsigned_short_list = type_list<unsigned short>;  | 
 | 151 | + | 
 | 152 | +using vector_unsigned_short_list =  | 
 | 153 | +    type_list<vec<unsigned short, 1>, vec<unsigned short, 2>,  | 
 | 154 | +              vec<unsigned short, 3>, vec<unsigned short, 4>,  | 
 | 155 | +              vec<unsigned short, 8>, vec<unsigned short, 16>>;  | 
 | 156 | + | 
 | 157 | +using unsigned_short_list =  | 
 | 158 | +    type_list<scalar_unsigned_short_list, vector_unsigned_short_list>;  | 
 | 159 | + | 
 | 160 | +using scalar_short_list =  | 
 | 161 | +    type_list<scalar_signed_short_list, scalar_unsigned_short_list>;  | 
 | 162 | + | 
 | 163 | +using vector_short_list =  | 
 | 164 | +    type_list<vector_signed_short_list, vector_unsigned_short_list>;  | 
 | 165 | + | 
 | 166 | +using short_list = type_list<scalar_short_list, vector_short_list>;  | 
 | 167 | + | 
 | 168 | +// int types  | 
 | 169 | +using scalar_signed_int_list = type_list<signed int>;  | 
 | 170 | + | 
 | 171 | +using vector_signed_int_list =  | 
 | 172 | +    type_list<vec<signed int, 1>, vec<signed int, 2>, vec<signed int, 3>,  | 
 | 173 | +              vec<signed int, 4>, vec<signed int, 8>, vec<signed int, 16>>;  | 
 | 174 | + | 
 | 175 | +using signed_int_list =  | 
 | 176 | +    type_list<scalar_signed_int_list, vector_signed_int_list>;  | 
 | 177 | + | 
 | 178 | +using scalar_unsigned_int_list = type_list<unsigned int>;  | 
 | 179 | + | 
 | 180 | +using vector_unsigned_int_list =  | 
 | 181 | +    type_list<vec<unsigned int, 1>, vec<unsigned int, 2>, vec<unsigned int, 3>,  | 
 | 182 | +              vec<unsigned int, 4>, vec<unsigned int, 8>,  | 
 | 183 | +              vec<unsigned int, 16>>;  | 
 | 184 | + | 
 | 185 | +using unsigned_int_list =  | 
 | 186 | +    type_list<scalar_unsigned_int_list, vector_unsigned_int_list>;  | 
 | 187 | + | 
 | 188 | +using scalar_int_list =  | 
 | 189 | +    type_list<scalar_signed_int_list, scalar_unsigned_int_list>;  | 
 | 190 | + | 
 | 191 | +using vector_int_list =  | 
 | 192 | +    type_list<vector_signed_int_list, vector_unsigned_int_list>;  | 
 | 193 | + | 
 | 194 | +using int_list = type_list<scalar_int_list, vector_int_list>;  | 
 | 195 | + | 
 | 196 | +// long types  | 
 | 197 | +using scalar_signed_long_list = type_list<signed long>;  | 
 | 198 | + | 
 | 199 | +using vector_signed_long_list =  | 
 | 200 | +    type_list<vec<signed long, 1>, vec<signed long, 2>, vec<signed long, 3>,  | 
 | 201 | +              vec<signed long, 4>, vec<signed long, 8>, vec<signed long, 16>>;  | 
 | 202 | + | 
 | 203 | +using signed_long_list =  | 
 | 204 | +    type_list<scalar_signed_long_list, vector_signed_long_list>;  | 
 | 205 | + | 
 | 206 | +using scalar_unsigned_long_list = type_list<unsigned long>;  | 
 | 207 | + | 
 | 208 | +using vector_unsigned_long_list =  | 
 | 209 | +    type_list<vec<unsigned long, 1>, vec<unsigned long, 2>,  | 
 | 210 | +              vec<unsigned long, 3>, vec<unsigned long, 4>,  | 
 | 211 | +              vec<unsigned long, 8>, vec<unsigned long, 16>>;  | 
 | 212 | + | 
 | 213 | +using unsigned_long_list =  | 
 | 214 | +    type_list<scalar_unsigned_long_list, vector_unsigned_long_list>;  | 
 | 215 | + | 
 | 216 | +using scalar_long_list =  | 
 | 217 | +    type_list<scalar_signed_long_list, scalar_unsigned_long_list>;  | 
 | 218 | + | 
 | 219 | +using vector_long_list =  | 
 | 220 | +    type_list<vector_signed_long_list, vector_unsigned_long_list>;  | 
 | 221 | + | 
 | 222 | +using long_list = type_list<scalar_long_list, vector_long_list>;  | 
 | 223 | + | 
 | 224 | +// long long types  | 
 | 225 | +using scalar_signed_longlong_list = type_list<signed long long>;  | 
 | 226 | + | 
 | 227 | +using vector_signed_longlong_list =  | 
 | 228 | +    type_list<vec<signed long long, 1>, vec<signed long long, 2>,  | 
 | 229 | +              vec<signed long long, 3>, vec<signed long long, 4>,  | 
 | 230 | +              vec<signed long long, 8>, vec<signed long long, 16>>;  | 
 | 231 | + | 
 | 232 | +using signed_longlong_list =  | 
 | 233 | +    type_list<scalar_signed_longlong_list, vector_signed_longlong_list>;  | 
 | 234 | + | 
 | 235 | +using scalar_unsigned_longlong_list = type_list<unsigned long long>;  | 
 | 236 | + | 
 | 237 | +using vector_unsigned_longlong_list =  | 
 | 238 | +    type_list<vec<unsigned long long, 1>, vec<unsigned long long, 2>,  | 
 | 239 | +              vec<unsigned long long, 3>, vec<unsigned long long, 4>,  | 
 | 240 | +              vec<unsigned long long, 8>, vec<unsigned long long, 16>>;  | 
 | 241 | + | 
 | 242 | +using unsigned_longlong_list =  | 
 | 243 | +    type_list<scalar_unsigned_longlong_list, vector_unsigned_longlong_list>;  | 
 | 244 | + | 
 | 245 | +using scalar_longlong_list =  | 
 | 246 | +    type_list<scalar_signed_longlong_list, scalar_unsigned_longlong_list>;  | 
 | 247 | + | 
 | 248 | +using vector_longlong_list =  | 
 | 249 | +    type_list<vector_signed_longlong_list, vector_unsigned_longlong_list>;  | 
 | 250 | + | 
 | 251 | +using longlong_list = type_list<scalar_longlong_list, vector_longlong_list>;  | 
 | 252 | + | 
 | 253 | +// long integer types  | 
 | 254 | +using scalar_signed_long_integer_list =  | 
 | 255 | +    type_list<scalar_signed_long_list, scalar_signed_longlong_list>;  | 
 | 256 | + | 
 | 257 | +using vector_signed_long_integer_list =  | 
 | 258 | +    type_list<vector_signed_long_list, vector_signed_longlong_list>;  | 
 | 259 | + | 
 | 260 | +using signed_long_integer_list =  | 
 | 261 | +    type_list<scalar_signed_long_integer_list, vector_signed_long_integer_list>;  | 
 | 262 | + | 
 | 263 | +using scalar_unsigned_long_integer_list =  | 
 | 264 | +    type_list<scalar_unsigned_long_list, scalar_unsigned_longlong_list>;  | 
 | 265 | + | 
 | 266 | +using vector_unsigned_long_integer_list =  | 
 | 267 | +    type_list<vector_unsigned_long_list, vector_unsigned_longlong_list>;  | 
 | 268 | + | 
 | 269 | +using unsigned_long_integer_list = type_list<scalar_unsigned_long_integer_list,  | 
 | 270 | +                                             vector_unsigned_long_integer_list>;  | 
 | 271 | + | 
 | 272 | +using scalar_long_integer_list = type_list<scalar_signed_long_integer_list,  | 
 | 273 | +                                           scalar_unsigned_long_integer_list>;  | 
 | 274 | + | 
 | 275 | +using vector_long_integer_list = type_list<vector_signed_long_integer_list,  | 
 | 276 | +                                           vector_unsigned_long_integer_list>;  | 
 | 277 | + | 
 | 278 | +using long_integer_list =  | 
 | 279 | +    type_list<scalar_long_integer_list, vector_long_integer_list>;  | 
 | 280 | + | 
 | 281 | +// integer types  | 
 | 282 | +using scalar_signed_integer_list = type_list<  | 
 | 283 | +    conditional_t<std::is_signed<char>::value,  | 
 | 284 | +                  type_list<scalar_default_char_list, scalar_signed_char_list>,  | 
 | 285 | +                  scalar_signed_char_list>,  | 
 | 286 | +    scalar_signed_short_list, scalar_signed_int_list, scalar_signed_long_list,  | 
 | 287 | +    scalar_signed_longlong_list>;  | 
 | 288 | + | 
 | 289 | +using vector_signed_integer_list = type_list<  | 
 | 290 | +    conditional_t<std::is_signed<char>::value,  | 
 | 291 | +                  type_list<vector_default_char_list, vector_signed_char_list>,  | 
 | 292 | +                  vector_signed_char_list>,  | 
 | 293 | +    vector_signed_short_list, vector_signed_int_list, vector_signed_long_list,  | 
 | 294 | +    vector_signed_longlong_list>;  | 
 | 295 | + | 
 | 296 | +using signed_integer_list =  | 
 | 297 | +    type_list<scalar_signed_integer_list, vector_signed_integer_list>;  | 
 | 298 | + | 
 | 299 | +using scalar_unsigned_integer_list =  | 
 | 300 | +    type_list<conditional_t<std::is_unsigned<char>::value,  | 
 | 301 | +                            type_list<scalar_default_char_list,  | 
 | 302 | +                                      scalar_unsigned_char_list>,  | 
 | 303 | +                            scalar_unsigned_char_list>,  | 
 | 304 | +              scalar_unsigned_short_list, scalar_unsigned_int_list,  | 
 | 305 | +              scalar_unsigned_long_list, scalar_unsigned_longlong_list>;  | 
 | 306 | + | 
 | 307 | +using vector_unsigned_integer_list =  | 
 | 308 | +    type_list<conditional_t<std::is_unsigned<char>::value,  | 
 | 309 | +                            type_list<vector_default_char_list,  | 
 | 310 | +                                      vector_unsigned_char_list>,  | 
 | 311 | +                            vector_unsigned_char_list>,  | 
 | 312 | +              vector_unsigned_short_list, vector_unsigned_int_list,  | 
 | 313 | +              vector_unsigned_long_list, vector_unsigned_longlong_list>;  | 
 | 314 | + | 
 | 315 | +using unsigned_integer_list =  | 
 | 316 | +    type_list<scalar_unsigned_integer_list, vector_unsigned_integer_list>;  | 
 | 317 | + | 
 | 318 | +using scalar_integer_list =  | 
 | 319 | +    type_list<scalar_signed_integer_list, scalar_unsigned_integer_list>;  | 
 | 320 | + | 
 | 321 | +using vector_integer_list =  | 
 | 322 | +    type_list<vector_signed_integer_list, vector_unsigned_integer_list>;  | 
 | 323 | + | 
 | 324 | +using integer_list = type_list<scalar_integer_list, vector_integer_list>;  | 
 | 325 | + | 
 | 326 | +// basic types  | 
 | 327 | +using scalar_signed_basic_list =  | 
 | 328 | +    type_list<scalar_floating_list, scalar_signed_integer_list>;  | 
 | 329 | + | 
 | 330 | +using vector_signed_basic_list =  | 
 | 331 | +    type_list<vector_floating_list, vector_signed_integer_list>;  | 
 | 332 | + | 
 | 333 | +using signed_basic_list =  | 
 | 334 | +    type_list<scalar_signed_basic_list, vector_signed_basic_list>;  | 
 | 335 | + | 
 | 336 | +using scalar_unsigned_basic_list = type_list<scalar_unsigned_integer_list>;  | 
 | 337 | + | 
 | 338 | +using vector_unsigned_basic_list = type_list<vector_unsigned_integer_list>;  | 
 | 339 | + | 
 | 340 | +using unsigned_basic_list =  | 
 | 341 | +    type_list<scalar_unsigned_basic_list, vector_unsigned_basic_list>;  | 
 | 342 | + | 
 | 343 | +using scalar_basic_list =  | 
 | 344 | +    type_list<scalar_signed_basic_list, scalar_unsigned_basic_list>;  | 
 | 345 | + | 
 | 346 | +using vector_basic_list =  | 
 | 347 | +    type_list<vector_signed_basic_list, vector_unsigned_basic_list>;  | 
 | 348 | + | 
 | 349 | +using basic_list = type_list<scalar_basic_list, vector_basic_list>;  | 
 | 350 | + | 
 | 351 | +// nan builtin types  | 
 | 352 | +using nan_list = type_list<gtl::unsigned_short_list, gtl::unsigned_int_list,  | 
 | 353 | +                           gtl::unsigned_long_integer_list>;  | 
 | 354 | +} // namespace gtl  | 
 | 355 | +namespace gvl {  | 
 | 356 | +// address spaces  | 
 | 357 | +using all_address_space_list =  | 
 | 358 | +    address_space_list<access::address_space::local_space,  | 
 | 359 | +                       access::address_space::global_space,  | 
 | 360 | +                       access::address_space::private_space,  | 
 | 361 | +                       access::address_space::constant_space>;  | 
 | 362 | + | 
 | 363 | +using nonconst_address_space_list =  | 
 | 364 | +    address_space_list<access::address_space::local_space,  | 
 | 365 | +                       access::address_space::global_space,  | 
 | 366 | +                       access::address_space::private_space>;  | 
 | 367 | + | 
 | 368 | +using nonlocal_address_space_list =  | 
 | 369 | +    address_space_list<access::address_space::global_space,  | 
 | 370 | +                       access::address_space::private_space,  | 
 | 371 | +                       access::address_space::constant_space>;  | 
 | 372 | +} // namespace gvl  | 
 | 373 | +} // namespace detail  | 
 | 374 | +} // namespace sycl  | 
 | 375 | +} // namespace cl  | 
0 commit comments