Skip to content

[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

Merged
merged 4 commits into from
Dec 5, 2022

Conversation

fineg74
Copy link
Contributor

@fineg74 fineg74 commented Nov 22, 2022

Complementary test PR: intel/llvm-test-suite#1405

@@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
constexpr double __HDR_CONST_PI = 3.1415926535897932384626433832795;
constexpr double __ESIMD_CONST_PI = 3.1415926535897932384626433832795;

Comment on lines 1165 to 1167
__ESIMD_NS::simd<float, SZ> OneP(1.f);
__ESIMD_NS::simd<float, SZ> OneN(-1.f);
__ESIMD_NS::simd<float, SZ> sign;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
__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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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>
Copy link
Contributor

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.

@kbobrovs kbobrovs merged commit 818682e into intel:sycl Dec 5, 2022
@fineg74 fineg74 deleted the constRename branch December 27, 2022 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants