-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL][ESIMD]Refactor several math functions and remove duplicate constants #7490
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
Conversation
@@ -1152,7 +1152,7 @@ sincos(__ESIMD_NS::simd<float, SZ> &dstcos, U src0, Sat sat = {}) { | |||
|
|||
/// @cond ESIMD_DETAIL | |||
namespace detail { | |||
constexpr double HDR_CONST_PI = 3.1415926535897932384626433832795; | |||
constexpr double __HDR_CONST_PI = 3.1415926535897932384626433832795; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constexpr double __HDR_CONST_PI = 3.1415926535897932384626433832795; | |
constexpr double __ESIMD_CONST_PI = 3.1415926535897932384626433832795; |
__ESIMD_NS::simd<float, SZ> OneP(1.f); | ||
__ESIMD_NS::simd<float, SZ> OneN(-1.f); | ||
__ESIMD_NS::simd<float, SZ> sign; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__ESIMD_NS::simd<float, SZ> OneP(1.f); | |
__ESIMD_NS::simd<float, SZ> OneN(-1.f); | |
__ESIMD_NS::simd<float, SZ> sign; | |
__ESIMD_NS::simd<T, SZ> OneP((T)1.f); | |
__ESIMD_NS::simd<T, SZ> OneN((T)-1.f); | |
__ESIMD_NS::simd<T, SZ> sign; |
Result.merge(Result - T(detail::HDR_CONST_PI / 2.0), Gt1); | ||
Result.merge(Result, Neg); | ||
return Result; | ||
Result.merge(Result - T(detail::__HDR_CONST_PI / 2.0), Gt1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Result.merge(Result - T(detail::__HDR_CONST_PI / 2.0), Gt1); | |
Result.merge(Result - T(detail::__ESIMD_CONST_PI / T(2.0)), Gt1); |
template <int N> | ||
__ESIMD_NS::simd<float, N> atan2_fast(__ESIMD_NS::simd<float, N> y, | ||
__ESIMD_NS::simd<float, N> x); | ||
template <typename T, int N> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that this is an interface change. Prior to this change atan2_fast always returned float. Is this intentional?
Also applies to other APIs. Please preserve the original return types, unless there is some reason not to.
Complementary test PR: intel/llvm-test-suite#1405