Skip to content

Commit 35fe4a2

Browse files
[SYCL][ABI-break] Promote relational return type changes (#9602)
This commit promotes the return type changes of SYCL relational builtins that changed between SYCL 1.2.1 and SYCL 2020 out from the guard of SYCL2020_CONFORMANT_APIS. --------- Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 72cffff commit 35fe4a2

File tree

6 files changed

+220
-354
lines changed

6 files changed

+220
-354
lines changed

sycl/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ set(SYCL_MAJOR_VERSION 7)
3636
set(SYCL_MINOR_VERSION 0)
3737
set(SYCL_PATCH_VERSION 0)
3838

39-
set(SYCL_DEV_ABI_VERSION 2)
39+
set(SYCL_DEV_ABI_VERSION 3)
4040
if (SYCL_ADD_DEV_VERSION_POSTFIX)
4141
set(SYCL_VERSION_POSTFIX "-${SYCL_DEV_ABI_VERSION}")
4242
endif()

sycl/include/sycl/builtins.hpp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,18 +2001,9 @@ __SYCL_MARRAY_RELATIONAL_FUNCTION_BINOP_OVERLOAD(isordered)
20012001
__SYCL_MARRAY_RELATIONAL_FUNCTION_BINOP_OVERLOAD(isunordered)
20022002
__SYCL_MARRAY_RELATIONAL_FUNCTION_UNOP_OVERLOAD(signbit)
20032003

2004-
namespace detail {
2005-
#if defined(SYCL2020_CONFORMANT_APIS) && SYCL_LANGUAGE_VERSION >= 202001
2006-
using anyall_ret_t = bool;
2007-
#else
2008-
using anyall_ret_t = int;
2009-
#endif
2010-
} // namespace detail
2011-
2012-
// int any (sigeninteger x)
2004+
// bool any (sigeninteger x)
20132005
template <typename T>
2014-
std::enable_if_t<detail::is_sigeninteger<T>::value, detail::anyall_ret_t>
2015-
any(T x) __NOEXC {
2006+
std::enable_if_t<detail::is_sigeninteger<T>::value, bool> any(T x) __NOEXC {
20162007
return detail::Boolean<1>(int(detail::msbIsSet(x)));
20172008
}
20182009

@@ -2024,10 +2015,9 @@ std::enable_if_t<detail::is_vigeninteger<T>::value, int> any(T x) __NOEXC {
20242015
detail::rel_sign_bit_test_arg_t<T>(x)));
20252016
}
20262017

2027-
// int all (sigeninteger x)
2018+
// bool all (sigeninteger x)
20282019
template <typename T>
2029-
std::enable_if_t<detail::is_sigeninteger<T>::value, detail::anyall_ret_t>
2030-
all(T x) __NOEXC {
2020+
std::enable_if_t<detail::is_sigeninteger<T>::value, bool> all(T x) __NOEXC {
20312021
return detail::Boolean<1>(int(detail::msbIsSet(x)));
20322022
}
20332023

sycl/include/sycl/detail/generic_type_traits.hpp

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,6 @@ template <typename T> inline constexpr bool msbIsSet(const T x) {
642642
return (x & msbMask(x));
643643
}
644644

645-
#if defined(SYCL2020_CONFORMANT_APIS) && SYCL_LANGUAGE_VERSION >= 202001
646645
// SYCL 2020 4.17.9 (Relation functions), e.g. table 178
647646
//
648647
// genbool isequal (genfloatf x, genfloatf y)
@@ -653,27 +652,6 @@ template <typename T>
653652
using common_rel_ret_t =
654653
std::conditional_t<is_vgentype<T>::value, make_singed_integer_t<T>, bool>;
655654

656-
// TODO: Remove this when common_rel_ret_t is promoted.
657-
template <typename T>
658-
using internal_host_rel_ret_t =
659-
std::conditional_t<is_vgentype<T>::value, make_singed_integer_t<T>, int>;
660-
#else
661-
// SYCL 1.2.1 4.13.7 (Relation functions), e.g.
662-
//
663-
// igeninteger32bit isequal (genfloatf x, genfloatf y)
664-
// igeninteger64bit isequal (genfloatd x, genfloatd y)
665-
//
666-
// However, we have pre-existing bug so
667-
//
668-
// igeninteger32bit isequal (genfloatd x, genfloatd y)
669-
//
670-
// Fixing it would be an ABI-breaking change so isn't done.
671-
template <typename T>
672-
using common_rel_ret_t =
673-
std::conditional_t<is_vgentype<T>::value, make_singed_integer_t<T>, int>;
674-
template <typename T> using internal_host_rel_ret_t = common_rel_ret_t<T>;
675-
#endif
676-
677655
// forward declaration
678656
template <int N> struct Boolean;
679657

@@ -696,15 +674,7 @@ template <typename T> struct RelationalReturnType {
696674
#ifdef __SYCL_DEVICE_ONLY__
697675
using type = Boolean<TryToGetNumElements<T>::value>;
698676
#else
699-
// After changing the return type of scalar relational operations to boolean
700-
// we keep the old representation of the internal implementation of the
701-
// host-side builtins to avoid ABI-breaks.
702-
// TODO: Use common_rel_ret_t when ABI break is allowed and the boolean return
703-
// type for relationals are promoted out of SYCL2020_CONFORMANT_APIS.
704-
// The scalar relational builtins in
705-
// sycl/source/detail/builtins_relational.cpp should likewise be updated
706-
// to return boolean values.
707-
using type = internal_host_rel_ret_t<T>;
677+
using type = common_rel_ret_t<T>;
708678
#endif
709679
};
710680

0 commit comments

Comments
 (0)