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: Split math functions from SIMD_Common.hpp #6487

Merged
merged 4 commits into from
Oct 11, 2023

Conversation

masterleinad
Copy link
Contributor

@masterleinad masterleinad commented Oct 6, 2023

Follow-up to #6485 (review).

Splitting the math functions from SIMD_Common.hpp and including the new header after including the SIMD types header files fixes the error we were still seeing when using Kokkos::Experimental::abs on the host for host-only types with nvcc; with this split, Kokkos::Experimental::abs finds the host-only specialization for Kokkos::abs.

#include <cstring>

#include <Kokkos_Core.hpp>

Copy link
Contributor

@fnrizzi fnrizzi Oct 9, 2023

Choose a reason for hiding this comment

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

does this header not need to explicitly include Kokkos_SIMD_Common.hpp?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made it self-contained in 9abaa33.

Copy link
Member

Choose a reason for hiding this comment

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

Should we check that this is not included without Kokkos_SIMD.hpp being included first?

@@ -80,7 +80,7 @@ class absolutes {
template <typename T>
auto on_host(T const& a) const {
if constexpr (std::is_signed_v<typename T::value_type>) {
#if defined(KOKKOS_ENABLE_DEPRECATED_CODE_4) && !defined(KOKKOS_COMPILER_NVCC)
#if defined(KOKKOS_ENABLE_DEPRECATED_CODE_4)
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverting that change would make us call __host__ functions from a __host__ __device__ function (for host-only types) and we would potentially run into the same error since we would be trying to use vector types in a __host__ __device__ function.

Comment on lines +26 to +33
template <class T, class Abi>
class simd;

template <class T, class Abi>
class simd_mask;

template <class M, class T>
class const_where_expression;
Copy link
Member

Choose a reason for hiding this comment

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

Why did you go for forward declarations rather than including <Kokkos_SIMD_Common.hpp>?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To minimize dependencies (even though it probably doesn't matter much here). We should be able to use this header just using the SIMD specializations and not the fallback.
In the end, this pull request shows that the order of overload declarations matters, and including Kokkos_SIMD_Common.hpp might suggest that it would be fine to include that file before the overloads for the simd specializations.

#include <cstring>

#include <Kokkos_Core.hpp>

Copy link
Member

Choose a reason for hiding this comment

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

Should we check that this is not included without Kokkos_SIMD.hpp being included first?

nliber
nliber previously requested changes Oct 10, 2023
Comment on lines 121 to 122
// These are not in the Experimental namespace because their double
// overloads are not either
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this comment correct? If I'm reading it correctly, it looks like lines 135-143 put the same named function in Experimental (albeit deprecated).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This pull request just moves code but 229b43d fixes it anyway.

@crtrott crtrott added the Blocks Promotion Overview issue for release-blocking bugs label Oct 10, 2023
@masterleinad masterleinad dismissed nliber’s stale review October 10, 2023 13:36

The requested changes were addressed.

@crtrott
Copy link
Member

crtrott commented Oct 10, 2023

Retest this please.

@ldh4
Copy link
Contributor

ldh4 commented Oct 11, 2023

The CI testing is timing out on an unrelated unit test.

The following tests FAILED:
	 12 - Kokkos_CoreUnitTest_LogicalSpaces (Timeout)
Error: Process completed with exit code 8.

@dalg24 dalg24 merged commit f511dca into kokkos:develop Oct 11, 2023
27 of 28 checks passed
@masterleinad masterleinad mentioned this pull request Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocks Promotion Overview issue for release-blocking bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants