Skip to content

Commit 016d68b

Browse files
[SYCL] Deprecate legacy vector type aliases (#8561)
1 parent 51b7f78 commit 016d68b

File tree

2 files changed

+186
-15
lines changed

2 files changed

+186
-15
lines changed

sycl/include/sycl/aliases.hpp

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ class half;
2727
#define __SYCL_MAKE_VECTOR_ALIAS(ALIAS, TYPE, N) \
2828
using ALIAS##N = sycl::vec<TYPE, N>;
2929

30+
#define __SYCL_2020_MAKE_DEPRECATED_VECTOR_ALIAS(ALIAS, TYPE, N, MESSAGE) \
31+
using ALIAS##N __SYCL2020_DEPRECATED(MESSAGE) = sycl::vec<TYPE, N>;
32+
3033
#define __SYCL_MAKE_VECTOR_ALIASES_FOR_ARITHMETIC_TYPES(N) \
3134
__SYCL_MAKE_VECTOR_ALIAS(char, char, N) \
3235
__SYCL_MAKE_VECTOR_ALIAS(short, short, N) \
@@ -36,18 +39,19 @@ class half;
3639
__SYCL_MAKE_VECTOR_ALIAS(double, double, N) \
3740
__SYCL_MAKE_VECTOR_ALIAS(half, half, N)
3841

42+
// There are no 'cl_*' vec aliases in SYCL 2020
3943
#define __SYCL_MAKE_VECTOR_ALIASES_FOR_OPENCL_TYPES(N) \
40-
__SYCL_MAKE_VECTOR_ALIAS(cl_char, sycl::cl_char, N) \
41-
__SYCL_MAKE_VECTOR_ALIAS(cl_uchar, sycl::cl_uchar, N) \
42-
__SYCL_MAKE_VECTOR_ALIAS(cl_short, sycl::cl_short, N) \
43-
__SYCL_MAKE_VECTOR_ALIAS(cl_ushort, sycl::cl_ushort, N) \
44-
__SYCL_MAKE_VECTOR_ALIAS(cl_int, sycl::cl_int, N) \
45-
__SYCL_MAKE_VECTOR_ALIAS(cl_uint, sycl::cl_uint, N) \
46-
__SYCL_MAKE_VECTOR_ALIAS(cl_long, sycl::cl_long, N) \
47-
__SYCL_MAKE_VECTOR_ALIAS(cl_ulong, sycl::cl_ulong, N) \
48-
__SYCL_MAKE_VECTOR_ALIAS(cl_float, sycl::cl_float, N) \
49-
__SYCL_MAKE_VECTOR_ALIAS(cl_double, sycl::cl_double, N) \
50-
__SYCL_MAKE_VECTOR_ALIAS(cl_half, sycl::cl_half, N)
44+
__SYCL_2020_MAKE_DEPRECATED_VECTOR_ALIAS(cl_char, sycl::cl_char, N, "") \
45+
__SYCL_2020_MAKE_DEPRECATED_VECTOR_ALIAS(cl_uchar, sycl::cl_uchar, N, "") \
46+
__SYCL_2020_MAKE_DEPRECATED_VECTOR_ALIAS(cl_short, sycl::cl_short, N, "") \
47+
__SYCL_2020_MAKE_DEPRECATED_VECTOR_ALIAS(cl_ushort, sycl::cl_ushort, N, "") \
48+
__SYCL_2020_MAKE_DEPRECATED_VECTOR_ALIAS(cl_int, sycl::cl_int, N, "") \
49+
__SYCL_2020_MAKE_DEPRECATED_VECTOR_ALIAS(cl_uint, sycl::cl_uint, N, "") \
50+
__SYCL_2020_MAKE_DEPRECATED_VECTOR_ALIAS(cl_long, sycl::cl_long, N, "") \
51+
__SYCL_2020_MAKE_DEPRECATED_VECTOR_ALIAS(cl_ulong, sycl::cl_ulong, N, "") \
52+
__SYCL_2020_MAKE_DEPRECATED_VECTOR_ALIAS(cl_float, sycl::cl_float, N, "") \
53+
__SYCL_2020_MAKE_DEPRECATED_VECTOR_ALIAS(cl_double, sycl::cl_double, N, "") \
54+
__SYCL_2020_MAKE_DEPRECATED_VECTOR_ALIAS(cl_half, sycl::cl_half, N, "")
5155

5256
#define __SYCL_MAKE_VECTOR_ALIASES_FOR_SIGNED_AND_UNSIGNED_TYPES(N) \
5357
__SYCL_MAKE_VECTOR_ALIAS(schar, signed char, N) \
@@ -64,16 +68,16 @@ class half;
6468
__SYCL_MAKE_VECTOR_ALIASES_FOR_SIGNED_AND_UNSIGNED_TYPES(N)
6569

6670
// FIXME: OpenCL vector aliases are not defined by SYCL 2020 spec and should be
67-
// removed from here. See intel/llvm#7888
71+
// removed from here. See intel/llvm#7888. They are deprecated for now.
6872
// FIXME: schar, longlong and ulonglong aliases are not defined by SYCL 2020
6973
// spec, but they are preserved in SYCL 2020 mode, because SYCL-CTS is
7074
// still using them.
7175
// See KhronosGroup/SYCL-CTS#446 and KhronosGroup/SYCL-Docs#335
7276
#define __SYCL_2020_MAKE_VECTOR_ALIASES_FOR_VECTOR_LENGTH(N) \
7377
__SYCL_MAKE_VECTOR_ALIASES_FOR_OPENCL_TYPES(N) \
74-
__SYCL_MAKE_VECTOR_ALIAS(schar, std::int8_t, N) \
75-
__SYCL_MAKE_VECTOR_ALIAS(longlong, std::int64_t, N) \
76-
__SYCL_MAKE_VECTOR_ALIAS(ulonglong, std::uint64_t, N) \
78+
__SYCL_2020_MAKE_DEPRECATED_VECTOR_ALIAS(schar, std::int8_t, N, "") \
79+
__SYCL_2020_MAKE_DEPRECATED_VECTOR_ALIAS(longlong, std::int64_t, N, "") \
80+
__SYCL_2020_MAKE_DEPRECATED_VECTOR_ALIAS(ulonglong, std::uint64_t, N, "") \
7781
__SYCL_MAKE_VECTOR_ALIAS(char, std::int8_t, N) \
7882
__SYCL_MAKE_VECTOR_ALIAS(uchar, std::uint8_t, N) \
7983
__SYCL_MAKE_VECTOR_ALIAS(short, std::int16_t, N) \
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
// RUN: %clangxx %fsycl-host-only -fsyntax-only -sycl-std=2020 -Xclang -verify -Xclang -verify-ignore-unexpected=note %s
2+
//
3+
// Our implementation has a number of aliases defined for scalar types, which
4+
// were either changed or completely removed from SYCL 2020. To ensure a smooth
5+
// transition for users, we deprecated them first and then remove.
6+
//
7+
// This test is intended to check that we emit proper deprecation message for
8+
// those aliases.
9+
10+
#include <sycl/sycl.hpp>
11+
12+
int main() {
13+
14+
// expected-warning@+1 {{'schar2' is deprecated}}
15+
sycl::schar2 sc2;
16+
// expected-warning@+1 {{'schar3' is deprecated}}
17+
sycl::schar3 sc3;
18+
// expected-warning@+1 {{'schar4' is deprecated}}
19+
sycl::schar4 sc4;
20+
// expected-warning@+1 {{'schar8' is deprecated}}
21+
sycl::schar8 sc8;
22+
// expected-warning@+1 {{'schar16' is deprecated}}
23+
sycl::schar16 sc16;
24+
25+
// expected-warning@+1 {{'longlong2' is deprecated}}
26+
sycl::longlong2 ll2;
27+
// expected-warning@+1 {{'longlong3' is deprecated}}
28+
sycl::longlong3 ll3;
29+
// expected-warning@+1 {{'longlong4' is deprecated}}
30+
sycl::longlong4 ll4;
31+
// expected-warning@+1 {{'longlong8' is deprecated}}
32+
sycl::longlong8 ll8;
33+
// expected-warning@+1 {{'longlong16' is deprecated}}
34+
sycl::longlong16 ll16;
35+
36+
// expected-warning@+1 {{'ulonglong2' is deprecated}}
37+
sycl::ulonglong2 ull2;
38+
// expected-warning@+1 {{'ulonglong3' is deprecated}}
39+
sycl::ulonglong3 ull3;
40+
// expected-warning@+1 {{'ulonglong4' is deprecated}}
41+
sycl::ulonglong4 ull4;
42+
// expected-warning@+1 {{'ulonglong8' is deprecated}}
43+
sycl::ulonglong8 ull8;
44+
// expected-warning@+1 {{'ulonglong16' is deprecated}}
45+
sycl::ulonglong16 ull16;
46+
47+
// expected-warning@+1 {{'cl_char2' is deprecated}}
48+
sycl::cl_char2 cl_c2;
49+
// expected-warning@+1 {{'cl_char3' is deprecated}}
50+
sycl::cl_char3 cl_c3;
51+
// expected-warning@+1 {{'cl_char4' is deprecated}}
52+
sycl::cl_char4 cl_c4;
53+
// expected-warning@+1 {{'cl_char8' is deprecated}}
54+
sycl::cl_char8 cl_c8;
55+
// expected-warning@+1 {{'cl_char16' is deprecated}}
56+
sycl::cl_char16 cl_c16;
57+
58+
// expected-warning@+1 {{'cl_uchar2' is deprecated}}
59+
sycl::cl_uchar2 cl_uc2;
60+
// expected-warning@+1 {{'cl_uchar3' is deprecated}}
61+
sycl::cl_uchar3 cl_uc3;
62+
// expected-warning@+1 {{'cl_uchar4' is deprecated}}
63+
sycl::cl_uchar4 cl_uc4;
64+
// expected-warning@+1 {{'cl_uchar8' is deprecated}}
65+
sycl::cl_uchar8 cl_uc8;
66+
// expected-warning@+1 {{'cl_uchar16' is deprecated}}
67+
sycl::cl_uchar16 cl_uc16;
68+
69+
// expected-warning@+1 {{'cl_short2' is deprecated}}
70+
sycl::cl_short2 cl_s2;
71+
// expected-warning@+1 {{'cl_short3' is deprecated}}
72+
sycl::cl_short3 cl_s3;
73+
// expected-warning@+1 {{'cl_short4' is deprecated}}
74+
sycl::cl_short4 cl_s4;
75+
// expected-warning@+1 {{'cl_short8' is deprecated}}
76+
sycl::cl_short8 cl_s8;
77+
// expected-warning@+1 {{'cl_short16' is deprecated}}
78+
sycl::cl_short16 cl_s16;
79+
80+
// expected-warning@+1 {{'cl_ushort2' is deprecated}}
81+
sycl::cl_ushort2 cl_us2;
82+
// expected-warning@+1 {{'cl_ushort3' is deprecated}}
83+
sycl::cl_ushort3 cl_us3;
84+
// expected-warning@+1 {{'cl_ushort4' is deprecated}}
85+
sycl::cl_ushort4 cl_us4;
86+
// expected-warning@+1 {{'cl_ushort8' is deprecated}}
87+
sycl::cl_ushort8 cl_us8;
88+
// expected-warning@+1 {{'cl_ushort16' is deprecated}}
89+
sycl::cl_ushort16 cl_us16;
90+
91+
// expected-warning@+1 {{'cl_int2' is deprecated}}
92+
sycl::cl_int2 cl_i2;
93+
// expected-warning@+1 {{'cl_int3' is deprecated}}
94+
sycl::cl_int3 cl_i3;
95+
// expected-warning@+1 {{'cl_int4' is deprecated}}
96+
sycl::cl_int4 cl_i4;
97+
// expected-warning@+1 {{'cl_int8' is deprecated}}
98+
sycl::cl_int8 cl_i8;
99+
// expected-warning@+1 {{'cl_int16' is deprecated}}
100+
sycl::cl_int16 cl_i16;
101+
102+
// expected-warning@+1 {{'cl_uint2' is deprecated}}
103+
sycl::cl_uint2 cl_ui2;
104+
// expected-warning@+1 {{'cl_uint3' is deprecated}}
105+
sycl::cl_uint3 cl_ui3;
106+
// expected-warning@+1 {{'cl_uint4' is deprecated}}
107+
sycl::cl_uint4 cl_ui4;
108+
// expected-warning@+1 {{'cl_uint8' is deprecated}}
109+
sycl::cl_uint8 cl_ui8;
110+
// expected-warning@+1 {{'cl_uint16' is deprecated}}
111+
sycl::cl_uint16 cl_ui16;
112+
113+
// expected-warning@+1 {{'cl_long2' is deprecated}}
114+
sycl::cl_long2 cl_l2;
115+
// expected-warning@+1 {{'cl_long3' is deprecated}}
116+
sycl::cl_long3 cl_l3;
117+
// expected-warning@+1 {{'cl_long4' is deprecated}}
118+
sycl::cl_long4 cl_l4;
119+
// expected-warning@+1 {{'cl_long8' is deprecated}}
120+
sycl::cl_long8 cl_l8;
121+
// expected-warning@+1 {{'cl_long16' is deprecated}}
122+
sycl::cl_long16 cl_l16;
123+
124+
// expected-warning@+1 {{'cl_ulong2' is deprecated}}
125+
sycl::cl_ulong2 cl_ul2;
126+
// expected-warning@+1 {{'cl_ulong3' is deprecated}}
127+
sycl::cl_ulong3 cl_ul3;
128+
// expected-warning@+1 {{'cl_ulong4' is deprecated}}
129+
sycl::cl_ulong4 cl_ul4;
130+
// expected-warning@+1 {{'cl_ulong8' is deprecated}}
131+
sycl::cl_ulong8 cl_ul8;
132+
// expected-warning@+1 {{'cl_ulong16' is deprecated}}
133+
sycl::cl_ulong16 cl_ul16;
134+
135+
// expected-warning@+1 {{'cl_float2' is deprecated}}
136+
sycl::cl_float2 cl_f2;
137+
// expected-warning@+1 {{'cl_float3' is deprecated}}
138+
sycl::cl_float3 cl_f3;
139+
// expected-warning@+1 {{'cl_float4' is deprecated}}
140+
sycl::cl_float4 cl_f4;
141+
// expected-warning@+1 {{'cl_float8' is deprecated}}
142+
sycl::cl_float8 cl_f8;
143+
// expected-warning@+1 {{'cl_float16' is deprecated}}
144+
sycl::cl_float16 cl_f16;
145+
146+
// expected-warning@+1 {{'cl_double2' is deprecated}}
147+
sycl::cl_double2 cl_d2;
148+
// expected-warning@+1 {{'cl_double3' is deprecated}}
149+
sycl::cl_double3 cl_d3;
150+
// expected-warning@+1 {{'cl_double4' is deprecated}}
151+
sycl::cl_double4 cl_d4;
152+
// expected-warning@+1 {{'cl_double8' is deprecated}}
153+
sycl::cl_double8 cl_d8;
154+
// expected-warning@+1 {{'cl_double16' is deprecated}}
155+
sycl::cl_double16 cl_d16;
156+
157+
// expected-warning@+1 {{'cl_half2' is deprecated}}
158+
sycl::cl_half2 cl_h2;
159+
// expected-warning@+1 {{'cl_half3' is deprecated}}
160+
sycl::cl_half3 cl_h3;
161+
// expected-warning@+1 {{'cl_half4' is deprecated}}
162+
sycl::cl_half4 cl_h4;
163+
// expected-warning@+1 {{'cl_half8' is deprecated}}
164+
sycl::cl_half8 cl_h8;
165+
// expected-warning@+1 {{'cl_half16' is deprecated}}
166+
sycl::cl_half16 cl_h16;
167+
};

0 commit comments

Comments
 (0)