-
Notifications
You must be signed in to change notification settings - Fork 407
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
Conversation
#include <cstring> | ||
|
||
#include <Kokkos_Core.hpp> | ||
|
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.
does this header not need to explicitly include Kokkos_SIMD_Common.hpp
?
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.
I made it self-contained in 9abaa33.
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.
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) |
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.
What about https://github.com/kokkos/kokkos/pull/6485/files#diff-66339256bc16b14bde61943b2f7e184363640137e9a9b03ccf93c7f1a89e3fa9L98-L102 ?
Should we revert it as well?
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.
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.
template <class T, class Abi> | ||
class simd; | ||
|
||
template <class T, class Abi> | ||
class simd_mask; | ||
|
||
template <class M, class T> | ||
class const_where_expression; |
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.
Why did you go for forward declarations rather than including <Kokkos_SIMD_Common.hpp>
?
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.
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> | ||
|
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.
Should we check that this is not included without Kokkos_SIMD.hpp being included first?
simd/src/Kokkos_SIMD_Common_Math.hpp
Outdated
// These are not in the Experimental namespace because their double | ||
// overloads are not either |
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.
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).
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.
This pull request just moves code but 229b43d fixes it anyway.
The requested changes were addressed.
Retest this please. |
The CI testing is timing out on an unrelated unit test.
|
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 usingKokkos::Experimental::abs
on the host for host-only types withnvcc
; with this split,Kokkos::Experimental::abs
finds the host-only specialization forKokkos::abs
.