public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ionen Wolkens" <ionen@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-qt/qtmultimedia/files/, dev-qt/qtmultimedia/
Date: Sat, 16 Nov 2024 21:47:42 +0000 (UTC)	[thread overview]
Message-ID: <1731793570.1abba40bcfa175649b835cc9fab7a4be21e1cad8.ionen@gentoo> (raw)

commit:     1abba40bcfa175649b835cc9fab7a4be21e1cad8
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 16 21:30:04 2024 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Sat Nov 16 21:46:10 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1abba40b

dev-qt/qtmultimedia: fix eigen vectorization build fail on ppc+ppc64

Not an ideal "fix" for ppc32, but rather go for a simple workaround
if it's 32bit arches (esp. ppc32) and it's non-invasive to keep.

Still not quite sure why ppc32 surfaced as an issue now except maybe
different gcc? The bit about Qt passing -maltivec been there since
Qt 6.4 (long before we keyworded+stabilized it for ppc) unless I'm
overlooking something. And then (for the ppc64 issue) dev-cpp/eigen
only received the vsx patch somewhat recently, albeit that one is
due to some more specific hardware so it makes more sense.

Closes: https://bugs.gentoo.org/943402
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 .../qtmultimedia-6.7.3-eigen-ppc-no-vsx.patch      | 152 +++++++++++++++++++++
 dev-qt/qtmultimedia/qtmultimedia-6.7.3.ebuild      |   7 +
 dev-qt/qtmultimedia/qtmultimedia-6.8.0.ebuild      |   7 +
 dev-qt/qtmultimedia/qtmultimedia-6.8.9999.ebuild   |   7 +
 dev-qt/qtmultimedia/qtmultimedia-6.9999.ebuild     |   7 +
 5 files changed, 180 insertions(+)

diff --git a/dev-qt/qtmultimedia/files/qtmultimedia-6.7.3-eigen-ppc-no-vsx.patch b/dev-qt/qtmultimedia/files/qtmultimedia-6.7.3-eigen-ppc-no-vsx.patch
new file mode 100644
index 000000000000..d7b2351134e2
--- /dev/null
+++ b/dev-qt/qtmultimedia/files/qtmultimedia-6.7.3-eigen-ppc-no-vsx.patch
@@ -0,0 +1,152 @@
+Imported from dev-cpp/eigen to use with bundled's (ideally would
+unbundle but rather not w/ Qt unless there is an upstream-supported
+cmake switch, is likely broken w/ the upcoming eigen version too).
+
+This is a backport from eigen upstream, so should no longer be needed
+whenever there is a bump (not in a release as of the writing of this)
+and it is updated here.
+
+https://bugs.gentoo.org/943402
+https://bugs.gentoo.org/936107
+https://gitlab.com/libeigen/eigen/-/merge_requests/1028
+--- a/src/3rdparty/eigen/Eigen/Core
++++ b/src/3rdparty/eigen/Eigen/Core
+@@ -348,3 +348,3 @@
+ 
+-#if defined(EIGEN_VECTORIZE_ALTIVEC) || defined(EIGEN_VECTORIZE_VSX)
++#if defined(EIGEN_VECTORIZE_VSX)
+   #include "src/Core/arch/AltiVec/MatrixProduct.h"
+--- a/src/3rdparty/eigen/Eigen/src/Core/arch/AltiVec/Complex.h
++++ b/src/3rdparty/eigen/Eigen/src/Core/arch/AltiVec/Complex.h
+@@ -102,2 +102,3 @@
+     HasMax    = 0,
++    HasSqrt   = 1,
+ #ifdef __VSX__
+@@ -322,2 +323,3 @@
+     HasMax    = 0,
++    HasSqrt   = 1,
+     HasSetLinear = 0
+--- a/src/3rdparty/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h
++++ b/src/3rdparty/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h
+@@ -42,2 +42,3 @@
+ 
++#ifdef __VSX__
+ #ifndef EIGEN_COMP_CLANG
+@@ -48,6 +49,3 @@
+ }
+-#endif
+ 
+-#ifdef __VSX__
+-#ifndef EIGEN_COMP_CLANG
+ template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
+@@ -76,2 +74,22 @@
+ }
++
++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
+--- a/src/3rdparty/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h
++++ b/src/3rdparty/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h
+@@ -177,2 +177,5 @@
+ #endif
++    HasTanh = EIGEN_FAST_MATH,
++    HasErf = EIGEN_FAST_MATH,
++    HasRint = 1,
+ #else
+@@ -180,4 +183,5 @@
+     HasRsqrt = 0,
+-    HasTanh = EIGEN_FAST_MATH,
+-    HasErf = EIGEN_FAST_MATH,
++    HasTanh = 0,
++    HasErf = 0,
++    HasRint = 0,
+ #endif
+@@ -186,3 +190,2 @@
+     HasCeil = 1,
+-    HasRint = 1,
+     HasNegate = 1,
+@@ -219,2 +222,3 @@
+ #endif
++    HasRint = 1,
+ #else
+@@ -222,5 +226,6 @@
+     HasRsqrt = 0,
+-    HasTanh = EIGEN_FAST_MATH,
+-    HasErf = EIGEN_FAST_MATH,
++    HasRint = 0,
+ #endif
++    HasTanh = 0,
++    HasErf = 0,
+     HasRound = 1,
+@@ -228,3 +233,2 @@
+     HasCeil = 1,
+-    HasRint = 1,
+     HasNegate = 1,
+@@ -874,15 +878,25 @@
+ 
++#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)); }
+@@ -939,2 +953,3 @@
+ 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)
+@@ -949,2 +964,3 @@
+ }
++#endif
+ 
+@@ -1343,8 +1359,2 @@
+ 
+-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){
+@@ -1392,2 +1402,3 @@
+ }
++#ifdef __VSX__
+ template<> EIGEN_STRONG_INLINE Packet8bf print<Packet8bf> (const Packet8bf& a){
+@@ -1395,2 +1406,3 @@
+ }
++#endif
+ template<> EIGEN_STRONG_INLINE Packet8bf pmadd(const Packet8bf& a, const Packet8bf& b, const Packet8bf& c) {

diff --git a/dev-qt/qtmultimedia/qtmultimedia-6.7.3.ebuild b/dev-qt/qtmultimedia/qtmultimedia-6.7.3.ebuild
index 5551e4ef4321..4c90076675b9 100644
--- a/dev-qt/qtmultimedia/qtmultimedia-6.7.3.ebuild
+++ b/dev-qt/qtmultimedia/qtmultimedia-6.7.3.ebuild
@@ -83,7 +83,14 @@ CMAKE_SKIP_TESTS=(
 	tst_qwindowcapturebackend
 )
 
+PATCHES=(
+	"${FILESDIR}"/${PN}-6.7.3-eigen-ppc-no-vsx.patch
+)
+
 src_configure() {
+	# eigen + ppc32 seems broken w/ -maltivec (forced by Qt, bug #943402)
+	use ppc && append-cppflags -DEIGEN_DONT_VECTORIZE
+
 	# normally passed by the build system, but needed for 32-on-64 chroots
 	use x86 && append-cppflags -DPFFFT_SIMD_DISABLE
 

diff --git a/dev-qt/qtmultimedia/qtmultimedia-6.8.0.ebuild b/dev-qt/qtmultimedia/qtmultimedia-6.8.0.ebuild
index 90448d9168fe..36775e529d95 100644
--- a/dev-qt/qtmultimedia/qtmultimedia-6.8.0.ebuild
+++ b/dev-qt/qtmultimedia/qtmultimedia-6.8.0.ebuild
@@ -90,7 +90,14 @@ CMAKE_SKIP_TESTS=(
 	tst_qwindowcapturebackend
 )
 
+PATCHES=(
+	"${FILESDIR}"/${PN}-6.7.3-eigen-ppc-no-vsx.patch
+)
+
 src_configure() {
+	# eigen + ppc32 seems broken w/ -maltivec (forced by Qt, bug #943402)
+	use ppc && append-cppflags -DEIGEN_DONT_VECTORIZE
+
 	# normally passed by the build system, but needed for 32-on-64 chroots
 	use x86 && append-cppflags -DDISABLE_SIMD -DPFFFT_SIMD_DISABLE
 

diff --git a/dev-qt/qtmultimedia/qtmultimedia-6.8.9999.ebuild b/dev-qt/qtmultimedia/qtmultimedia-6.8.9999.ebuild
index 2b44b871eb93..dccb2e3e1506 100644
--- a/dev-qt/qtmultimedia/qtmultimedia-6.8.9999.ebuild
+++ b/dev-qt/qtmultimedia/qtmultimedia-6.8.9999.ebuild
@@ -90,7 +90,14 @@ CMAKE_SKIP_TESTS=(
 	tst_qwindowcapturebackend
 )
 
+PATCHES=(
+	"${FILESDIR}"/${PN}-6.7.3-eigen-ppc-no-vsx.patch
+)
+
 src_configure() {
+	# eigen + ppc32 seems broken w/ -maltivec (forced by Qt, bug #943402)
+	use ppc && append-cppflags -DEIGEN_DONT_VECTORIZE
+
 	# normally passed by the build system, but needed for 32-on-64 chroots
 	use x86 && append-cppflags -DDISABLE_SIMD -DPFFFT_SIMD_DISABLE
 

diff --git a/dev-qt/qtmultimedia/qtmultimedia-6.9999.ebuild b/dev-qt/qtmultimedia/qtmultimedia-6.9999.ebuild
index 2b44b871eb93..dccb2e3e1506 100644
--- a/dev-qt/qtmultimedia/qtmultimedia-6.9999.ebuild
+++ b/dev-qt/qtmultimedia/qtmultimedia-6.9999.ebuild
@@ -90,7 +90,14 @@ CMAKE_SKIP_TESTS=(
 	tst_qwindowcapturebackend
 )
 
+PATCHES=(
+	"${FILESDIR}"/${PN}-6.7.3-eigen-ppc-no-vsx.patch
+)
+
 src_configure() {
+	# eigen + ppc32 seems broken w/ -maltivec (forced by Qt, bug #943402)
+	use ppc && append-cppflags -DEIGEN_DONT_VECTORIZE
+
 	# normally passed by the build system, but needed for 32-on-64 chroots
 	use x86 && append-cppflags -DDISABLE_SIMD -DPFFFT_SIMD_DISABLE
 


             reply	other threads:[~2024-11-16 21:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-16 21:47 Ionen Wolkens [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-01-06 22:51 [gentoo-commits] repo/gentoo:master commit in: dev-qt/qtmultimedia/files/, dev-qt/qtmultimedia/ Ionen Wolkens
2025-01-06 12:02 Ionen Wolkens
2024-09-12  3:16 Ionen Wolkens
2024-07-28 13:50 Ionen Wolkens
2024-07-24  2:20 Ionen Wolkens
2016-01-21 17:40 Davide Pesavento

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1731793570.1abba40bcfa175649b835cc9fab7a4be21e1cad8.ionen@gentoo \
    --to=ionen@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox