diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-03-07 17:57:54 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-03-07 17:57:54 +0000 |
commit | bc75b42f7650c33ffdb61e5e29b0b96cb9111932 (patch) | |
tree | 867908c0cf83e6015a5b1544cfdc4e17f1c13753 /dev-cpp/highway | |
parent | b3fef92e618039dc93153a93176184a49606c74a (diff) |
gentoo auto-resync : 07:03:2023 - 17:57:54
Diffstat (limited to 'dev-cpp/highway')
-rw-r--r-- | dev-cpp/highway/Manifest | 5 | ||||
-rw-r--r-- | dev-cpp/highway/files/0001-fix-compile-for-armv7-targets-with-vfp4-and-lower.patch | 123 | ||||
-rw-r--r-- | dev-cpp/highway/highway-1.0.1-r1.ebuild | 6 | ||||
-rw-r--r-- | dev-cpp/highway/highway-1.0.3.ebuild | 4 |
4 files changed, 135 insertions, 3 deletions
diff --git a/dev-cpp/highway/Manifest b/dev-cpp/highway/Manifest index 36f7e2c87a08..402230fb2e21 100644 --- a/dev-cpp/highway/Manifest +++ b/dev-cpp/highway/Manifest @@ -1,6 +1,7 @@ +AUX 0001-fix-compile-for-armv7-targets-with-vfp4-and-lower.patch 5987 BLAKE2B e6168befa010bbfe2cce3633c78c8d8c5005ecbe605a12c39e1004284f80d580c0c8a9a037638e414e57a989f63370b54a64db2de1c25a3188d0a3df4611687b SHA512 03f5d89ed1038f6eab451c11216ac75bfa7165a57b1f46a0b6fedb03620a355b30bd868d0da371e44d1ebe5f625e4e36777929de63762953e4e9fc0013c6f5bb DIST highway-1.0.1.tar.gz 1730746 BLAKE2B 1c6185af91afe32fbb35285d49101d381ade7ded262cbcd3b0a8bf28b1924a76ac5a11423a1613068f3435fbbdd2ab0119aa8a1aafe2c3467e0aff1987f40aad SHA512 35b6287579b6248966b0d36fda1522fd6338523934b079e94e857f9de08354f20b99739c99d53249a3a6c583519da0e0ac5e06dfbe6e3a89262f627c75b59dd8 DIST highway-1.0.3.tar.gz 1770704 BLAKE2B 5454f7e661270f25d1439a2a3d649a0f9970d7e10e0cfe6818c470b00460cc77b044ca83e912c91a3582b4a60af5d8d0f7c0aba01762acd3c98b9692fa0b20c6 SHA512 fc419c862e1686b6278081e8e10da41dc2bdfbd386a29b59e21a57375a47d3eeb5c7297e3078c78007b212121d936640b192a26a16c941e73cf599f24e081021 -EBUILD highway-1.0.1-r1.ebuild 911 BLAKE2B 394070e1f0c01816fd9e35078d22e5d15da24e111e14d594d8876300f72a82e352ab0c5e5e2583f57d2553ae57b99b41a4ef7d8d05a682417604540c7dc952bf SHA512 df57e02f5d608d133284144a0a0d7c9785b21741f649914254cf3cb8fa62e8694d06913a035504748bb78966c57b090ca14ea3e8c042a0f5e1170b3e568fb851 -EBUILD highway-1.0.3.ebuild 924 BLAKE2B 440bd36c2230450374e569f77a6d61904563a1768ce74715190139bf360756bcec4262cbc01e6dc90a57dbb70d8ded39c424ca3f62e01cd9f05023fdb4444259 SHA512 632555492ba533503e7c55c1fd932a1033f1bff95d116c3dbd82c5c0d6f5abae3bf26b5f94a1cd5055b96dbfd6bf7757f885b6ae29b1e131d016bf93c3057aa7 +EBUILD highway-1.0.1-r1.ebuild 1000 BLAKE2B 785d94ce1c5bda32873bae32c693eeb56672a1ae639dffbf8b6d609eb093f89adfb8ba262e7059bc64af8126ef80b6f80156ebd8386447377bfdca9023ed2a8c SHA512 3cfded30d2f7342f019bad820581629ae34edc1585f7e9442a164bfa122bcaa3f6a24d61d433c36f2bd199f1344efa1afbde3f7218b3d1ff0313c76b01c25136 +EBUILD highway-1.0.3.ebuild 1013 BLAKE2B b0926754b43676b61fa2bbae683668b5844d7572c14202d3cb1833f62b9e761d7be91bc731c849aa41ed4996736188f09d74d8cc4f858709a199fa027e4c384a SHA512 5b46e348b0d3a771782c7dc128824f3199c7acbb92085db939017e542565daf5901d75e063da9236dda07f4863eb59f99b93a8271c2cbcaec939e59a7c5b4bae EBUILD highway-9999.ebuild 918 BLAKE2B f6de6a0483355dfbc793c0fb1520cf8ca5eae7fceba7bff77c38979c18c0a82a07ea8505e972a62e7cbf0ae5abd39050f021524bc8c5680eef3b57ac3531a8d5 SHA512 a6ca4d498ff57290c34333c5553f9d80383f770103fd128cd5822046183d769deb4407f891918d0058152634bab09fa0dcd53f152ef9e8182a5cd3fd4aaa1ebe MISC metadata.xml 700 BLAKE2B 23fb803289745f094f19cb7dc6b296f56a3bf712b39f87ee563872496edb5798fe9f36ec1d8a9d9af52d26b589bca354bc58a3c039753156e09a154de27cb960 SHA512 b47da71c110bb91b523dd970a1ed8f4d40c1cc067c170d10ef0ad412850967682303e610c352d7c6425d7bad33d58f90a6d3a34a333a38e427c65a8341c3ec21 diff --git a/dev-cpp/highway/files/0001-fix-compile-for-armv7-targets-with-vfp4-and-lower.patch b/dev-cpp/highway/files/0001-fix-compile-for-armv7-targets-with-vfp4-and-lower.patch new file mode 100644 index 000000000000..ebf448cfbb24 --- /dev/null +++ b/dev-cpp/highway/files/0001-fix-compile-for-armv7-targets-with-vfp4-and-lower.patch @@ -0,0 +1,123 @@ +https://github.com/google/highway/commit/dc63f813c465f3bf95cb5b98f01aeed28b81173c +https://github.com/google/highway/pull/1143 + +https://github.com/google/highway/issues/834 +https://github.com/google/highway/issues/1032 + +https://bugs.gentoo.org/869077 + +From dc63f813c465f3bf95cb5b98f01aeed28b81173c Mon Sep 17 00:00:00 2001 +From: Julien Olivain <ju.o@free.fr> +Date: Mon, 20 Feb 2023 23:22:28 +0100 +Subject: [PATCH] Fix compilation for armv7 targets with vfp < v4 and gcc >= 8 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When using a armv7 gcc >= 8 toolchain (like [1]) with Highway +configured with -DHWY_CMAKE_ARM7=OFF and HWY_ENABLE_CONTRIB=ON, +compilation fails with error: + + In file included from /build/highway-1.0.3/hwy/ops/arm_neon-inl.h:33, + from /build/highway-1.0.3/hwy/highway.h:358, + from /build/highway-1.0.3/hwy/contrib/sort/shared-inl.h:104, + from /build/highway-1.0.3/hwy/contrib/sort/traits128-inl.h:27, + from /build/highway-1.0.3/hwy/contrib/sort/vqsort_128d.cc:23, + from /build/highway-1.0.3/hwy/foreach_target.h:81, + from /build/highway-1.0.3/hwy/contrib/sort/vqsort_128d.cc:20: + /toolchain/lib/gcc/arm-buildroot-linux-gnueabihf/12.2.0/include/arm_neon.h: In function ‘void hwy::N_NEON::StoreU(Vec128<long long unsigned int, 2>, Full128<long long unsigned int>, uint64_t*)’: + /toolchain/lib/gcc/arm-buildroot-linux-gnueabihf/12.2.0/include/arm_neon.h:11052:1: error: inlining failed in call to ‘always_inline’ ‘void vst1q_u64(uint64_t*, uint64x2_t)’: target specific option mismatch + 11052 | vst1q_u64 (uint64_t * __a, uint64x2_t __b) + | ^~~~~~~~~ + /build/highway-1.0.3/hwy/ops/arm_neon-inl.h:2786:12: note: called from here + 2786 | vst1q_u64(unaligned, v.raw); + | ~~~~~~~~~^~~~~~~~~~~~~~~~~~ + +The same errors happen when configured with HWY_ENABLE_EXAMPLES=ON, +or from client libraries like libjxl (at other places). + +The issue is that Highway Arm NEON ops have a dependency on the +Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. +The SIMD (Neon) v1 and VFPv3 instructions are not supported. + +There was several attempts to fix variants of this issues. +See #834 and #1032. + +HWY_NEON target is selected only if __ARM_NEON is defined. See: +https://github.com/google/highway/blob/1.0.3/hwy/detect_targets.h#L251 + +This test is not sufficient since __ARM_NEON will be predefined in +any cases when Neon is enabled (neon-vfpv3, neon-vfpv4). + +The issue is that HWY_CMAKE_ARM7=ON implies VFPv4 / NEON SIMD v2. +When setting HWY_CMAKE_ARM7=OFF, "neon-vfpv4" will not be forced, +but the code is still using intrinsics assuming VFPv4. Gcc will fail +with error because code cannot be generated for the selected +architecture. + +This issue can be avoided by adding "-DHWY_DISABLED_TARGETS=HWY_NEON" in +CXXFLAGS. The problem with this solution is that every client program will +also need to do the same. This goes against the very purpose of +"hwy/detect_targets.h". + +Technically, Armv7-a processors with VFPv4 can be detected using some +ACLE (Arm C Language Extensions [2]) predefined macros: + +Basically, we want Highway to define HWY_NEON only when the target +supports SIMDv2/VFPv4 or higher. An older target with vfpv3 only +(e.g. Cortex-A8, A9, ...) would NOT define HWY_NEON, and therefore +would fallback on HWY_SCALAR implementation. + +However, not all compiler completely support ACLE. There is also +several versions too. So we cannot easily rely on macros like +"__ARM_VFPV4__" (which clang predefine, but not gcc). + +The alternative solution proposed in this patch, is to declare the +HWY_NEON target architecture as broken, when we detect the target is +Armv7-A, but mandatory features for vfpv4 (namely half-float, FMA) +are missing. Half-floats are tested using the macro __ARM_NEON_FP, +and the FMA with the macro __ARM_FEATURE_FMA. See ACLE [2]. The +intent of declaring the target as broken, rather than selecting +HWY_NEON only if vfpv4 features are detected is to remain a bit +conservative, since the detection is slithly inaccurate. + +For a given compiler/cflags, predefined macros for Arm/ACLE can be +reviewed with commands like: + + arm-linux-gnueabihf-gcc -mcpu=cortex-a9 -mfpu=neon-vfpv3 -Wp,-dM -E -c - < /dev/null | grep -Fi arm | sort + arm-linux-gnueabihf-gcc -mcpu=cortex-a7 -mfpu=neon-vfpv4 -Wp,-dM -E -c - < /dev/null | grep -Fi arm | sort + clang -target armv7a -mcpu=cortex-a9 -mfpu=neon-vfpv3 -mfloat-abi=hard -Wp,-dM -E -c - < /dev/null | grep -Fi arm | sort + clang -target armv7a -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -Wp,-dM -E -c - < /dev/null | grep -Fi arm | sort + +The different values of __ARM_NEON_FP can be seen, depending which +"-mfpu" is passed. Same for __ARM_FEATURE_FMA. + +[1] https://toolchains.bootlin.com/downloads/releases/toolchains/armv7-eabihf/tarballs/armv7-eabihf--glibc--bleeding-edge-2022.08-1.tar.bz2 +[2] https://github.com/ARM-software/acle/ + +Signed-off-by: Julien Olivain <ju.o@free.fr> +--- + hwy/detect_targets.h | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/hwy/detect_targets.h b/hwy/detect_targets.h +index 2beca95b..40ae7fe7 100644 +--- a/hwy/detect_targets.h ++++ b/hwy/detect_targets.h +@@ -154,6 +154,16 @@ + (defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN)) + #define HWY_BROKEN_TARGETS (HWY_NEON) + ++// armv7-a without a detected vfpv4 is not supported ++// (for example Cortex-A8, Cortex-A9) ++// vfpv4 always have neon half-float _and_ FMA. ++#elif HWY_ARCH_ARM_V7 && \ ++ (__ARM_ARCH_PROFILE == 'A') && \ ++ !defined(__ARM_VFPV4__) && \ ++ !((__ARM_NEON_FP & 0x2 /* half-float */) && \ ++ (__ARM_FEATURE_FMA == 1)) ++#define HWY_BROKEN_TARGETS (HWY_NEON) ++ + // SVE[2] require recent clang or gcc versions. + #elif (HWY_COMPILER_CLANG && HWY_COMPILER_CLANG < 1100) || \ + (HWY_COMPILER_GCC_ACTUAL && HWY_COMPILER_GCC_ACTUAL < 1000) diff --git a/dev-cpp/highway/highway-1.0.1-r1.ebuild b/dev-cpp/highway/highway-1.0.1-r1.ebuild index e4a2c4b87d4b..b0a7900ce124 100644 --- a/dev-cpp/highway/highway-1.0.1-r1.ebuild +++ b/dev-cpp/highway/highway-1.0.1-r1.ebuild @@ -1,4 +1,4 @@ -# Copyright 2021-2022 Gentoo Authors +# Copyright 2021-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -24,6 +24,10 @@ DEPEND="test? ( dev-cpp/gtest[${MULTILIB_USEDEP}] )" RESTRICT="!test? ( test )" +PATCHES=( + "${FILESDIR}"/0001-fix-compile-for-armv7-targets-with-vfp4-and-lower.patch +) + multilib_src_configure() { local mycmakeargs=( -DHWY_CMAKE_ARM7=$(usex cpu_flags_arm_neon) diff --git a/dev-cpp/highway/highway-1.0.3.ebuild b/dev-cpp/highway/highway-1.0.3.ebuild index af752cf34a06..c4d4ed034ee9 100644 --- a/dev-cpp/highway/highway-1.0.3.ebuild +++ b/dev-cpp/highway/highway-1.0.3.ebuild @@ -24,6 +24,10 @@ DEPEND="test? ( dev-cpp/gtest[${MULTILIB_USEDEP}] )" RESTRICT="!test? ( test )" +PATCHES=( + "${FILESDIR}"/0001-fix-compile-for-armv7-targets-with-vfp4-and-lower.patch +) + multilib_src_configure() { local mycmakeargs=( -DHWY_CMAKE_ARM7=$(usex cpu_flags_arm_neon) |