Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jun 2024 15:12:36 GMT
From:      Piotr Kubaj <pkubaj@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 6a40d2932f25 - main - math/py-cvxpy: fix build on powerpc64
Message-ID:  <202406031512.453FCacv042809@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6a40d2932f2520c3701186f7465a039711360253

commit 6a40d2932f2520c3701186f7465a039711360253
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2024-06-03 15:03:01 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2024-06-03 15:12:01 +0000

    math/py-cvxpy: fix build on powerpc64
    
    cvxpy/cvxcore/src/../include/Eigen/src/Core/arch/AltiVec/MatrixProduct.h:70:11: error: unknown type name 'Packet2d'
       70 |   typedef Packet2d                        vectortype;
          |           ^
    cvxpy/cvxcore/src/../include/Eigen/src/Core/arch/AltiVec/MatrixProduct.h:72:23: error: use of undeclared identifier 'Packet2d'
       72 |   typedef PacketBlock<Packet2d,2>            rhstype;
          |                       ^
    cvxpy/cvxcore/src/../include/Eigen/src/Core/arch/AltiVec/MatrixProduct.h:656:44: error: use of undeclared identifier 'Packet2d'
      656 | struct dhs_pack<double, Index, DataMapper, Packet2d, StorageOrder, PanelMode, true>
          |                                            ^
    cvxpy/cvxcore/src/../include/Eigen/src/Core/arch/AltiVec/MatrixProduct.h:723:44: error: use of undeclared identifier 'Packet2d'
      723 | struct dhs_pack<double, Index, DataMapper, Packet2d, StorageOrder, PanelMode, false>
          |                                            ^
    cvxpy/cvxcore/src/../include/Eigen/src/Core/arch/AltiVec/MatrixProduct.h:1250:14: error: unknown type name 'Packet2l'
     1250 | const static Packet2l mask21 = { -1, 0 };
          |              ^
    cvxpy/cvxcore/src/../include/Eigen/src/Core/arch/AltiVec/MatrixProduct.h:1267:21: error: unknown type name 'Packet2d'
     1267 | EIGEN_ALWAYS_INLINE Packet2d bmask<Packet2d>(const int remaining_rows)
          |                     ^
    cvxpy/cvxcore/src/../include/Eigen/src/Core/arch/AltiVec/MatrixProduct.h:1267:36: error: use of undeclared identifier 'Packet2d'
     1267 | EIGEN_ALWAYS_INLINE Packet2d bmask<Packet2d>(const int remaining_rows)
---
 .../files/patch-cvxpy_cvxcore_include_Eigen_Core   |  11 ++
 ...e_include_Eigen_src_Core_arch_AltiVec_Complex.h |  18 ++++
 ...ude_Eigen_src_Core_arch_AltiVec_MathFunctions.h |  47 +++++++++
 ...nclude_Eigen_src_Core_arch_AltiVec_PacketMath.h | 117 +++++++++++++++++++++
 4 files changed, 193 insertions(+)

diff --git a/math/py-cvxpy/files/patch-cvxpy_cvxcore_include_Eigen_Core b/math/py-cvxpy/files/patch-cvxpy_cvxcore_include_Eigen_Core
new file mode 100644
index 000000000000..e3e6d1ed6d71
--- /dev/null
+++ b/math/py-cvxpy/files/patch-cvxpy_cvxcore_include_Eigen_Core
@@ -0,0 +1,11 @@
+--- cvxpy/cvxcore/include/Eigen/Core.orig	2021-08-18 20:41:58 UTC
++++ cvxpy/cvxcore/include/Eigen/Core
+@@ -346,7 +346,7 @@ using std::ptrdiff_t;
+ #include "src/Core/CoreIterators.h"
+ #include "src/Core/ConditionEstimator.h"
+ 
+-#if defined(EIGEN_VECTORIZE_ALTIVEC) || defined(EIGEN_VECTORIZE_VSX)
++#if defined(EIGEN_VECTORIZE_VSX)
+   #include "src/Core/arch/AltiVec/MatrixProduct.h"
+ #elif defined EIGEN_VECTORIZE_NEON
+   #include "src/Core/arch/NEON/GeneralBlockPanelKernel.h"
diff --git a/math/py-cvxpy/files/patch-cvxpy_cvxcore_include_Eigen_src_Core_arch_AltiVec_Complex.h b/math/py-cvxpy/files/patch-cvxpy_cvxcore_include_Eigen_src_Core_arch_AltiVec_Complex.h
new file mode 100644
index 000000000000..9729b0b44ea7
--- /dev/null
+++ b/math/py-cvxpy/files/patch-cvxpy_cvxcore_include_Eigen_src_Core_arch_AltiVec_Complex.h
@@ -0,0 +1,18 @@
+--- cvxpy/cvxcore/include/Eigen/src/Core/arch/AltiVec/Complex.h.orig	2021-08-18 20:41:58 UTC
++++ cvxpy/cvxcore/include/Eigen/src/Core/arch/AltiVec/Complex.h
+@@ -100,6 +100,7 @@ template<> struct packet_traits<std::complex<float> > 
+     HasAbs2   = 0,
+     HasMin    = 0,
+     HasMax    = 0,
++    HasSqrt   = 1,
+ #ifdef __VSX__
+     HasBlend  = 1,
+ #endif
+@@ -320,6 +321,7 @@ template<> struct packet_traits<std::complex<double> >
+     HasAbs2   = 0,
+     HasMin    = 0,
+     HasMax    = 0,
++    HasSqrt   = 1,
+     HasSetLinear = 0
+   };
+ };
diff --git a/math/py-cvxpy/files/patch-cvxpy_cvxcore_include_Eigen_src_Core_arch_AltiVec_MathFunctions.h b/math/py-cvxpy/files/patch-cvxpy_cvxcore_include_Eigen_src_Core_arch_AltiVec_MathFunctions.h
new file mode 100644
index 000000000000..8d766277495a
--- /dev/null
+++ b/math/py-cvxpy/files/patch-cvxpy_cvxcore_include_Eigen_src_Core_arch_AltiVec_MathFunctions.h
@@ -0,0 +1,47 @@
+--- cvxpy/cvxcore/include/Eigen/src/Core/arch/AltiVec/MathFunctions.h.orig	2021-08-18 20:41:58 UTC
++++ cvxpy/cvxcore/include/Eigen/src/Core/arch/AltiVec/MathFunctions.h
+@@ -40,16 +40,14 @@ Packet4f pcos<Packet4f>(const Packet4f& _x)
+   return pcos_float(_x);
+ }
+ 
++#ifdef __VSX__
+ #ifndef EIGEN_COMP_CLANG
+ template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
+ Packet4f prsqrt<Packet4f>(const Packet4f& x)
+ {
+   return  vec_rsqrt(x);
+ }
+-#endif
+ 
+-#ifdef __VSX__
+-#ifndef EIGEN_COMP_CLANG
+ template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
+ Packet2d prsqrt<Packet2d>(const Packet2d& x)
+ {
+@@ -73,6 +71,26 @@ template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEF
+ Packet2d pexp<Packet2d>(const Packet2d& _x)
+ {
+   return pexp_double(_x);
++}
++
++template<> EIGEN_STRONG_INLINE Packet8bf psqrt<Packet8bf> (const Packet8bf& a){
++  BF16_TO_F32_UNARY_OP_WRAPPER(psqrt<Packet4f>, a);
++}
++
++#ifndef EIGEN_COMP_CLANG
++template<> EIGEN_STRONG_INLINE Packet8bf prsqrt<Packet8bf> (const Packet8bf& a){
++  BF16_TO_F32_UNARY_OP_WRAPPER(prsqrt<Packet4f>, a);
++}
++#endif
++#else
++template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
++Packet4f psqrt<Packet4f>(const Packet4f& x)
++{
++  Packet4f a;
++  for (Index i = 0; i < packet_traits<float>::size; i++) {
++    a[i] = numext::sqrt(x[i]);
++  }
++  return a;
+ }
+ #endif
+ 
diff --git a/math/py-cvxpy/files/patch-cvxpy_cvxcore_include_Eigen_src_Core_arch_AltiVec_PacketMath.h b/math/py-cvxpy/files/patch-cvxpy_cvxcore_include_Eigen_src_Core_arch_AltiVec_PacketMath.h
new file mode 100644
index 000000000000..b1d23be2b5b7
--- /dev/null
+++ b/math/py-cvxpy/files/patch-cvxpy_cvxcore_include_Eigen_src_Core_arch_AltiVec_PacketMath.h
@@ -0,0 +1,117 @@
+--- cvxpy/cvxcore/include/Eigen/src/Core/arch/AltiVec/PacketMath.h.orig	2021-08-18 20:41:58 UTC
++++ cvxpy/cvxcore/include/Eigen/src/Core/arch/AltiVec/PacketMath.h
+@@ -175,16 +175,19 @@ struct packet_traits<float> : default_packet_traits {
+ #else
+     HasRsqrt = 0,
+ #endif
++    HasTanh = EIGEN_FAST_MATH,
++    HasErf = EIGEN_FAST_MATH,
++    HasRint = 1,
+ #else
+     HasSqrt = 0,
+     HasRsqrt = 0,
+-    HasTanh = EIGEN_FAST_MATH,
+-    HasErf = EIGEN_FAST_MATH,
++    HasTanh = 0,
++    HasErf = 0,
++    HasRint = 0,
+ #endif
+     HasRound = 1,
+     HasFloor = 1,
+     HasCeil = 1,
+-    HasRint = 1,
+     HasNegate = 1,
+     HasBlend = 1
+   };
+@@ -217,16 +220,17 @@ struct packet_traits<bfloat16> : default_packet_traits
+ #else
+     HasRsqrt = 0,
+ #endif
++    HasRint = 1,
+ #else
+     HasSqrt = 0,
+     HasRsqrt = 0,
+-    HasTanh = EIGEN_FAST_MATH,
+-    HasErf = EIGEN_FAST_MATH,
++    HasRint = 0,
+ #endif
++    HasTanh = 0,
++    HasErf = 0,
+     HasRound = 1,
+     HasFloor = 1,
+     HasCeil = 1,
+-    HasRint = 1,
+     HasNegate = 1,
+     HasBlend = 1
+   };
+@@ -872,19 +876,29 @@ template<> EIGEN_STRONG_INLINE Packet4f pcmp_lt_or_nan
+   return vec_nor(c,c);
+ }
+ 
++#ifdef __VSX__
+ template<> EIGEN_STRONG_INLINE Packet4i pcmp_le(const Packet4i& a, const Packet4i& b) { return reinterpret_cast<Packet4i>(vec_cmple(a,b)); }
++#endif
+ template<> EIGEN_STRONG_INLINE Packet4i pcmp_lt(const Packet4i& a, const Packet4i& b) { return reinterpret_cast<Packet4i>(vec_cmplt(a,b)); }
+ template<> EIGEN_STRONG_INLINE Packet4i pcmp_eq(const Packet4i& a, const Packet4i& b) { return reinterpret_cast<Packet4i>(vec_cmpeq(a,b)); }
++#ifdef __VSX__
+ template<> EIGEN_STRONG_INLINE Packet8s pcmp_le(const Packet8s& a, const Packet8s& b) { return reinterpret_cast<Packet8s>(vec_cmple(a,b)); }
++#endif
+ template<> EIGEN_STRONG_INLINE Packet8s pcmp_lt(const Packet8s& a, const Packet8s& b) { return reinterpret_cast<Packet8s>(vec_cmplt(a,b)); }
+ template<> EIGEN_STRONG_INLINE Packet8s pcmp_eq(const Packet8s& a, const Packet8s& b) { return reinterpret_cast<Packet8s>(vec_cmpeq(a,b)); }
++#ifdef __VSX__
+ template<> EIGEN_STRONG_INLINE Packet8us pcmp_le(const Packet8us& a, const Packet8us& b) { return reinterpret_cast<Packet8us>(vec_cmple(a,b)); }
++#endif
+ template<> EIGEN_STRONG_INLINE Packet8us pcmp_lt(const Packet8us& a, const Packet8us& b) { return reinterpret_cast<Packet8us>(vec_cmplt(a,b)); }
+ template<> EIGEN_STRONG_INLINE Packet8us pcmp_eq(const Packet8us& a, const Packet8us& b) { return reinterpret_cast<Packet8us>(vec_cmpeq(a,b)); }
++#ifdef __VSX__
+ template<> EIGEN_STRONG_INLINE Packet16c pcmp_le(const Packet16c& a, const Packet16c& b) { return reinterpret_cast<Packet16c>(vec_cmple(a,b)); }
++#endif
+ template<> EIGEN_STRONG_INLINE Packet16c pcmp_lt(const Packet16c& a, const Packet16c& b) { return reinterpret_cast<Packet16c>(vec_cmplt(a,b)); }
+ template<> EIGEN_STRONG_INLINE Packet16c pcmp_eq(const Packet16c& a, const Packet16c& b) { return reinterpret_cast<Packet16c>(vec_cmpeq(a,b)); }
++#ifdef __VSX__
+ template<> EIGEN_STRONG_INLINE Packet16uc pcmp_le(const Packet16uc& a, const Packet16uc& b) { return reinterpret_cast<Packet16uc>(vec_cmple(a,b)); }
++#endif
+ template<> EIGEN_STRONG_INLINE Packet16uc pcmp_lt(const Packet16uc& a, const Packet16uc& b) { return reinterpret_cast<Packet16uc>(vec_cmplt(a,b)); }
+ template<> EIGEN_STRONG_INLINE Packet16uc pcmp_eq(const Packet16uc& a, const Packet16uc& b) { return reinterpret_cast<Packet16uc>(vec_cmpeq(a,b)); }
+ 
+@@ -937,6 +951,7 @@ template<> EIGEN_STRONG_INLINE Packet4f pround<Packet4
+ }
+ template<> EIGEN_STRONG_INLINE Packet4f pceil<Packet4f>(const  Packet4f& a) { return vec_ceil(a); }
+ template<> EIGEN_STRONG_INLINE Packet4f pfloor<Packet4f>(const Packet4f& a) { return vec_floor(a); }
++#ifdef __VSX__
+ template<> EIGEN_STRONG_INLINE Packet4f print<Packet4f>(const Packet4f& a)
+ {
+     Packet4f res;
+@@ -947,6 +962,7 @@ template<> EIGEN_STRONG_INLINE Packet4f print<Packet4f
+ 
+     return res;
+ }
++#endif
+ 
+ template<typename Packet> EIGEN_STRONG_INLINE Packet ploadu_common(const __UNPACK_TYPE__(Packet)* from)
+ {
+@@ -1341,12 +1357,6 @@ template<> EIGEN_STRONG_INLINE Packet8bf psub<Packet8b
+   BF16_TO_F32_BINARY_OP_WRAPPER(psub<Packet4f>, a, b);
+ }
+ 
+-template<> EIGEN_STRONG_INLINE Packet8bf psqrt<Packet8bf> (const Packet8bf& a){
+-  BF16_TO_F32_UNARY_OP_WRAPPER(vec_sqrt, a);
+-}
+-template<> EIGEN_STRONG_INLINE Packet8bf prsqrt<Packet8bf> (const Packet8bf& a){
+-  BF16_TO_F32_UNARY_OP_WRAPPER(prsqrt<Packet4f>, a);
+-}
+ template<> EIGEN_STRONG_INLINE Packet8bf pexp<Packet8bf> (const Packet8bf& a){
+   BF16_TO_F32_UNARY_OP_WRAPPER(pexp_float, a);
+ }
+@@ -1390,9 +1400,11 @@ template<> EIGEN_STRONG_INLINE Packet8bf pceil<Packet8
+ template<> EIGEN_STRONG_INLINE Packet8bf pround<Packet8bf> (const Packet8bf& a){
+   BF16_TO_F32_UNARY_OP_WRAPPER(pround<Packet4f>, a);
+ }
++#ifdef __VSX__
+ template<> EIGEN_STRONG_INLINE Packet8bf print<Packet8bf> (const Packet8bf& a){
+   BF16_TO_F32_UNARY_OP_WRAPPER(print<Packet4f>, a);
+ }
++#endif
+ template<> EIGEN_STRONG_INLINE Packet8bf pmadd(const Packet8bf& a, const Packet8bf& b, const Packet8bf& c) {
+   Packet4f a_even = Bf16ToF32Even(a);
+   Packet4f a_odd = Bf16ToF32Odd(a);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202406031512.453FCacv042809>