Skip to content

Commit 7045309

Browse files
[SYCL] Remove sycl::abs FP overload (#13286)
It's not provided by the SYCL 2020 specification and has been marked as deprecated some time ago.
1 parent b8f3942 commit 7045309

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

sycl/include/sycl/detail/builtins/math_functions.inc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,11 +511,5 @@ template <typename T> detail::builtin_enable_nan_t<T> nan(T x) {
511511
}
512512
#endif
513513

514-
template <typename T>
515-
__SYCL_DEPRECATED("abs for floating point types is non-standard and has been "
516-
"deprecated. Please use fabs instead.")
517-
detail::builtin_enable_math_allow_scalar_t<T> abs(T x) {
518-
return fabs(x);
519-
}
520514
} // namespace _V1
521515
} // namespace sycl

sycl/test-e2e/Basic/sycl_2020_images/common.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,10 @@ template <typename T, int Dims> bool AllTrue(const vec<T, Dims> &Vec) {
267267
template <typename T, int Dims>
268268
bool ApproxEq(const vec<T, Dims> &LHS, const vec<T, Dims> &RHS,
269269
T Precision = 0.1) {
270-
return AllTrue(sycl::abs(LHS - RHS) <= Precision);
270+
if constexpr (std::is_integral_v<T>)
271+
return AllTrue(sycl::abs(LHS - RHS) <= Precision);
272+
else
273+
return AllTrue(sycl::fabs(LHS - RHS) <= Precision);
271274
}
272275

273276
template <typename T, int Dims>

sycl/test/warnings/sycl_2020_deprecations.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,6 @@ int main() {
139139
sycl::byte B;
140140
(void)B;
141141

142-
// expected-warning@+1{{abs for floating point types is non-standard and has been deprecated. Please use fabs instead.}}
143-
sycl::abs(0.0f);
144-
145142
// 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}}
146143
using IS = sycl::info::device::image_support;
147144
// expected-warning@+1{{'max_constant_buffer_size' is deprecated: deprecated in SYCL 2020}}

0 commit comments

Comments
 (0)