fix(tulip): fix some SIMD issues

This commit is contained in:
2026-11-22 15:12:19 +01:00
parent 3a27df500e
commit f98615fea4
4 changed files with 11 additions and 9 deletions
+3 -3
View File
@@ -14,10 +14,10 @@ struct traits<float, avx_isa> {
static constexpr std::size_t width = 4; static constexpr std::size_t width = 4;
static pack_type load(const float* ptr) noexcept { return _mm128_loadu_ps(ptr); } static pack_type load(const float* ptr) noexcept { return _mm_loadu_ps(ptr); }
static void store(float* ptr, pack_type value) noexcept { _mm128_storeu_ps(ptr, value); } static void store(float* ptr, pack_type value) noexcept { _mm_storeu_ps(ptr, value); }
static pack_type add(pack_type lhs, pack_type rhs) noexcept { return _mm128_add_ps(lhs, rhs); } static pack_type add(pack_type lhs, pack_type rhs) noexcept { return _mm_add_ps(lhs, rhs); }
}; };
#endif // TULIP_AVX_SUPPORTED #endif // TULIP_AVX_SUPPORTED
+3 -3
View File
@@ -26,10 +26,10 @@ struct traits<double, avx2_isa> {
static constexpr std::size_t width = 4; static constexpr std::size_t width = 4;
static pack_type load(const double* ptr) noexcept { return _mm256d_loadu_ps(ptr); } static pack_type load(const double* ptr) noexcept { return _mm256_loadu_pd(ptr); }
static void store(double* ptr, pack_type value) noexcept { _mm256d_storeu_ps(ptr, value); } static void store(double* ptr, pack_type value) noexcept { _mm256_storeu_pd(ptr, value); }
static pack_type add(pack_type lhs, pack_type rhs) noexcept { return _mm256d_add_ps(lhs, rhs); } static pack_type add(pack_type lhs, pack_type rhs) noexcept { return _mm256_add_pd(lhs, rhs); }
}; };
#endif // TULIP_AVX2_SUPPORTED #endif // TULIP_AVX2_SUPPORTED
+4 -2
View File
@@ -1,6 +1,10 @@
#ifndef TULIP_SIMD_CONFIG_HPP #ifndef TULIP_SIMD_CONFIG_HPP
#define TULIP_SIMD_CONFIG_HPP #define TULIP_SIMD_CONFIG_HPP
#if defined(__AVX__) || defined(__AVX2__)
#include <immintrin.h>
#endif
namespace tulip { namespace tulip {
namespace simd { namespace simd {
@@ -10,12 +14,10 @@ struct avx2_isa {};
#ifdef __AVX__ #ifdef __AVX__
#define TULIP_AVX_SUPPORTED #define TULIP_AVX_SUPPORTED
#include <immintrin.h>
#endif // __AVX__ #endif // __AVX__
#ifdef __AVX2__ #ifdef __AVX2__
#define TULIP_AVX2_SUPPORTED #define TULIP_AVX2_SUPPORTED
#include <immintrin.h>
#endif // __AVX2__ #endif // __AVX2__
} // namespace simd } // namespace simd
+1 -1
View File
@@ -36,7 +36,7 @@ static auto load(const T* ptr) noexcept {
} }
template <typename T, typename Isa> template <typename T, typename Isa>
static void store(const T* ptr, pack_t<T, Isa> value) noexcept { static void store(T* ptr, pack_t<T, Isa> value) noexcept {
traits<T, Isa>::store(ptr, value); traits<T, Isa>::store(ptr, value);
} }