Skip to content

[NFCI][SYCL] Don't use builtins' internals in ext_oneapi_native_math impl #13154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions sycl/include/sycl/ext/oneapi/experimental/builtins.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ tanh(T x) __NOEXC {
return sycl::detail::convertFromOpenCLTypeFor<T>(
__clc_native_tanh(sycl::detail::convertToOpenCLType(x)));
#else
return __sycl_std::__invoke_tanh<T>(x);
return sycl::tanh(x);
#endif
}

Expand All @@ -120,16 +120,15 @@ inline __SYCL_ALWAYS_INLINE
#if defined(__SYCL_DEVICE_ONLY__) && defined(__NVPTX__)
auto partial_res = native::tanh(sycl::detail::to_vec2(x, i * 2));
#else
auto partial_res = __sycl_std::__invoke_tanh<sycl::vec<T, 2>>(
sycl::detail::to_vec2(x, i * 2));
auto partial_res = sycl::tanh(sycl::detail::to_vec2(x, i * 2));
#endif
sycl::detail::memcpy(&res[i * 2], &partial_res, sizeof(vec<T, 2>));
}
if (N % 2) {
#if defined(__SYCL_DEVICE_ONLY__) && defined(__NVPTX__)
res[N - 1] = native::tanh(x[N - 1]);
#else
res[N - 1] = __sycl_std::__invoke_tanh<T>(x[N - 1]);
res[N - 1] = sycl::tanh(x[N - 1]);
#endif
}

Expand All @@ -147,7 +146,7 @@ inline __SYCL_ALWAYS_INLINE
return sycl::detail::convertFromOpenCLTypeFor<T>(
__clc_native_exp2(sycl::detail::convertToOpenCLType(x)));
#else
return __sycl_std::__invoke_exp2<T>(x);
return sycl::exp2(x);
#endif
}

Expand All @@ -162,16 +161,15 @@ exp2(sycl::marray<half, N> x) __NOEXC {
#if defined(__SYCL_DEVICE_ONLY__) && defined(__NVPTX__)
auto partial_res = native::exp2(sycl::detail::to_vec2(x, i * 2));
#else
auto partial_res = __sycl_std::__invoke_exp2<sycl::vec<half, 2>>(
sycl::detail::to_vec2(x, i * 2));
auto partial_res = sycl::exp2(sycl::detail::to_vec2(x, i * 2));
#endif
sycl::detail::memcpy(&res[i * 2], &partial_res, sizeof(vec<half, 2>));
}
if (N % 2) {
#if defined(__SYCL_DEVICE_ONLY__) && defined(__NVPTX__)
res[N - 1] = native::exp2(x[N - 1]);
#else
res[N - 1] = __sycl_std::__invoke_exp2<half>(x[N - 1]);
res[N - 1] = sycl::exp2(x[N - 1]);
#endif
}
return res;
Expand Down