diff options
author | 2015-12-21 11:21:39 -0800 | |
---|---|---|
committer | 2015-12-21 11:21:39 -0800 | |
commit | 994d1c60b9d808b940580673806c222e4f1da3c5 (patch) | |
tree | 59188ea61e00807c293272e233fb943f63d01104 /Eigen | |
parent | b8861b0c25475d92f805a4481f3fb584c693a9a6 (diff) |
Free memory allocated using posix_memalign() with free() instead of std::free()
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Core/arch/AVX/PacketMath.h | 9 | ||||
-rw-r--r-- | Eigen/src/Core/util/Memory.h | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/Eigen/src/Core/arch/AVX/PacketMath.h b/Eigen/src/Core/arch/AVX/PacketMath.h index 717ae67c5..977910ca2 100644 --- a/Eigen/src/Core/arch/AVX/PacketMath.h +++ b/Eigen/src/Core/arch/AVX/PacketMath.h @@ -48,7 +48,9 @@ template<> struct is_arithmetic<__m256d> { enum { value = true }; }; #define _EIGEN_DECLARE_CONST_Packet8i(NAME,X) \ const Packet8i p8i_##NAME = pset1<Packet8i>(X) - +// Use the packet_traits defined in AVX512/PacketMath.h instead if we're going +// to leverage AVX512 instructions. +#ifndef EIGEN_VECTORIZE_AVX512 template<> struct packet_traits<float> : default_packet_traits { typedef Packet8f type; @@ -92,6 +94,7 @@ template<> struct packet_traits<double> : default_packet_traits HasCeil = 1 }; }; +#endif /* Proper support for integers is only provided by AVX2. In the meantime, we'll use SSE instructions and packets to deal with integers. @@ -117,8 +120,10 @@ template<> EIGEN_STRONG_INLINE Packet8i pset1<Packet8i>(const int& from) { re template<> EIGEN_STRONG_INLINE Packet8f pload1<Packet8f>(const float* from) { return _mm256_broadcast_ss(from); } template<> EIGEN_STRONG_INLINE Packet4d pload1<Packet4d>(const double* from) { return _mm256_broadcast_sd(from); } +#ifndef EIGEN_VECTORIZE_AVX512 template<> EIGEN_STRONG_INLINE Packet8f plset<Packet8f>(const float& a) { return _mm256_add_ps(_mm256_set1_ps(a), _mm256_set_ps(7.0,6.0,5.0,4.0,3.0,2.0,1.0,0.0)); } template<> EIGEN_STRONG_INLINE Packet4d plset<Packet4d>(const double& a) { return _mm256_add_pd(_mm256_set1_pd(a), _mm256_set_pd(3.0,2.0,1.0,0.0)); } +#endif template<> EIGEN_STRONG_INLINE Packet8f padd<Packet8f>(const Packet8f& a, const Packet8f& b) { return _mm256_add_ps(a,b); } template<> EIGEN_STRONG_INLINE Packet4d padd<Packet4d>(const Packet4d& a, const Packet4d& b) { return _mm256_add_pd(a,b); } @@ -300,9 +305,11 @@ template<> EIGEN_STRONG_INLINE void pstore1<Packet8i>(int* to, const int& a) pstore(to, pa); } +#ifndef EIGEN_VECTORIZE_AVX512 template<> EIGEN_STRONG_INLINE void prefetch<float>(const float* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); } template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); } template<> EIGEN_STRONG_INLINE void prefetch<int>(const int* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); } +#endif template<> EIGEN_STRONG_INLINE float pfirst<Packet8f>(const Packet8f& a) { return _mm_cvtss_f32(_mm256_castps256_ps128(a)); diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h index 1fc535a3a..e4d461512 100644 --- a/Eigen/src/Core/util/Memory.h +++ b/Eigen/src/Core/util/Memory.h @@ -246,7 +246,7 @@ EIGEN_DEVICE_FUNC inline void aligned_free(void *ptr) #elif EIGEN_MALLOC_ALREADY_ALIGNED std::free(ptr); #elif EIGEN_HAS_POSIX_MEMALIGN - std::free(ptr); + free(ptr); #elif EIGEN_HAS_MM_MALLOC _mm_free(ptr); #elif EIGEN_OS_WIN_STRICT |