summaryrefslogtreecommitdiff
path: root/sci-ml
diff options
context:
space:
mode:
authorSystem user; portage <portage@alpha.trunkmasters.com>2026-09-18 22:30:12 -0500
committerSystem user; portage <portage@alpha.trunkmasters.com>2026-09-18 22:30:12 -0500
commita52646c8b7a0a8275dc8e30bafe7cdf2282997d8 (patch)
tree23f34dfdf1876f8310908289a7b698576d1b7d0d /sci-ml
parent67d13c501bceeb7226193eca1bd2e5ed08e7b024 (diff)
downloadbaldeagleos-repo-a52646c8b7a0a8275dc8e30bafe7cdf2282997d8.tar.gz
baldeagleos-repo-a52646c8b7a0a8275dc8e30bafe7cdf2282997d8.tar.xz
baldeagleos-repo-a52646c8b7a0a8275dc8e30bafe7cdf2282997d8.zip
fix(ggml): repair builds without F16C
Diffstat (limited to 'sci-ml')
-rw-r--r--sci-ml/ggml/files/ggml-0.24.0-const-fp16-loads.patch54
-rw-r--r--sci-ml/ggml/ggml-0.24.0.ebuild2
2 files changed, 56 insertions, 0 deletions
diff --git a/sci-ml/ggml/files/ggml-0.24.0-const-fp16-loads.patch b/sci-ml/ggml/files/ggml-0.24.0-const-fp16-loads.patch
new file mode 100644
index 000000000000..051d179aeb0c
--- /dev/null
+++ b/sci-ml/ggml/files/ggml-0.24.0-const-fp16-loads.patch
@@ -0,0 +1,54 @@
+Fix x86 FP16 fallback loads when F16C is disabled.
+
+These helpers only read their inputs, including const quantized block data.
+Accept const pointers in both AVX and AVX512 fallback implementations.
+Give the repack-local eight-value loader a distinct name to avoid colliding
+with the const overload already defined by simd-mappings.h for AVX.
+
+--- a/src/ggml-cpu/arch/x86/repack.cpp
++++ b/src/ggml-cpu/arch/x86/repack.cpp
+@@ -36,7 +36,7 @@
+ #define GGML_F32Cx8_REARRANGE_LOAD(x, arrangeMask) _mm256_cvtph_ps(_mm_shuffle_epi8(_mm_loadu_si128((const __m128i *) x), arrangeMask))
+ #else
+ #if defined(__AVX512F__)
+-static inline __m512 __avx512_f32cx8x2_load(ggml_fp16_t *x, ggml_fp16_t *y) {
++static inline __m512 __avx512_f32cx8x2_load(const ggml_fp16_t *x, const ggml_fp16_t *y) {
+ float tmp[16];
+
+ for (int i = 0; i < 8; i++) {
+@@ -64,7 +64,7 @@
+ return _mm512_loadu_ps(tmp);
+ }
+ #endif
+-static inline __m256 __avx_f32cx8_load(ggml_fp16_t *x) {
++static inline __m256 __avx_repack_f32cx8_load(const ggml_fp16_t *x) {
+ float tmp[8];
+
+ for (int i = 0; i < 8; i++) {
+@@ -73,7 +73,7 @@
+
+ return _mm256_loadu_ps(tmp);
+ }
+-static inline __m256 __avx_repeat_f32cx8_load(ggml_fp16_t *x) {
++static inline __m256 __avx_repeat_f32cx8_load(const ggml_fp16_t *x) {
+ float tmp[8];
+
+ for (int i = 0; i < 4; i++) {
+@@ -83,7 +83,7 @@
+
+ return _mm256_loadu_ps(tmp);
+ }
+-static inline __m256 __avx_rearranged_f32cx8_load(ggml_fp16_t *x, __m128i arrangeMask) {
++static inline __m256 __avx_rearranged_f32cx8_load(const ggml_fp16_t *x, __m128i arrangeMask) {
+ uint16_t tmphalf[8];
+ float tmp[8];
+
+@@ -95,7 +95,7 @@
+ return _mm256_loadu_ps(tmp);
+ }
+
+-#define GGML_F32Cx8_LOAD(x) __avx_f32cx8_load(x)
++#define GGML_F32Cx8_LOAD(x) __avx_repack_f32cx8_load(x)
+ #define GGML_F32Cx8_REPEAT_LOAD(x, loadMask) __avx_repeat_f32cx8_load(x)
+ #define GGML_F32Cx8_REARRANGE_LOAD(x, arrangeMask) __avx_rearranged_f32cx8_load(x, arrangeMask)
+ #if defined(__AVX512F__)
diff --git a/sci-ml/ggml/ggml-0.24.0.ebuild b/sci-ml/ggml/ggml-0.24.0.ebuild
index 6ca110bcc73b..e4e4ef5d1ca9 100644
--- a/sci-ml/ggml/ggml-0.24.0.ebuild
+++ b/sci-ml/ggml/ggml-0.24.0.ebuild
@@ -56,6 +56,8 @@ DEPEND="${RDEPEND}
"
BDEPEND="vulkan? ( media-libs/shaderc )"
+PATCHES=( "${FILESDIR}/${P}-const-fp16-loads.patch" )
+
pkg_pretend() {
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
}