Skip to content

Commit 97f5dd9

Browse files
committed
Remove use of std::log1p in math_utils.hpp
Build segfault fixed in 2025.0
1 parent cce5f59 commit 97f5dd9

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
@@ -125,30 +125,10 @@ template <typename T> T logaddexp(T x, T y)
125125
const T tmp = x - y;
126126
constexpr T zero(0);
127127

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

0 commit comments

Comments
 (0)