Skip to content

Compile bug: RISC-V: vector still be enabled even if GGML_RVV=OFF #16593

@Sakura286

Description

@Sakura286

Git commit

5acd455

Operating systems

Linux

GGML backends

HIP

Problem description & steps to reproduce

Compiler: Clang 20.0.0git
OS: Debian Trixie

I am using llvm-project from AMD ROCm Org to build llama.cpp on a riscv64 machine which does not support RISC-V vector extension.

The code mentioned by the log are guarded by __riscv_v_intrinsic definition. But __riscv_v_intrinsic should not be used to test if compilation host support RVV since llvm 20.1.0-rc1.

Is it better to use __riscv_vector to guard these code?

First Bad Commit

1cf123a

Compile command

HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \
cmake -S . -B build \
-DCMAKE_C_COMPILER=/opt/rocm-7.0.0/bin/clang -DCMAKE_CXX_COMPILER=/opt/rocm-7.0.0/bin/clang++ \
-DGGML_HIP=ON -DAMDGPU_TARGETS=gfx1100 \
-DCMAKE_VERBOSE_MAKEFILE=TRUE \
-DGGML_RVV=OFF -DGGML_RV_ZFH=OFF -DGGML_RV_ZICBOP=OFF \
-DCMAKE_BUILD_TYPE=Release

CPU Info

$ cat /proc/cpuinfo | tail | grep 'hart isa'
hart isa	: rv64imafdch_zicntr_zicsr_zifencei_zihpm_zaamo_zalrsc_zca_zcd

Relevant log output

/home/debian/Sakura286/llama/llama.cpp/ggml/src/ggml-cpu/vec.h:365:31: error: RISC-V type '__rvv_float32m8_t' requires the 'zve32f' extension
/home/debian/Sakura286/llama/llama.cpp/ggml/src/ggml-cpu/vec.h:365:31: error: RISC-V type '__rvv_float32m8_t' requires the 'zve32f' extension
/home/debian/Sakura286/llama/llama.cpp/ggml/src/ggml-cpu/vec.h:365:55: error: RISC-V type 'vfloat32m8_t' (aka '__rvv_float32m8_t') requires the 'zve32f' extension
  365 |             vfloat32m8_t ny = __riscv_vfmadd_vf_f32m8(ax, v, ay, avl);
      |                                                       ^
/home/debian/Sakura286/llama/llama.cpp/ggml/src/ggml-cpu/vec.h:365:62: error: RISC-V type 'vfloat32m8_t' (aka '__rvv_float32m8_t') requires the 'zve32f' extension
  365 |             vfloat32m8_t ny = __riscv_vfmadd_vf_f32m8(ax, v, ay, avl);
      |                                                              ^
/home/debian/Sakura286/llama/llama.cpp/ggml/src/ggml-cpu/vec.h:366:13: error: RISC-V type '__rvv_float32m8_t' requires the 'zve32f' extension
  366 |             __riscv_vse32_v_f32m8(&y[i], ny, avl);
      |             ^
/home/debian/Sakura286/llama/llama.cpp/ggml/src/ggml-cpu/vec.h:366:42: error: RISC-V type 'vfloat32m8_t' (aka '__rvv_float32m8_t') requires the 'zve32f' extension
  366 |             __riscv_vse32_v_f32m8(&y[i], ny, avl);
      |                                          ^
/home/debian/Sakura286/llama/llama.cpp/ggml/src/ggml-cpu/vec.h:537:26: error: RISC-V type 'vfloat32m8_t' (aka '__rvv_float32m8_t') requires the 'zve32f' extension
  537 |             vfloat32m8_t ay = __riscv_vle32_v_f32m8(&y[i], avl);
      |                          ^
/home/debian/Sakura286/llama/llama.cpp/ggml/src/ggml-cpu/vec.h:537:31: error: RISC-V type '__rvv_float32m8_t' requires the 'zve32f' extension
  537 |             vfloat32m8_t ay = __riscv_vle32_v_f32m8(&y[i], avl);
      |                               ^
/home/debian/Sakura286/llama/llama.cpp/ggml/src/ggml-cpu/vec.h:539:30: error: RISC-V type 'vfloat32m8_t' (aka '__rvv_float32m8_t') requires the 'zve32f' extension
  539 |                 vfloat32m8_t ax = __riscv_vle32_v_f32m8(&x[k][i], avl);
      |                              ^
/home/debian/Sakura286/llama/llama.cpp/ggml/src/ggml-cpu/vec.h:539:35: error: RISC-V type '__rvv_float32m8_t' requires the 'zve32f' extension
  539 |                 vfloat32m8_t ax = __riscv_vle32_v_f32m8(&x[k][i], avl);
      |                                   ^
/home/debian/Sakura286/llama/llama.cpp/ggml/src/ggml-cpu/vec.h:540:17: error: RISC-V type 'vfloat32m8_t' (aka '__rvv_float32m8_t') requires the 'zve32f' extension
  540 |                 ay = __riscv_vfmadd_vf_f32m8(ax, v[k][0], ay, avl);
      |                 ^
/home/debian/Sakura286/llama/llama.cpp/ggml/src/ggml-cpu/vec.h:540:22: error: RISC-V type '__rvv_float32m8_t' requires the 'zve32f' extension
  540 |                 ay = __riscv_vfmadd_vf_f32m8(ax, v[k][0], ay, avl);
      |                      ^
/home/debian/Sakura286/llama/llama.cpp/ggml/src/ggml-cpu/vec.h:540:22: error: RISC-V type '__rvv_float32m8_t' requires the 'zve32f' extension
fatal error: too many errors emitted, stopping now [-ferror-limit=]

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