You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Build Issue: Compilation Errors with AVX2 Intrinsics and Const Correctness
Problem Summary
Compilation fails due to invalid conversion from const ggml_fp16_t* to ggml_fp16_t* in ARM64 SIMD functions, missing AVX2/FMA compiler flags for x86_64 targets, and missing intrinsic headers for SIMD operations.
Detailed Errors & Solutions
1. Const Correctness in AARCH64 SIMD Functions
Error Message: error: invalid conversion from 'const ggml_fp16_t*' to 'ggml_fp16_t*'
2. Missing AVX2/FMA Compiler Flags
Error Message: error: inlining failed: target specific option mismatch
note: compiler does not support '-mavx2' or '-mfma'
Affected File: llama.cpp/CMakeLists.txt
Problem: AVX2/FMA flags not enabled for x86_64 targets
Git commit
Build Issue: Compilation Errors with AVX2 Intrinsics and Const Correctness
Problem Summary
Compilation fails due to invalid conversion from const ggml_fp16_t* to ggml_fp16_t* in ARM64 SIMD functions, missing AVX2/FMA compiler flags for x86_64 targets, and missing intrinsic headers for SIMD operations.
Detailed Errors & Solutions
1. Const Correctness in AARCH64 SIMD Functions
Error Message: error: invalid conversion from 'const ggml_fp16_t*' to 'ggml_fp16_t*'
Affected Files: llama.cpp/ggml/src/ggml-cpu/ggml-cpu-aarch64.cpp
Problem Locations: Original problematic signatures:
static inline __m256 __avx_f32cx8_load(ggml_fp16_t *x)
static inline __m256 __avx_repeat_f32cx8_load(ggml_fp16_t *x)
static inline __m256 __avx_rearranged_f32cx8_load(ggml_fp16_t *x, __m128i arrangeMask)
Solution: Add const qualifier to pointer parameters:
static inline __m256 __avx_f32cx8_load(const ggml_fp16_t *x)
static inline __m256 __avx_repeat_f32cx8_load(const ggml_fp16_t *x)
static inline __m256 __avx_rearranged_f32cx8_load(const ggml_fp16_t *x, __m128i arrangeMask)
2. Missing AVX2/FMA Compiler Flags
Error Message: error: inlining failed: target specific option mismatch
note: compiler does not support '-mavx2' or '-mfma'
Affected File: llama.cpp/CMakeLists.txt
Problem: AVX2/FMA flags not enabled for x86_64 targets
Solution: Add conditional compilation flags after project() declaration:
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
add_compile_options(-mfma -mavx2)
endif()
3. Missing Intrinsic Headers
Error Message: error: use of undeclared identifier '_mm256_setzero_ps'
error: unknown type name '__m256'
Affected File: llama.cpp/ggml/src/ggml.c
Solution: Add Intel intrinsic header inclusion at file beginning, after existing includes:
#include <immintrin.h>
Expected Outcome
Notes
the node code below apply the solution
Operating systems
Linux
GGML backends
CPU
Problem description & steps to reproduce
build issue on ubuntu sever/desktop using virtual box CPU
First Bad Commit
No response
Compile command
Relevant log output
The text was updated successfully, but these errors were encountered: