Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile bug: RISCV cross-compile warnings cause build failure #12693

Closed
bandoti opened this issue Apr 1, 2025 · 6 comments
Closed

Compile bug: RISCV cross-compile warnings cause build failure #12693

bandoti opened this issue Apr 1, 2025 · 6 comments
Labels
build Compilation issues good first issue Good for newcomers Riscv Issues specific to RISCV hardware

Comments

@bandoti
Copy link
Collaborator

bandoti commented Apr 1, 2025

Git commit

9c4cef4

Operating systems

Linux

GGML backends

CPU

Problem description & steps to reproduce

I am updating the CI with cross-compile builds for RISCV regression tests (see #12428 ) and a build error is occurring due to some RISCV macros/functions. Since I am not familiar with RISCV functions in question, I am deferring this fix to folks who know that platform better.

First Bad Commit

No response

Compile command

Please see the github workflow here: https://github.com/ggml-org/llama.cpp/pull/12428/files#diff-245fd2c5accd266a35983ed2891af1c8f8b41af027aa393075f15a00b38ff817

Relevant log output

[ 12%] Building C object ggml/src/CMakeFiles/ggml-cpu.dir/ggml-cpu/ggml-cpu-quants.c.o
/home/runner/work/llama.cpp/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-quants.c: In function ‘ggml_vec_dot_q5_0_q8_0’:
/home/runner/work/llama.cpp/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-quants.c:3141:19: error: implicit declaration of function ‘__riscv_vcreate_v_i8m1_i8m2’; did you mean ‘__riscv_vset_v_i8m1_i8m2’? [-Werror=implicit-function-declaration]
 3141 |             v0c = __riscv_vcreate_v_i8m1_i8m2(v0l, v0h);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                   __riscv_vset_v_i8m1_i8m2
/home/runner/work/llama.cpp/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-quants.c:3141:19: error: incompatible types when assigning to type ‘vint8m2_t’ from type ‘int’
/home/runner/work/llama.cpp/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-quants.c: In function ‘ggml_vec_dot_q5_1_q8_1’:
/home/runner/work/llama.cpp/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-quants.c:3480:19: error: incompatible types when assigning to type ‘vint8m2_t’ from type ‘int’
 3480 |             v0c = __riscv_vcreate_v_i8m1_i8m2(v0l, v0h);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
@bandoti bandoti added build Compilation issues good first issue Good for newcomers porting Riscv Issues specific to RISCV hardware and removed porting labels Apr 1, 2025
@bandoti
Copy link
Collaborator Author

bandoti commented Apr 1, 2025

@Icenowy Is this something you would be able to help me with?

@Icenowy
Copy link
Contributor

Icenowy commented Apr 2, 2025

I doubt this is related to the version of toolchain and RVV intrinsics -- vcreate is a pseudo operation added between v0.11.1 and v1.0-rc1.

@Icenowy
Copy link
Contributor

Icenowy commented Apr 2, 2025

Checked with the history of GCC, it shows vcreate is available in GCC 14, but not available in 13.

@Icenowy
Copy link
Contributor

Icenowy commented Apr 2, 2025

The default GCC of Ubuntu 24.04 (noble) is GCC 13, which is expected to be not supporting vcreate ...

@Icenowy
Copy link
Contributor

Icenowy commented Apr 2, 2025

I think you'd install gcc-14-riscv64-linux-gnu g++-14-riscv64-linux-gnu instead of crossbuild-essential-riscv64, and use riscv64-linux-gnu-g{cc,++}-14 as the cross compiler.

@bandoti
Copy link
Collaborator Author

bandoti commented Apr 2, 2025

Thank you for the insights! I will give that a try.

@bandoti bandoti closed this as completed Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Compilation issues good first issue Good for newcomers Riscv Issues specific to RISCV hardware
Projects
None yet
Development

No branches or pull requests

2 participants