incompatible types when initializing type ‘__m256i {aka __vector(4) long long int}’
Prerequisites
Please answer the following questions for yourself before submitting an issue.
- [ x] I am running the latest code. Development is very rapid so there are no tagged versions as of now.
- [ x] I carefully followed the README.md.
- [ x] I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
- [ x] I reviewed the Discussions, and have a new bug or useful enhancement to share.
Expected Behavior
successful compilation of llama.cpp
Current Behavior
sh-4.2$ make I llama.cpp build info: I UNAME_S: Linux I UNAME_P: x86_64 I UNAME_M: x86_64 I CFLAGS: -I. -O3 -std=c11 -fPIC -DNDEBUG -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith -pthread -march=native -mtune=native I CXXFLAGS: -I. -I./examples -O3 -std=c++11 -fPIC -DNDEBUG -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wno-multichar -pthread -march=native -mtune=native I LDFLAGS: I CC: cc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-15) I CXX: g++ (GCC) 7.3.1 20180712 (Red Hat 7.3.1-15)
cc -I. -O3 -std=c11 -fPIC -DNDEBUG -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith -pthread -march=native -mtune=native -c ggml.c -o ggml.o ggml.c: In function ‘ggml_vec_dot_q4_2_q8_0’: ggml.c:3069:40: warning: implicit declaration of function ‘_mm256_set_m128’; did you mean ‘_mm256_set_epi8’? [-Wimplicit-function-declaration] const __m256 d = _mm256_mul_ps(_mm256_set_m128(d1, d0), _mm256_broadcast_ss(&y[i].d)); ^~~~~~~~~~~~~~~ _mm256_set_epi8 ggml.c:3069:40: error: incompatible type for argument 1 of ‘_mm256_mul_ps’ In file included from /usr/lib/gcc/x86_64-redhat-linux/7/include/immintrin.h:41:0, from ggml.c:183: /usr/lib/gcc/x86_64-redhat-linux/7/include/avxintrin.h:317:1: note: expected ‘__m256 {aka __vector(8) float}’ but argument is of type ‘int’ _mm256_mul_ps (__m256 __A, __m256 __B) ^~~~~~~~~~~~~ ggml.c:3073:22: warning: implicit declaration of function ‘_mm256_set_m128i’; did you mean ‘_mm256_set_epi8’? [-Wimplicit-function-declaration] __m256i bx = _mm256_set_m128i(bx1, bx0); ^~~~~~~~~~~~~~~~ _mm256_set_epi8 ggml.c:3073:22: error: incompatible types when initializing type ‘__m256i {aka __vector(4) long long int}’ using type ‘int’ make: *** [ggml.o] Error 1
Environment and Context
AWS linux 2, ml.g5.48xlarge
- Physical (or virtual) hardware you are using, e.g. for Linux:
Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 192 On-line CPU(s) list: 0-191 Thread(s) per core: 2 Core(s) per socket: 48
- Operating System, e.g. for Linux:
amazon linux 2
- SDK version, e.g. for Linux:
python3.9
GNU Make 3.82
Built for x86_64-koji-linux-gnu
g++ (GCC) 7.3.1 20180712 (Red Hat 7.3.1-15)
Failure Information (for bugs)
ggml.c:3073:22: error: incompatible types when initializing type ‘__m256i {aka __vector(4) long long int}’ using type ‘int’
This is probably because your version of gcc is too old, updating it should fix it.
@navinshahse On my system I had both gcc-7 and gcc-8 (and g++-7 g++-8) installed. ADding CXX=g++-8 and CC=gcc-8 to the Makefile fixed the issue. The only problem is then removing it before git pull and adding it again ;)
Hi I am facing a similar issue:
here is the error even after adding CXX and CC to the Makefile.
[ 3%] Generating build details from Git -- Found Git: /usr/bin/git (found version "2.17.1") [ 3%] Built target BUILD_INFO [ 6%] Building C object CMakeFiles/ggml.dir/ggml.c.o /proj/llama.cpp/ggml.c: In function ‘bytes_from_nibbles_32’: /proj/llama.cpp/ggml.c:534:27: warning: implicit declaration of function ‘_mm256_set_m128i’; did you mean ‘_mm256_set_epi8’? [-Wimplicit-function-declaration] const __m256i bytes = _mm256_set_m128i(_mm_srli_epi16(tmp, 4), tmp); ^~~~~~~~~~~~~~~~ _mm256_set_epi8 /proj/llama.cpp/ggml.c:534:27: error: incompatible types when initializing type ‘__m256i {aka const __vector(4) long long int}’ using type ‘int’ CMakeFiles/ggml.dir/build.make:75: recipe for target 'CMakeFiles/ggml.dir/ggml.c.o' failed gmake[2]: *** [CMakeFiles/ggml.dir/ggml.c.o] Error 1 CMakeFiles/Makefile2:359: recipe for target 'CMakeFiles/ggml.dir/all' failed gmake[1]: *** [CMakeFiles/ggml.dir/all] Error 2 Makefile:102: recipe for target 'all' failed gmake: *** [all] Error 2
I was able to get this working on Amazon Linux by:
sudo mv /usr/bin/g++ /usr/bin/g++_old
sudo mv /usr/bin/gcc /usr/bin/gcc_old
sudo ln -s /usr/bin/gcc10-cc /usr/bin/gcc
sudo ln -s /usr/bin/gcc10-c++ /usr/bin/g++
The same problem here, solved replacing the gcc-7 with gcc-8.