From d9c710f0dbfbcd00b510aaed3e3dee8600022d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= Date: Fri, 25 May 2018 15:21:55 +0200 Subject: [PATCH] Fix compilation of Jacobi rotations with ARM NEON Some specializations of internal::conj_helper were missing --- ...-fix_compilation_of_Jacobi_rotations.patch | 245 ++++++++++++++++++ eigen3.spec | 11 +- 2 files changed, 255 insertions(+), 1 deletion(-) create mode 100644 eigen3-3.3.4-fix_compilation_of_Jacobi_rotations.patch diff --git a/eigen3-3.3.4-fix_compilation_of_Jacobi_rotations.patch b/eigen3-3.3.4-fix_compilation_of_Jacobi_rotations.patch new file mode 100644 index 0000000..0838f30 --- /dev/null +++ b/eigen3-3.3.4-fix_compilation_of_Jacobi_rotations.patch @@ -0,0 +1,245 @@ +# HG changeset patch +# User Gael Guennebaud +# Date 1497514590 -7200 +# Node ID d781c1de98342c5ca29c2fe719d8d3c96a35dcd4 +# Parent 48cd83b2b459aa9f3f5dca135d38760fe0b02a2f +Bug 1436: fix compilation of Jacobi rotations with ARM NEON, some specializations of internal::conj_helper were missing. + +diff --git a/Eigen/Core b/Eigen/Core +--- a/Eigen/Core ++++ b/Eigen/Core +@@ -371,6 +371,7 @@ + #include "src/Core/MathFunctions.h" + #include "src/Core/GenericPacketMath.h" + #include "src/Core/MathFunctionsImpl.h" ++#include "src/Core/arch/Default/ConjHelper.h" + + #if defined EIGEN_VECTORIZE_AVX512 + #include "src/Core/arch/SSE/PacketMath.h" +diff --git a/Eigen/src/Core/arch/AVX/Complex.h b/Eigen/src/Core/arch/AVX/Complex.h +--- a/Eigen/src/Core/arch/AVX/Complex.h ++++ b/Eigen/src/Core/arch/AVX/Complex.h +@@ -204,23 +204,7 @@ + } + }; + +-template<> struct conj_helper +-{ +- EIGEN_STRONG_INLINE Packet4cf pmadd(const Packet8f& x, const Packet4cf& y, const Packet4cf& c) const +- { return padd(c, pmul(x,y)); } +- +- EIGEN_STRONG_INLINE Packet4cf pmul(const Packet8f& x, const Packet4cf& y) const +- { return Packet4cf(Eigen::internal::pmul(x, y.v)); } +-}; +- +-template<> struct conj_helper +-{ +- EIGEN_STRONG_INLINE Packet4cf pmadd(const Packet4cf& x, const Packet8f& y, const Packet4cf& c) const +- { return padd(c, pmul(x,y)); } +- +- EIGEN_STRONG_INLINE Packet4cf pmul(const Packet4cf& x, const Packet8f& y) const +- { return Packet4cf(Eigen::internal::pmul(x.v, y)); } +-}; ++EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet4cf,Packet8f) + + template<> EIGEN_STRONG_INLINE Packet4cf pdiv(const Packet4cf& a, const Packet4cf& b) + { +@@ -400,23 +384,7 @@ + } + }; + +-template<> struct conj_helper +-{ +- EIGEN_STRONG_INLINE Packet2cd pmadd(const Packet4d& x, const Packet2cd& y, const Packet2cd& c) const +- { return padd(c, pmul(x,y)); } +- +- EIGEN_STRONG_INLINE Packet2cd pmul(const Packet4d& x, const Packet2cd& y) const +- { return Packet2cd(Eigen::internal::pmul(x, y.v)); } +-}; +- +-template<> struct conj_helper +-{ +- EIGEN_STRONG_INLINE Packet2cd pmadd(const Packet2cd& x, const Packet4d& y, const Packet2cd& c) const +- { return padd(c, pmul(x,y)); } +- +- EIGEN_STRONG_INLINE Packet2cd pmul(const Packet2cd& x, const Packet4d& y) const +- { return Packet2cd(Eigen::internal::pmul(x.v, y)); } +-}; ++EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet2cd,Packet4d) + + template<> EIGEN_STRONG_INLINE Packet2cd pdiv(const Packet2cd& a, const Packet2cd& b) + { +diff --git a/Eigen/src/Core/arch/AltiVec/Complex.h b/Eigen/src/Core/arch/AltiVec/Complex.h +--- a/Eigen/src/Core/arch/AltiVec/Complex.h ++++ b/Eigen/src/Core/arch/AltiVec/Complex.h +@@ -224,23 +224,7 @@ + } + }; + +-template<> struct conj_helper +-{ +- EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet4f& x, const Packet2cf& y, const Packet2cf& c) const +- { return padd(c, pmul(x,y)); } +- +- EIGEN_STRONG_INLINE Packet2cf pmul(const Packet4f& x, const Packet2cf& y) const +- { return Packet2cf(internal::pmul(x, y.v)); } +-}; +- +-template<> struct conj_helper +-{ +- EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet4f& y, const Packet2cf& c) const +- { return padd(c, pmul(x,y)); } +- +- EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& x, const Packet4f& y) const +- { return Packet2cf(internal::pmul(x.v, y)); } +-}; ++EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet2cf,Packet4f) + + template<> EIGEN_STRONG_INLINE Packet2cf pdiv(const Packet2cf& a, const Packet2cf& b) + { +@@ -416,23 +400,8 @@ + return pconj(internal::pmul(a, b)); + } + }; +-template<> struct conj_helper +-{ +- EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet2d& x, const Packet1cd& y, const Packet1cd& c) const +- { return padd(c, pmul(x,y)); } + +- EIGEN_STRONG_INLINE Packet1cd pmul(const Packet2d& x, const Packet1cd& y) const +- { return Packet1cd(internal::pmul(x, y.v)); } +-}; +- +-template<> struct conj_helper +-{ +- EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet2d& y, const Packet1cd& c) const +- { return padd(c, pmul(x,y)); } +- +- EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& x, const Packet2d& y) const +- { return Packet1cd(internal::pmul(x.v, y)); } +-}; ++EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet1cd,Packet2d) + + template<> EIGEN_STRONG_INLINE Packet1cd pdiv(const Packet1cd& a, const Packet1cd& b) + { +diff --git a/Eigen/src/Core/arch/Default/ConjHelper.h b/Eigen/src/Core/arch/Default/ConjHelper.h +new file mode 100644 +--- /dev/null ++++ b/Eigen/src/Core/arch/Default/ConjHelper.h +@@ -0,0 +1,29 @@ ++ ++// This file is part of Eigen, a lightweight C++ template library ++// for linear algebra. ++// ++// Copyright (C) 2017 Gael Guennebaud ++// ++// This Source Code Form is subject to the terms of the Mozilla ++// Public License v. 2.0. If a copy of the MPL was not distributed ++// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. ++ ++#ifndef EIGEN_ARCH_CONJ_HELPER_H ++#define EIGEN_ARCH_CONJ_HELPER_H ++ ++#define EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(PACKET_CPLX, PACKET_REAL) \ ++ template<> struct conj_helper { \ ++ EIGEN_STRONG_INLINE PACKET_CPLX pmadd(const PACKET_REAL& x, const PACKET_CPLX& y, const PACKET_CPLX& c) const \ ++ { return padd(c, pmul(x,y)); } \ ++ EIGEN_STRONG_INLINE PACKET_CPLX pmul(const PACKET_REAL& x, const PACKET_CPLX& y) const \ ++ { return PACKET_CPLX(Eigen::internal::pmul(x, y.v)); } \ ++ }; \ ++ \ ++ template<> struct conj_helper { \ ++ EIGEN_STRONG_INLINE PACKET_CPLX pmadd(const PACKET_CPLX& x, const PACKET_REAL& y, const PACKET_CPLX& c) const \ ++ { return padd(c, pmul(x,y)); } \ ++ EIGEN_STRONG_INLINE PACKET_CPLX pmul(const PACKET_CPLX& x, const PACKET_REAL& y) const \ ++ { return PACKET_CPLX(Eigen::internal::pmul(x.v, y)); } \ ++ }; ++ ++#endif // EIGEN_ARCH_CONJ_HELPER_H +diff --git a/Eigen/src/Core/arch/NEON/Complex.h b/Eigen/src/Core/arch/NEON/Complex.h +--- a/Eigen/src/Core/arch/NEON/Complex.h ++++ b/Eigen/src/Core/arch/NEON/Complex.h +@@ -265,6 +265,8 @@ + } + }; + ++EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet2cf,Packet4f) ++ + template<> EIGEN_STRONG_INLINE Packet2cf pdiv(const Packet2cf& a, const Packet2cf& b) + { + // TODO optimize it for NEON +@@ -456,6 +458,8 @@ + } + }; + ++EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet1cd,Packet2d) ++ + template<> EIGEN_STRONG_INLINE Packet1cd pdiv(const Packet1cd& a, const Packet1cd& b) + { + // TODO optimize it for NEON +diff --git a/Eigen/src/Core/arch/SSE/Complex.h b/Eigen/src/Core/arch/SSE/Complex.h +--- a/Eigen/src/Core/arch/SSE/Complex.h ++++ b/Eigen/src/Core/arch/SSE/Complex.h +@@ -229,23 +229,7 @@ + } + }; + +-template<> struct conj_helper +-{ +- EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet4f& x, const Packet2cf& y, const Packet2cf& c) const +- { return padd(c, pmul(x,y)); } +- +- EIGEN_STRONG_INLINE Packet2cf pmul(const Packet4f& x, const Packet2cf& y) const +- { return Packet2cf(Eigen::internal::pmul(x, y.v)); } +-}; +- +-template<> struct conj_helper +-{ +- EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet4f& y, const Packet2cf& c) const +- { return padd(c, pmul(x,y)); } +- +- EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& x, const Packet4f& y) const +- { return Packet2cf(Eigen::internal::pmul(x.v, y)); } +-}; ++EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet2cf,Packet4f) + + template<> EIGEN_STRONG_INLINE Packet2cf pdiv(const Packet2cf& a, const Packet2cf& b) + { +@@ -430,23 +414,7 @@ + } + }; + +-template<> struct conj_helper +-{ +- EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet2d& x, const Packet1cd& y, const Packet1cd& c) const +- { return padd(c, pmul(x,y)); } +- +- EIGEN_STRONG_INLINE Packet1cd pmul(const Packet2d& x, const Packet1cd& y) const +- { return Packet1cd(Eigen::internal::pmul(x, y.v)); } +-}; +- +-template<> struct conj_helper +-{ +- EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet2d& y, const Packet1cd& c) const +- { return padd(c, pmul(x,y)); } +- +- EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& x, const Packet2d& y) const +- { return Packet1cd(Eigen::internal::pmul(x.v, y)); } +-}; ++EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet1cd,Packet2d) + + template<> EIGEN_STRONG_INLINE Packet1cd pdiv(const Packet1cd& a, const Packet1cd& b) + { +diff --git a/Eigen/src/Core/arch/ZVector/Complex.h b/Eigen/src/Core/arch/ZVector/Complex.h +--- a/Eigen/src/Core/arch/ZVector/Complex.h ++++ b/Eigen/src/Core/arch/ZVector/Complex.h +@@ -336,6 +336,9 @@ + } + }; + ++EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet2cf,Packet4f) ++EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet1cd,Packet2d) ++ + template<> EIGEN_STRONG_INLINE Packet1cd pdiv(const Packet1cd& a, const Packet1cd& b) + { + // TODO optimize it for AltiVec diff --git a/eigen3.spec b/eigen3.spec index 297078d..0fa554a 100644 --- a/eigen3.spec +++ b/eigen3.spec @@ -8,7 +8,7 @@ Name: eigen3 Version: 3.3.4 -Release: 5%{?dist} +Release: 6%{?dist} Summary: A lightweight C++ template library for vector and matrix math Group: Development/Libraries @@ -25,6 +25,10 @@ Patch1: eigen_pkgconfig.patch # Fix the include paths in the new Eigen3Config.cmake file Patch2: eigen3-3.3.1-fixcmake.patch +# Bug 1436: fix compilation of Jacobi rotations with ARM NEON, +# some specializations of internal::conj_helper were missing. +Patch3: https://bitbucket.org/eigen/eigen/commits/d781c1de98342c5ca29c2fe719d8d3c96a35dcd4/raw#/eigen3-3.3.4-fix_compilation_of_Jacobi_rotations.patch + BuildRequires: atlas-devel BuildRequires: fftw-devel BuildRequires: glew-devel @@ -72,6 +76,7 @@ Developer documentation for Eigen. %patch0 -p1 %patch1 -p1 %patch2 -p0 -b .fixcmake +%patch3 -p1 -b .bug1436 %build mkdir %{_target_platform} pushd %{_target_platform} @@ -113,6 +118,10 @@ rm -f %{_target_platform}/doc/html/unsupported/installdox %doc %{_target_platform}/doc/html %changelog +* Fri May 25 2018 Björn Esser - 3.3.4-6 +- Fix compilation of Jacobi rotations with ARM NEON, some + specializations of internal::conj_helper were missing + * Sun Feb 18 2018 Sandro Mani - 3.3.4-5 - Add missing BR: gcc-c++, make