RWKV / rwkv.cpp

INT4/INT5/INT8 and FP16 inference on CPU for RWKV language model
MIT License
1.39k stars 90 forks source link

Illegal instruction (Intel N4200, Linux Ubuntu Jaunty) #43

Open radscience opened 1 year ago

radscience commented 1 year ago

...even after building with cmake -DRWKV_AVX=OFF -DRWKV_AVX2=OFF -DRWKV_AVX512=OFF -DRWKV_FMA=OFF -DBUILD_SHARED_LIBS=ON . cmake --build . --config Release

This is on an N4200 cpu (has SSE2, SSSE3, SSE4_1 & SSE4_2, but not FMA or AVXs) running ubuntu jaunty (in a singularity container).

(Issue unlikely to be due to singularity: https://github.com/apptainer/singularity/issues/5795)

radscience commented 1 year ago

gdb output from gdb ./bin.test_tiny

Program received signal SIGILL, Illegal instruction. 0x00007ffff7ef0b40 in rwkv_get_system_info_string () from /home/e2/compile/rwkv.cpp/librwkv.so

0 0x000055555557e100 in rwkv_get_system_info_string ()

(gdb) display /i $pc 1: x/i $pc => 0x55555557e100 <rwkv_get_system_info_string+8992>:
vmovdqu 0x10(%rax),%xmm0

Even after commenting out lines of rwkv_get_system_info_string () to force it to return 0's for AVXs.

radscience commented 1 year ago

Also, trying to use quantize.py, gdb gives:

Starting program: /usr/bin/python3.10 rwkv/quantize.py /llms/models/RWKV-4b-Pile-171M-20230202-7922.bin /llms/models/RWKV-4b-Pile-171M-20230202-7922.rwkv.cpp-171M-Q4_1_O.bin 4 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x8664-linux-gnu/libthreaddb.so.1".

Program received signal SIGILL, Illegal instruction. 0x00007ffff75fcb20 in ggml_init () from /home/e2/compile/rwkv.cpp/librwkv.so (gdb) display /i $pc 1: x/i $pc => 0x7ffff75fcb20 <ggml_init+400>: vpxor %xmm1,%xmm1,%xmm1 (gdb)

largefield-ohara commented 1 year ago

How about removing the -mf16c option from the build? There are a lot of them and you need to remove them all. In addition, it would be useful to have an entry in cmake to remove -mf16c.

radscience commented 1 year ago

Commenting out lines with "-mf16c" in CMakeLists.txt and ggml/src/CMakeLists.txt appears to have worked on a different machine which had the same issue. Still need to verify on the N4200 machine.