From d8705a2b781342c0cfa93e224aefa3404367262b Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Wed, 29 May 2024 13:20:21 -0700 Subject: [PATCH] Use `sycl::rint` rather than `std::rint` to resolve failed tests on Nvidia hardware When compiled for CUDA, `std::rint` would incorrectly round values halfway between two integers toward 0, rather than to the nearest even number as required per array API. `sycl::rint` avoids such issues by not relying on the current rounding mode --- .../libtensor/include/kernels/elementwise_functions/round.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/round.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/round.hpp index cdc16180f8..f129799ff8 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/round.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/round.hpp @@ -81,7 +81,7 @@ template struct RoundFunctor private: template T round_func(const T &input) const { - return std::rint(input); + return sycl::rint(input); } };