Skip to content

Commit 100e1e0

Browse files
committed
[SYCL][NFC] More unification
1 parent 31d778d commit 100e1e0

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

sycl/include/sycl/types.hpp

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,6 +2230,8 @@ template <typename T, int N> struct VecStorageImpl;
22302230
#ifdef __SYCL_USE_EXT_VECTOR_TYPE__
22312231
template <typename T, int N> struct VecStorageImpl {
22322232
using DataType = T __attribute__((ext_vector_type(N)));
2233+
using VectorDataType =
2234+
DataType; // to unify code with preview breaking changes mode
22332235
};
22342236
#else
22352237
// When ext_vector_type is not available, we rely on cl_* types from CL/cl.h
@@ -2238,6 +2240,8 @@ template <typename T, int N> struct VecStorageImpl;
22382240
#define __SYCL_DEFINE_VECSTORAGE_IMPL(type, cl_type, num) \
22392241
template <> struct VecStorageImpl<type, num> { \
22402242
using DataType = ::cl_##cl_type##num; \
2243+
using VectorDataType = \
2244+
DataType; /* to unify code with preview breaking changes mode */ \
22412245
};
22422246
#endif // __SYCL_USE_EXT_VECTOR_TYPE__
22432247
#endif // !defined(__INTEL_PREVIEW_BREAKING_CHANGES)
@@ -2268,9 +2272,7 @@ __SYCL_DEFINE_VECSTORAGE_IMPL_FOR_TYPE(double, double)
22682272
// Single element bool
22692273
template <> struct VecStorage<bool, 1, void> {
22702274
using DataType = bool;
2271-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
22722275
using VectorDataType = bool;
2273-
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
22742276
};
22752277

22762278
// Multiple element bool
@@ -2280,32 +2282,26 @@ struct VecStorage<bool, N, typename std::enable_if_t<isValidVectorSize(N)>> {
22802282
typename VecStorageImpl<select_apply_cl_t<bool, std::int8_t, std::int16_t,
22812283
std::int32_t, std::int64_t>,
22822284
N>::DataType;
2283-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
22842285
using VectorDataType =
22852286
typename VecStorageImpl<select_apply_cl_t<bool, std::int8_t, std::int16_t,
22862287
std::int32_t, std::int64_t>,
22872288
N>::VectorDataType;
2288-
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
22892289
};
22902290

22912291
// Single element signed integers
22922292
template <typename T>
22932293
struct VecStorage<T, 1, typename std::enable_if_t<is_sigeninteger_v<T>>> {
22942294
using DataType = select_apply_cl_t<T, std::int8_t, std::int16_t, std::int32_t,
22952295
std::int64_t>;
2296-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
22972296
using VectorDataType = DataType;
2298-
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
22992297
};
23002298

23012299
// Single element unsigned integers
23022300
template <typename T>
23032301
struct VecStorage<T, 1, typename std::enable_if_t<is_sugeninteger_v<T>>> {
23042302
using DataType = select_apply_cl_t<T, std::uint8_t, std::uint16_t,
23052303
std::uint32_t, std::uint64_t>;
2306-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
23072304
using VectorDataType = DataType;
2308-
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
23092305
};
23102306

23112307
// Single element floating-point (except half)
@@ -2314,9 +2310,7 @@ struct VecStorage<
23142310
T, 1, typename std::enable_if_t<!is_half_v<T> && is_sgenfloat_v<T>>> {
23152311
using DataType =
23162312
select_apply_cl_t<T, std::false_type, std::false_type, float, double>;
2317-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
23182313
using VectorDataType = DataType;
2319-
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
23202314
};
23212315
// Multiple elements signed/unsigned integers and floating-point (except half)
23222316
template <typename T, int N>
@@ -2327,33 +2321,22 @@ struct VecStorage<
23272321
(is_sgenfloat_v<T> && !is_half_v<T>))>> {
23282322
using DataType =
23292323
typename VecStorageImpl<typename VecStorage<T, 1>::DataType, N>::DataType;
2330-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
23312324
using VectorDataType =
23322325
typename VecStorageImpl<typename VecStorage<T, 1>::DataType,
23332326
N>::VectorDataType;
2334-
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
23352327
};
23362328

23372329
// Single element half
23382330
template <> struct VecStorage<half, 1, void> {
23392331
using DataType = sycl::detail::half_impl::StorageT;
2340-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
23412332
using VectorDataType = sycl::detail::half_impl::StorageT;
2342-
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
23432333
};
23442334
// Multiple elements half
2345-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
23462335
#define __SYCL_DEFINE_HALF_VECSTORAGE(Num) \
23472336
template <> struct VecStorage<half, Num, void> { \
23482337
using DataType = sycl::detail::half_impl::Vec##Num##StorageT; \
23492338
using VectorDataType = sycl::detail::half_impl::Vec##Num##StorageT; \
23502339
};
2351-
#else // __INTEL_PREVIEW_BREAKING_CHANGES
2352-
#define __SYCL_DEFINE_HALF_VECSTORAGE(Num) \
2353-
template <> struct VecStorage<half, Num, void> { \
2354-
using DataType = sycl::detail::half_impl::Vec##Num##StorageT; \
2355-
};
2356-
#endif
23572340

23582341
__SYCL_DEFINE_HALF_VECSTORAGE(2)
23592342
__SYCL_DEFINE_HALF_VECSTORAGE(3)

0 commit comments

Comments
 (0)