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