Skip to content

Commit

Permalink
Fix Kokkos_SIMD with AVX2 on 64-bit architectures (kokkos#6075)
Browse files Browse the repository at this point in the history
* Fix Kokkos_SIMD with AVX2 on 64-bit architectures

* Restore value_type for mask type
  • Loading branch information
masterleinad committed Apr 26, 2023
1 parent c09dd1c commit 4b27b7d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions simd/src/Kokkos_SIMD_AVX2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,8 @@ template <>
class simd<std::int64_t, simd_abi::avx2_fixed_size<4>> {
__m256i m_value;

static_assert(sizeof(long long) == 8);

public:
using value_type = std::int64_t;
using abi_type = simd_abi::avx2_fixed_size<4>;
Expand Down Expand Up @@ -727,11 +729,13 @@ class simd<std::int64_t, simd_abi::avx2_fixed_size<4>> {
}
KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_from(value_type const* ptr,
element_aligned_tag) {
m_value = _mm256_maskload_epi64(ptr, static_cast<__m256i>(mask_type(true)));
m_value = _mm256_maskload_epi64(reinterpret_cast<long long const*>(ptr),
static_cast<__m256i>(mask_type(true)));
}
KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_to(
value_type* ptr, element_aligned_tag) const {
_mm256_maskstore_epi64(ptr, static_cast<__m256i>(mask_type(true)), m_value);
_mm256_maskstore_epi64(reinterpret_cast<long long*>(ptr),
static_cast<__m256i>(mask_type(true)), m_value);
}
KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator __m256i()
const {
Expand Down

0 comments on commit 4b27b7d

Please sign in to comment.