Skip to content

Commit

Permalink
[SYCL] Remove sycl::abs FP overload (#13286)
Browse files Browse the repository at this point in the history
It's not provided by the SYCL 2020 specification and has been marked as
deprecated some time ago.
  • Loading branch information
aelovikov-intel authored Apr 4, 2024
1 parent b8f3942 commit 7045309
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
6 changes: 0 additions & 6 deletions sycl/include/sycl/detail/builtins/math_functions.inc
Original file line number Diff line number Diff line change
Expand Up @@ -511,11 +511,5 @@ template <typename T> detail::builtin_enable_nan_t<T> nan(T x) {
}
#endif

template <typename T>
__SYCL_DEPRECATED("abs for floating point types is non-standard and has been "
"deprecated. Please use fabs instead.")
detail::builtin_enable_math_allow_scalar_t<T> abs(T x) {
return fabs(x);
}
} // namespace _V1
} // namespace sycl
5 changes: 4 additions & 1 deletion sycl/test-e2e/Basic/sycl_2020_images/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,10 @@ template <typename T, int Dims> bool AllTrue(const vec<T, Dims> &Vec) {
template <typename T, int Dims>
bool ApproxEq(const vec<T, Dims> &LHS, const vec<T, Dims> &RHS,
T Precision = 0.1) {
return AllTrue(sycl::abs(LHS - RHS) <= Precision);
if constexpr (std::is_integral_v<T>)
return AllTrue(sycl::abs(LHS - RHS) <= Precision);
else
return AllTrue(sycl::fabs(LHS - RHS) <= Precision);
}

template <typename T, int Dims>
Expand Down
3 changes: 0 additions & 3 deletions sycl/test/warnings/sycl_2020_deprecations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ int main() {
sycl::byte B;
(void)B;

// expected-warning@+1{{abs for floating point types is non-standard and has been deprecated. Please use fabs instead.}}
sycl::abs(0.0f);

// expected-warning@+1{{'image_support' is deprecated: deprecated in SYCL 2020, use device::has(aspect::ext_intel_legacy_image) to query for SYCL 1.2.1 image support}}
using IS = sycl::info::device::image_support;
// expected-warning@+1{{'max_constant_buffer_size' is deprecated: deprecated in SYCL 2020}}
Expand Down

0 comments on commit 7045309

Please sign in to comment.