Skip to content
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

SIMD: convert binary operators to hidden friends #6320

Merged
merged 3 commits into from
Aug 23, 2023

Conversation

ldh4
Copy link
Contributor

@ldh4 ldh4 commented Jul 29, 2023

Follow up from #6109 (comment).

Converted binary operators to hidden friends and modified operator signatures to stay consistent with class overview provided in P1928R6.

@nliber
Copy link
Contributor

nliber commented Jul 31, 2023

Looks good so far...

@masterleinad masterleinad added this to the Release 4.2 milestone Aug 2, 2023
@ldh4 ldh4 force-pushed the simd_binary_ops_to_hidden_friends branch from e371fee to 4f907cc Compare August 4, 2023 01:37
@ldh4 ldh4 marked this pull request as ready for review August 9, 2023 22:34
Copy link
Member

@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

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

Why do we only have constexpr specifier with the scalar implementation?

simd const& lhs, simd const& rhs) noexcept {
return simd(lhs.m_value >> static_cast<int>(rhs[0]));
return simd(lhs.m_value >> static_cast<value_type>(rhs));
Copy link
Member

Choose a reason for hiding this comment

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

Why are we casting to value_type rather than using rhs.value directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replaced to use rhs.m_value instead. 787c301

KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type
operator<(simd const& other) const {
return mask_type(_mm256_cmp_pd(m_value, other.m_value, _CMP_LT_OS));
[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd operator-() const
Copy link
Member

Choose a reason for hiding this comment

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

What about constexpr?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's because these intrinsic functions are not constexpr.
Placing constexpr specifier will produce errors: call to non-'constexpr' function '__m256d _mm256_sub_pd.

@ldh4 ldh4 force-pushed the simd_binary_ops_to_hidden_friends branch from ccff122 to bce57b1 Compare August 11, 2023 21:14
@ldh4 ldh4 force-pushed the simd_binary_ops_to_hidden_friends branch from bce57b1 to 787c301 Compare August 11, 2023 21:24
@ldh4
Copy link
Contributor Author

ldh4 commented Aug 15, 2023

Retest this please.

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.

4 participants