From 70453096c1071561b09f1e1172d32845c4767682 Mon Sep 17 00:00:00 2001 From: aelovikov-intel Date: Thu, 4 Apr 2024 14:50:05 -0700 Subject: [PATCH] [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. --- sycl/include/sycl/detail/builtins/math_functions.inc | 6 ------ sycl/test-e2e/Basic/sycl_2020_images/common.hpp | 5 ++++- sycl/test/warnings/sycl_2020_deprecations.cpp | 3 --- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/sycl/include/sycl/detail/builtins/math_functions.inc b/sycl/include/sycl/detail/builtins/math_functions.inc index 344f2529d7dba..f75b26207a0ba 100644 --- a/sycl/include/sycl/detail/builtins/math_functions.inc +++ b/sycl/include/sycl/detail/builtins/math_functions.inc @@ -511,11 +511,5 @@ template detail::builtin_enable_nan_t nan(T x) { } #endif -template -__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 abs(T x) { - return fabs(x); -} } // namespace _V1 } // namespace sycl diff --git a/sycl/test-e2e/Basic/sycl_2020_images/common.hpp b/sycl/test-e2e/Basic/sycl_2020_images/common.hpp index 47c75235fbc3b..849cc0d13252f 100644 --- a/sycl/test-e2e/Basic/sycl_2020_images/common.hpp +++ b/sycl/test-e2e/Basic/sycl_2020_images/common.hpp @@ -267,7 +267,10 @@ template bool AllTrue(const vec &Vec) { template bool ApproxEq(const vec &LHS, const vec &RHS, T Precision = 0.1) { - return AllTrue(sycl::abs(LHS - RHS) <= Precision); + if constexpr (std::is_integral_v) + return AllTrue(sycl::abs(LHS - RHS) <= Precision); + else + return AllTrue(sycl::fabs(LHS - RHS) <= Precision); } template diff --git a/sycl/test/warnings/sycl_2020_deprecations.cpp b/sycl/test/warnings/sycl_2020_deprecations.cpp index 98fd788441a95..87ce0ceb52848 100644 --- a/sycl/test/warnings/sycl_2020_deprecations.cpp +++ b/sycl/test/warnings/sycl_2020_deprecations.cpp @@ -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}}