Skip to content

Commit

Permalink
Move scalar overloads to Scalar header
Browse files Browse the repository at this point in the history
  • Loading branch information
masterleinad committed Jun 16, 2023
1 parent 995a6a6 commit 99fe134
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 42 deletions.
42 changes: 0 additions & 42 deletions simd/src/Kokkos_SIMD_Common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ namespace Kokkos {

namespace Experimental {

namespace simd_abi {
class scalar;
}

template <class T, class Abi>
class simd;

Expand Down Expand Up @@ -102,16 +98,6 @@ template <class T, class Abi>
return where_expression(mask, value);
}

template <class T>
[[nodiscard]] KOKKOS_FORCEINLINE_FUNCTION
where_expression<simd_mask<T, Kokkos::Experimental::simd_abi::scalar>,
simd<T, Kokkos::Experimental::simd_abi::scalar>>
where(typename simd<
T, Kokkos::Experimental::simd_abi::scalar>::mask_type const& mask,
simd<T, Kokkos::Experimental::simd_abi::scalar>& value) {
return where_expression(mask, value);
}

template <class T, class Abi>
[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION
const_where_expression<simd_mask<T, Abi>, simd<T, Abi>>
Expand All @@ -120,16 +106,6 @@ template <class T, class Abi>
return const_where_expression(mask, value);
}

template <class T>
[[nodiscard]] KOKKOS_FORCEINLINE_FUNCTION
const_where_expression<simd_mask<T, Kokkos::Experimental::simd_abi::scalar>,
simd<T, Kokkos::Experimental::simd_abi::scalar>>
where(typename simd<
T, Kokkos::Experimental::simd_abi::scalar>::mask_type const& mask,
simd<T, Kokkos::Experimental::simd_abi::scalar> const& value) {
return const_where_expression(mask, value);
}

template <class T>
[[nodiscard]] KOKKOS_FORCEINLINE_FUNCTION where_expression<bool, T> where(
bool mask, T& value) {
Expand Down Expand Up @@ -337,36 +313,18 @@ template <class T, class Abi>
return a == simd_mask<T, Abi>(true);
}

template <class T>
[[nodiscard]] KOKKOS_FORCEINLINE_FUNCTION bool all_of(
simd_mask<T, Kokkos::Experimental::simd_abi::scalar> const& a) {
return a == simd_mask<T, Kokkos::Experimental::simd_abi::scalar>(true);
}

template <class T, class Abi>
[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool any_of(
simd_mask<T, Abi> const& a) {
return a != simd_mask<T, Abi>(false);
}

template <class T>
[[nodiscard]] KOKKOS_FORCEINLINE_FUNCTION bool any_of(
simd_mask<T, Kokkos::Experimental::simd_abi::scalar> const& a) {
return a != simd_mask<T, Kokkos::Experimental::simd_abi::scalar>(false);
}

template <class T, class Abi>
[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool none_of(
simd_mask<T, Abi> const& a) {
return a == simd_mask<T, Abi>(false);
}

template <class T>
[[nodiscard]] KOKKOS_FORCEINLINE_FUNCTION bool none_of(
simd_mask<T, Kokkos::Experimental::simd_abi::scalar> const& a) {
return a == simd_mask<T, Kokkos::Experimental::simd_abi::scalar>(false);
}

template <typename T, typename Abi>
[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION T
hmin(const_where_expression<simd_mask<T, Abi>, simd<T, Abi>> const& x) {
Expand Down
38 changes: 38 additions & 0 deletions simd/src/Kokkos_SIMD_Scalar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,44 @@ class where_expression<simd_mask<T, simd_abi::scalar>,
}
};

template <class T>
[[nodiscard]] KOKKOS_FORCEINLINE_FUNCTION
where_expression<simd_mask<T, Kokkos::Experimental::simd_abi::scalar>,
simd<T, Kokkos::Experimental::simd_abi::scalar>>
where(typename simd<
T, Kokkos::Experimental::simd_abi::scalar>::mask_type const& mask,
simd<T, Kokkos::Experimental::simd_abi::scalar>& value) {
return where_expression(mask, value);
}

template <class T>
[[nodiscard]] KOKKOS_FORCEINLINE_FUNCTION
const_where_expression<simd_mask<T, Kokkos::Experimental::simd_abi::scalar>,
simd<T, Kokkos::Experimental::simd_abi::scalar>>
where(typename simd<
T, Kokkos::Experimental::simd_abi::scalar>::mask_type const& mask,
simd<T, Kokkos::Experimental::simd_abi::scalar> const& value) {
return const_where_expression(mask, value);
}

template <class T>
[[nodiscard]] KOKKOS_FORCEINLINE_FUNCTION bool all_of(
simd_mask<T, Kokkos::Experimental::simd_abi::scalar> const& a) {
return a == simd_mask<T, Kokkos::Experimental::simd_abi::scalar>(true);
}

template <class T>
[[nodiscard]] KOKKOS_FORCEINLINE_FUNCTION bool any_of(
simd_mask<T, Kokkos::Experimental::simd_abi::scalar> const& a) {
return a != simd_mask<T, Kokkos::Experimental::simd_abi::scalar>(false);
}

template <class T>
[[nodiscard]] KOKKOS_FORCEINLINE_FUNCTION bool none_of(
simd_mask<T, Kokkos::Experimental::simd_abi::scalar> const& a) {
return a == simd_mask<T, Kokkos::Experimental::simd_abi::scalar>(false);
}

template <class T>
[[nodiscard]] KOKKOS_FORCEINLINE_FUNCTION T
reduce(const_where_expression<simd_mask<T, simd_abi::scalar>,
Expand Down

0 comments on commit 99fe134

Please sign in to comment.