Skip to content

Commit

Permalink
Add missing ReductionIdentity<char> specialization
Browse files Browse the repository at this point in the history
  • Loading branch information
dalg24 committed Jan 23, 2023
1 parent 2bde8fc commit de26b23
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions core/src/Kokkos_ReductionIdentity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,30 @@ type { static_assert( false, "Missing specialization of
Kokkos::reduction_identity for custom land reduction type"); return T(); }
};*/

template <>
struct reduction_identity<char> {
KOKKOS_FORCEINLINE_FUNCTION constexpr static char sum() {
return static_cast<char>(0);
}
KOKKOS_FORCEINLINE_FUNCTION constexpr static char prod() {
return static_cast<char>(1);
}
KOKKOS_FORCEINLINE_FUNCTION constexpr static char max() { return CHAR_MIN; }
KOKKOS_FORCEINLINE_FUNCTION constexpr static char min() { return CHAR_MAX; }
KOKKOS_FORCEINLINE_FUNCTION constexpr static char bor() {
return static_cast<char>(0x0);
}
KOKKOS_FORCEINLINE_FUNCTION constexpr static char band() {
return ~static_cast<char>(0x0);
}
KOKKOS_FORCEINLINE_FUNCTION constexpr static char lor() {
return static_cast<char>(0);
}
KOKKOS_FORCEINLINE_FUNCTION constexpr static char land() {
return static_cast<char>(1);
}
};

template <>
struct reduction_identity<signed char> {
KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char sum() {
Expand Down

0 comments on commit de26b23

Please sign in to comment.