commit:     895559126b0565a22a085dccf087fa3b4bb2ad61
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 26 23:36:27 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 26 23:36:27 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=89555912

media-gfx/krita: fix build w/ -march=znver4 & USE=xsimd

Closes: https://bugs.gentoo.org/936296
Thanks-to: Dmitry Kazakov <dimula73 <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../krita/files/krita-5.2.3-znver4-xsimd.patch     | 38 ++++++++++++++++++++++
 media-gfx/krita/krita-5.2.3.ebuild                 |  1 +
 2 files changed, 39 insertions(+)

diff --git a/media-gfx/krita/files/krita-5.2.3-znver4-xsimd.patch 
b/media-gfx/krita/files/krita-5.2.3-znver4-xsimd.patch
new file mode 100644
index 000000000000..df5fffb41d47
--- /dev/null
+++ b/media-gfx/krita/files/krita-5.2.3-znver4-xsimd.patch
@@ -0,0 +1,38 @@
+https://bugs.gentoo.org/936296
+https://invent.kde.org/graphics/krita/-/commit/cf2c74220b7edfae53a0715346cb4e2c7dfc38ae
+
+From cf2c74220b7edfae53a0715346cb4e2c7dfc38ae Mon Sep 17 00:00:00 2001
+From: Dmitry Kazakov <[email protected]>
+Date: Mon, 26 Aug 2024 14:38:03 +0200
+Subject: [PATCH] Don't use xsimd::default_arch in the pixel scaler code
+
+Gentoo seems to build Krita with a global -march=znver4 flag,
+which causes "scalar" version of the code to be compiled with
+AVX512. Even though it is not how the system is supposed to work
+(and this avx512-optimization will never be used in real runtime),
+we shouldn't fail compilation.
+
+https://bugs.gentoo.org/936296
+https://github.com/xtensor-stack/xsimd/issues/1044
+--- a/libs/pigment/KoOptimizedPixelDataScalerU8ToU16.h
++++ b/libs/pigment/KoOptimizedPixelDataScalerU8ToU16.h
+@@ -28,7 +28,7 @@ public:
+         const int numColorChannels = m_channelsPerPixel * numColumns;
+ 
+ #if defined(HAVE_XSIMD) && XSIMD_WITH_AVX2
+-        using uint16_avx_v = xsimd::batch<uint16_t, xsimd::default_arch>;
++        using uint16_avx_v = xsimd::batch<uint16_t, xsimd::avx2>;
+         using uint16_v = xsimd::batch<uint16_t, xsimd::sse4_1>;
+         using uint8_v = xsimd::batch<uint8_t, xsimd::sse4_1>;
+ 
+@@ -129,7 +129,7 @@ public:
+         const int numColorChannels = m_channelsPerPixel * numColumns;
+ 
+ #if defined(HAVE_XSIMD) && XSIMD_WITH_AVX2
+-        using uint16_avx_v = xsimd::batch<uint16_t, xsimd::default_arch>;
++        using uint16_avx_v = xsimd::batch<uint16_t, xsimd::avx2>;
+         using uint16_v = xsimd::batch<uint16_t, xsimd::sse4_1>;
+ 
+         const int channelsPerAvx2Block = 32;
+-- 
+GitLab

diff --git a/media-gfx/krita/krita-5.2.3.ebuild 
b/media-gfx/krita/krita-5.2.3.ebuild
index c95734e0ad9a..e6485a056c75 100644
--- a/media-gfx/krita/krita-5.2.3.ebuild
+++ b/media-gfx/krita/krita-5.2.3.ebuild
@@ -98,6 +98,7 @@ PATCHES=(
        "${FILESDIR}"/${PN}-5.2.2-fftw.patch # bug 913518
        # git master
        "${FILESDIR}"/${PN}-5.1.5-sip-6.8.patch # bug 919139
+       "${FILESDIR}"/${PN}-5.2.3-znver4-xsimd.patch # bug 936296
 )
 
 pkg_setup() {

Reply via email to