DPC++ Runtime
Runtime libraries for oneAPI DPC++
aliases.hpp
Go to the documentation of this file.
1 //==----------- aliases.hpp --- SYCL type aliases --------------------------==//
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 #pragma once
10 
11 #include <sycl/detail/cl.h>
12 #include <sycl/detail/common.hpp>
13 
14 #include <cstddef>
15 #include <cstdint>
16 
17 namespace sycl {
19 template <typename T, int N> class vec;
20 namespace detail {
21 namespace half_impl {
22 class half;
23 } // namespace half_impl
24 } // namespace detail
25 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
26 } // namespace sycl
27 
28 #define __SYCL_MAKE_VECTOR_ALIAS(ALIAS, TYPE, N) \
29  using ALIAS##N = sycl::vec<TYPE, N>;
30 
31 #define __SYCL_MAKE_VECTOR_ALIASES_FOR_ARITHMETIC_TYPES(N) \
32  __SYCL_MAKE_VECTOR_ALIAS(char, char, N) \
33  __SYCL_MAKE_VECTOR_ALIAS(short, short, N) \
34  __SYCL_MAKE_VECTOR_ALIAS(int, int, N) \
35  __SYCL_MAKE_VECTOR_ALIAS(long, long, N) \
36  __SYCL_MAKE_VECTOR_ALIAS(float, float, N) \
37  __SYCL_MAKE_VECTOR_ALIAS(double, double, N) \
38  __SYCL_MAKE_VECTOR_ALIAS(half, half, N)
39 
40 #define __SYCL_MAKE_VECTOR_ALIASES_FOR_OPENCL_TYPES(N) \
41  __SYCL_MAKE_VECTOR_ALIAS(cl_char, sycl::cl_char, N) \
42  __SYCL_MAKE_VECTOR_ALIAS(cl_uchar, sycl::cl_uchar, N) \
43  __SYCL_MAKE_VECTOR_ALIAS(cl_short, sycl::cl_short, N) \
44  __SYCL_MAKE_VECTOR_ALIAS(cl_ushort, sycl::cl_ushort, N) \
45  __SYCL_MAKE_VECTOR_ALIAS(cl_int, sycl::cl_int, N) \
46  __SYCL_MAKE_VECTOR_ALIAS(cl_uint, sycl::cl_uint, N) \
47  __SYCL_MAKE_VECTOR_ALIAS(cl_long, sycl::cl_long, N) \
48  __SYCL_MAKE_VECTOR_ALIAS(cl_ulong, sycl::cl_ulong, N) \
49  __SYCL_MAKE_VECTOR_ALIAS(cl_float, sycl::cl_float, N) \
50  __SYCL_MAKE_VECTOR_ALIAS(cl_double, sycl::cl_double, N) \
51  __SYCL_MAKE_VECTOR_ALIAS(cl_half, sycl::cl_half, N)
52 
53 #define __SYCL_MAKE_VECTOR_ALIASES_FOR_SIGNED_AND_UNSIGNED_TYPES(N) \
54  __SYCL_MAKE_VECTOR_ALIAS(schar, signed char, N) \
55  __SYCL_MAKE_VECTOR_ALIAS(uchar, unsigned char, N) \
56  __SYCL_MAKE_VECTOR_ALIAS(ushort, unsigned short, N) \
57  __SYCL_MAKE_VECTOR_ALIAS(uint, unsigned int, N) \
58  __SYCL_MAKE_VECTOR_ALIAS(ulong, unsigned long, N) \
59  __SYCL_MAKE_VECTOR_ALIAS(longlong, long long, N) \
60  __SYCL_MAKE_VECTOR_ALIAS(ulonglong, unsigned long long, N)
61 
62 #define __SYCL_MAKE_VECTOR_ALIASES_FOR_VECTOR_LENGTH(N) \
63  __SYCL_MAKE_VECTOR_ALIASES_FOR_ARITHMETIC_TYPES(N) \
64  __SYCL_MAKE_VECTOR_ALIASES_FOR_OPENCL_TYPES(N) \
65  __SYCL_MAKE_VECTOR_ALIASES_FOR_SIGNED_AND_UNSIGNED_TYPES(N)
66 
67 namespace sycl {
69 using byte __SYCL2020_DEPRECATED("use std::byte instead") = std::uint8_t;
70 using schar = signed char;
71 using uchar = unsigned char;
72 using ushort = unsigned short;
73 using uint = unsigned int;
74 using ulong = unsigned long;
75 using longlong = long long;
76 using ulonglong = unsigned long long;
78 using cl_bool = bool;
79 using cl_char = std::int8_t;
80 using cl_uchar = std::uint8_t;
81 using cl_short = std::int16_t;
82 using cl_ushort = std::uint16_t;
83 using cl_int = std::int32_t;
84 using cl_uint = std::uint32_t;
86 using cl_ulong = std::uint64_t;
87 using cl_half = half;
88 using cl_float = float;
89 using cl_double = double;
90 
96 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
97 } // namespace sycl
98 
99 #undef __SYCL_MAKE_VECTOR_ALIAS
100 #undef __SYCL_MAKE_VECTOR_ALIASES_FOR_ARITHMETIC_TYPES
101 #undef __SYCL_MAKE_VECTOR_ALIASES_FOR_OPENCL_TYPES
102 #undef __SYCL_MAKE_VECTOR_ALIASES_FOR_SIGNED_AND_UNSIGNED_TYPES
103 #undef __SYCL_MAKE_VECTOR_ALIASES_FOR_VECTOR_LENGTH
sycl::_V1::ushort
unsigned short ushort
Definition: aliases.hpp:72
sycl::_V1::cl_short
std::int16_t cl_short
Definition: aliases.hpp:81
__SYCL_MAKE_VECTOR_ALIASES_FOR_VECTOR_LENGTH
#define __SYCL_MAKE_VECTOR_ALIASES_FOR_VECTOR_LENGTH(N)
Definition: aliases.hpp:62
sycl::_V1::cl_long
std::int64_t cl_long
Definition: aliases.hpp:85
__SYCL_INLINE_VER_NAMESPACE
#define __SYCL_INLINE_VER_NAMESPACE(X)
Definition: defines_elementary.hpp:13
sycl::_V1::longlong
long long longlong
Definition: aliases.hpp:75
sycl::_V1::detail::int64_t
conditional< sizeof(long)==8, long, long long >::type int64_t
Definition: kernel_desc.hpp:34
sycl::_V1::ulong
unsigned long ulong
Definition: aliases.hpp:74
sycl::_V1::uint
unsigned int uint
Definition: aliases.hpp:73
sycl
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:13
sycl::_V1::cl_half
half cl_half
Definition: aliases.hpp:87
sycl::_V1::cl_int
std::int32_t cl_int
Definition: aliases.hpp:83
sycl::_V1::detail::half_impl::half
Definition: half_type.hpp:268
sycl::_V1::cl_uint
std::uint32_t cl_uint
Definition: aliases.hpp:84
sycl::_V1::cl_double
double cl_double
Definition: aliases.hpp:89
char
sycl::_V1::cl_bool
bool cl_bool
Definition: aliases.hpp:78
cl.h
sycl::_V1::cl_uchar
std::uint8_t cl_uchar
Definition: aliases.hpp:80
common.hpp
sycl::_V1::cl_float
float cl_float
Definition: aliases.hpp:88
sycl::_V1::uchar
unsigned char uchar
Definition: aliases.hpp:71
sycl::_V1::half
sycl::detail::half_impl::half half
Definition: aliases.hpp:77
sycl::_V1::ulonglong
unsigned long long ulonglong
Definition: aliases.hpp:76
sycl::_V1::cl_ushort
std::uint16_t cl_ushort
Definition: aliases.hpp:82
sycl::_V1::cl_char
std::int8_t cl_char
Definition: aliases.hpp:79
sycl::_V1::vec
Provides a cross-patform vector class template that works efficiently on SYCL devices as well as in h...
Definition: aliases.hpp:19
sycl::_V1::cl_ulong
std::uint64_t cl_ulong
Definition: aliases.hpp:86
__SYCL2020_DEPRECATED
#define __SYCL2020_DEPRECATED(message)
Definition: defines_elementary.hpp:54
sycl::_V1::schar
signed char schar
Definition: aliases.hpp:70