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];