Skip to content

Commit 9842ed1

Browse files
[ABI-Break][SYCL] Switch sycl::vec to preview unconditionally (#13182)
1 parent 74e5bc4 commit 9842ed1

File tree

9 files changed

+12
-673
lines changed

9 files changed

+12
-673
lines changed

sycl/include/sycl/detail/generic_type_traits.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,12 @@ template <typename To, typename From> auto convertFromOpenCLTypeFor(From &&x) {
429429
using OpenCLType = decltype(convertToOpenCLType(std::declval<To>()));
430430
static_assert(std::is_same_v<std::remove_reference_t<From>, OpenCLType>);
431431
static_assert(sizeof(OpenCLType) == sizeof(To));
432-
if constexpr (is_vec_v<To> && is_vec_v<From>)
433-
return x.template as<To>();
432+
using To_noref = std::remove_reference_t<To>;
433+
using From_noref = std::remove_reference_t<From>;
434+
if constexpr (is_vec_v<To_noref> && is_vec_v<From_noref>)
435+
return x.template as<To_noref>();
436+
else if constexpr (is_vec_v<To_noref> && is_ext_vector_v<From_noref>)
437+
return To_noref{bit_cast<typename To_noref::vector_t>(x)};
434438
else
435439
return static_cast<To>(x);
436440
}

sycl/include/sycl/detail/vector_traits.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ inline namespace _V1 {
1616
namespace detail {
1717

1818
// 4.10.2.6 Memory layout and alignment
19-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
2019
// due to MSVC the maximum alignment for sycl::vec is 64 and this proposed
2120
// change is being brought to the spec committee.
2221
constexpr size_t MaxVecAlignment = 64;
@@ -29,12 +28,6 @@ struct vector_alignment_impl
2928
std::integral_constant<size_t,
3029
(std::min)(sizeof(T) * N, MaxVecAlignment)>> {
3130
};
32-
#else
33-
template <typename T, size_t N>
34-
struct vector_alignment_impl
35-
: std::conditional_t<N == 3, std::integral_constant<int, sizeof(T) * 4>,
36-
std::integral_constant<int, sizeof(T) * N>> {};
37-
#endif
3831

3932
template <typename T, size_t N>
4033
struct vector_alignment

sycl/include/sycl/half_type.hpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -259,36 +259,11 @@ using BIsRepresentationT = half;
259259
// for vec because they are actually defined as an integer type under the
260260
// hood. As a result half values will be converted to the integer and passed
261261
// as a kernel argument which is expected to be floating point number.
262-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
263262
using Vec2StorageT = std::array<StorageT, 2>;
264263
using Vec3StorageT = std::array<StorageT, 3>;
265264
using Vec4StorageT = std::array<StorageT, 4>;
266265
using Vec8StorageT = std::array<StorageT, 8>;
267266
using Vec16StorageT = std::array<StorageT, 16>;
268-
#else // __INTEL_PREVIEW_BREAKING_CHANGES
269-
template <int NumElements> struct half_vec {
270-
alignas(
271-
vector_alignment<StorageT, NumElements>::value) StorageT s[NumElements];
272-
273-
__SYCL_CONSTEXPR_HALF half_vec() : s{0.0f} { initialize_data(); }
274-
template <typename... Ts,
275-
typename = std::enable_if_t<(sizeof...(Ts) == NumElements) &&
276-
(std::is_same_v<half, Ts> && ...)>>
277-
__SYCL_CONSTEXPR_HALF half_vec(const Ts &...hs) : s{hs...} {}
278-
279-
constexpr void initialize_data() {
280-
for (size_t i = 0; i < NumElements; ++i) {
281-
s[i] = StorageT(0.0f);
282-
}
283-
}
284-
};
285-
286-
using Vec2StorageT = half_vec<2>;
287-
using Vec3StorageT = half_vec<3>;
288-
using Vec4StorageT = half_vec<4>;
289-
using Vec8StorageT = half_vec<8>;
290-
using Vec16StorageT = half_vec<16>;
291-
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
292267
#endif // SYCL_DEVICE_ONLY
293268

294269
#ifndef __SYCL_DEVICE_ONLY__

0 commit comments

Comments
 (0)