Skip to content

Commit 42f8ace

Browse files
committed
Remove use of std::log1p in math_utils.hpp
Build segfault fixed in 2025.0
1 parent 9fa6054 commit 42f8ace

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

dpctl/tensor/libtensor/include/utils/math_utils.hpp

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -126,30 +126,10 @@ template <typename T> T logaddexp(T x, T y)
126126
const T tmp = x - y;
127127
constexpr T zero(0);
128128

129-
if constexpr (std::is_same_v<T, sycl::half>) {
130-
return (tmp > zero)
131-
? (x + sycl::log1p(sycl::exp(-tmp)))
132-
: ((tmp <= zero) ? y + sycl::log1p(sycl::exp(tmp))
133-
: std::numeric_limits<T>::quiet_NaN());
134-
}
135-
else {
136-
if constexpr (std::is_same_v<T, double>) {
137-
// FIXME: switch to `sycl::log1p` when
138-
// compiler segfault in CUDA build is fixed
139-
return (tmp > zero)
140-
? (x + std::log1p(sycl::exp(-tmp)))
141-
: ((tmp <= zero)
142-
? y + std::log1p(sycl::exp(tmp))
143-
: std::numeric_limits<T>::quiet_NaN());
144-
}
145-
else {
146-
return (tmp > zero)
147-
? (x + sycl::log1p(sycl::exp(-tmp)))
148-
: ((tmp <= zero)
149-
? y + sycl::log1p(sycl::exp(tmp))
150-
: std::numeric_limits<T>::quiet_NaN());
151-
}
152-
}
129+
return (tmp > zero)
130+
? (x + sycl::log1p(sycl::exp(-tmp)))
131+
: ((tmp <= zero) ? y + sycl::log1p(sycl::exp(tmp))
132+
: std::numeric_limits<T>::quiet_NaN());
153133
}
154134
}
155135

0 commit comments

Comments
 (0)