summaryrefslogtreecommitdiff
path: root/app-accessibility/whisper-cpp/files/whisper-cpp-1.9.4-const-fp16-loads.patch
blob: 735a588c510d66ab66cbe6b3020a6d96fe16a64f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Subject: [PATCH] ggml: make x86 FP16 fallback loads const-correct

The AVX fallback used when F16C is disabled only reads the input.
Accept const inputs from quantized blocks, matching the intrinsic path.
The plain eight-value load already has a const overload in simd-mappings.h.

--- a/ggml/src/ggml-cpu/arch/x86/repack.cpp
+++ b/ggml/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++) {
@@ -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];