Skip to content

Compile bug: Failed to retrive the correct cpu flag on arm64 #16237

@lizhenneng

Description

@lizhenneng

Git commit

63b54c8

Operating systems

Linux

GGML backends

CPU

Problem description & steps to reproduce

When using GCC 9 and GCC 12 on the arm64 platform of ubuntu 2004, the command "gcc -mcpu=native -E -v -" fails to detect the correct CPU flags, which results in compilation failures for certain extended instructions."

First Bad Commit

No response

Compile command

cmake ../ -DGGML_NATIVE=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DLLAMA_CURL=OFF
make

Relevant log output

cd /home/kylin/llama.cpp/build/ggml/src && /usr/bin/c++ -DGGML_BACKEND_BUILD -DGGML_BACKEND_SHARED -DGGML_SCHED_MAX_COPIES=4 -DGGML_SHARED -DGGML_USE_CPU_REPACK -DGGML_USE_LLAMAFILE -DGGML_USE_OPENMP -D_GNU_SOURCE -D_XOPEN_SOURCE=600 -Dggml_cpu_EXPORTS -I/home/kylin/llama.cpp/ggml/src/.. -I/home/kylin/llama.cpp/ggml/src/. -I/home/kylin/llama.cpp/ggml/src/ggml-cpu -I/home/kylin/llama.cpp/ggml/src/../include -O3 -DNDEBUG -std=gnu++17 -fPIC -Wmissing-declarations -Wmissing-noreturn -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wno-array-bounds -Wextra-semi -mcpu=native -fopenmp -MD -MT ggml/src/CMakeFiles/ggml-cpu.dir/ggml-cpu/arch/arm/repack.cpp.o -MF CMakeFiles/ggml-cpu.dir/ggml-cpu/arch/arm/repack.cpp.o.d -o CMakeFiles/ggml-cpu.dir/ggml-cpu/arch/arm/repack.cpp.o -c /home/kylin/llama.cpp/ggml/src/ggml-cpu/arch/arm/repack.cpp
In file included from /home/kylin/llama.cpp/ggml/src/./ggml-impl.h:24,
                 from /home/kylin/llama.cpp/ggml/src/ggml-cpu/arch/arm/quants.c:4:
/usr/lib/gcc/aarch64-linux-gnu/12/include/arm_neon.h: In function ‘ggml_vec_dot_q4_0_q8_0’:
/usr/lib/gcc/aarch64-linux-gnu/12/include/arm_neon.h:29527:1: error: inlining failed in call to ‘always_inline’ ‘vdotq_s32’: target specific option mismatch
29527 | vdotq_s32 (int32x4_t __r, int8x16_t __a, int8x16_t __b)
      | ^~~~~~~~~
In file included from /home/kylin/llama.cpp/ggml/src/ggml-cpu/simd-mappings.h:3,
                 from /home/kylin/llama.cpp/ggml/src/ggml-cpu/arch/arm/quants.c:6:
/home/kylin/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-impl.h:315:33: note: called from here
  315 | #define ggml_vdotq_s32(a, b, c) vdotq_s32(a, b, c)
      |                                 ^~~~~~~~~~~~~~~~~~
/home/kylin/llama.cpp/ggml/src/ggml-cpu/arch/arm/quants.c:406:31: note: in expansion of macro ‘ggml_vdotq_s32’
  406 |         const int32x4_t p_1 = ggml_vdotq_s32(ggml_vdotq_s32(vdupq_n_s32(0), v0_1ls, v1_1l), v0_1hs, v1_1h);
      |                               ^~~~~~~~~~~~~~
/usr/lib/gcc/aarch64-linux-gnu/12/include/arm_neon.h:29527:1: error: inlining failed in call to ‘always_inline’ ‘vdotq_s32’: target specific option mismatch
29527 | vdotq_s32 (int32x4_t __r, int8x16_t __a, int8x16_t __b)
      | ^~~~~~~~~
/home/kylin/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-impl.h:315:33: note: called from here
  315 | #define ggml_vdotq_s32(a, b, c) vdotq_s32(a, b, c)
      |                                 ^~~~~~~~~~~~~~~~~~
/home/kylin/llama.cpp/ggml/src/ggml-cpu/arch/arm/quants.c:406:31: note: in expansion of macro ‘ggml_vdotq_s32’
  406 |         const int32x4_t p_1 = ggml_vdotq_s32(ggml_vdotq_s32(vdupq_n_s32(0), v0_1ls, v1_1l), v0_1hs, v1_1h);
      |                               ^~~~~~~~~~~~~~
/usr/lib/gcc/aarch64-linux-gnu/12/include/arm_neon.h:29527:1: error: inlining failed in call to ‘always_inline’ ‘vdotq_s32’: target specific option mismatch
29527 | vdotq_s32 (int32x4_t __r, int8x16_t __a, int8x16_t __b)
      | ^~~~~~~~~
/home/kylin/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-impl.h:315:33: note: called from here
  315 | #define ggml_vdotq_s32(a, b, c) vdotq_s32(a, b, c)
      |                                 ^~~~~~~~~~~~~~~~~~
/home/kylin/llama.cpp/ggml/src/ggml-cpu/arch/arm/quants.c:405:31: note: in expansion of macro ‘ggml_vdotq_s32’
  405 |         const int32x4_t p_0 = ggml_vdotq_s32(ggml_vdotq_s32(vdupq_n_s32(0), v0_0ls, v1_0l), v0_0hs, v1_0h);
      |                               ^~~~~~~~~~~~~~
/usr/lib/gcc/aarch64-linux-gnu/12/include/arm_neon.h:29527:1: error: inlining failed in call to ‘always_inline’ ‘vdotq_s32’: target specific option mismatch
29527 | vdotq_s32 (int32x4_t __r, int8x16_t __a, int8x16_t __b)
      | ^~~~~~~~~
/home/kylin/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-impl.h:315:33: note: called from here
  315 | #define ggml_vdotq_s32(a, b, c) vdotq_s32(a, b, c)
      |                                 ^~~~~~~~~~~~~~~~~~
/home/kylin/llama.cpp/ggml/src/ggml-cpu/arch/arm/quants.c:405:31: note: in expansion of macro ‘ggml_vdotq_s32’
  405 |         const int32x4_t p_0 = ggml_vdotq_s32(ggml_vdotq_s32(vdupq_n_s32(0), v0_0ls, v1_0l), v0_0hs, v1_0h);
      |                               ^~~~~~~~~~~~~~
/usr/lib/gcc/aarch64-linux-gnu/12/include/arm_neon.h:29527:1: error: inlining failed in call to ‘always_inline’ ‘vdotq_s32’: target specific option mismatch
29527 | vdotq_s32 (int32x4_t __r, int8x16_t __a, int8x16_t __b)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions