stable-diffusion.cpp
stable-diffusion.cpp copied to clipboard
Google Pixel 8 Pro error during "cmake --build . --config Release"
looks like a new error as of clang 16 according to this article: https://www.redhat.com/en/blog/new-warnings-and-errors-clang-16 I have clang version 17.0.5 Target: aarch64-unknown-linux-android24
~/stable-diffusion.cpp/build $ cmake --build . --config Release
[ 7%] Building C object ggml/src/CMakeFiles/ggml.dir/ggml.c.o/data/data/com.termux/files/home/stable-diffusion.cpp/ggml/src/ggml.c:1221:5: warning: implicit conversion increases floating-point precision: 'float32_t' (aka 'float') to 'ggml_float' (aka 'double') [-Wdouble-promotion]
1221 | GGML_F16_VEC_REDUCE(sumf, sum); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/data/data/com.termux/files/home/stable-diffusion.cpp/ggml/src/ggml.c:748:41: note: expanded from macro 'GGML_F16_VEC_REDUCE'
748 | #define GGML_F16_VEC_REDUCE
GGML_F32Cx4_REDUCE | ^
/data/data/com.termux/files/home/stable-diffusion.cpp/ggml/src/ggml.c:738:38: note: expanded from macro
'GGML_F32Cx4_REDUCE' 738 | #define GGML_F32Cx4_REDUCE GGML_F32x4_REDUCE | ^
/data/data/com.termux/files/home/stable-diffusion.cpp/ggml/src/ggml.c:668:11: note: expanded from macro 'GGML_F32x4_REDUCE'
668 | res = GGML_F32x4_REDUCE_ONE(x[0]); \ | ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/data/data/com.termux/files/home/stable-diffusion.cpp/ggml/src/ggml.c:653:34: note: expanded from macro
'GGML_F32x4_REDUCE_ONE'
653 | #define GGML_F32x4_REDUCE_ONE(x) vaddvq_f32(x) | ^~~~~~~~~~~~~
/data/data/com.termux/files/home/stable-diffusion.cpp/ggml/src/ggml.c:1269:9: warning: implicit conversion increases floating-point
precision: 'float32_t' (aka 'float') to 'ggml_float' (aka 'double') [-Wdouble-promotion]
1269 |
GGML_F16_VEC_REDUCE(sumf[k], sum[k]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/data/data/com.termux/files/home/stable-diffusion.cpp/ggml/src/ggml.c:748:41: note: expanded from macro
'GGML_F16_VEC_REDUCE'
748 | #define GGML_F16_VEC_REDUCE
GGML_F32Cx4_REDUCE | ^
/data/data/com.termux/files/home/stable-diffusion.cpp/ggml/src/ggml.c:738:38: note: expanded from macro
'GGML_F32Cx4_REDUCE' 738 |
#define GGML_F32Cx4_REDUCE
GGML_F32x4_REDUCE | ^
/data/data/com.termux/files/home/stable-diffusion.cpp/ggml/src/ggml.c:668:11: note: expanded from macro 'GGML_F32x4_REDUCE'
668 | res = GGML_F32x4_REDUCE_ONE(x[0]); \ | ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/data/data/com.termux/files/home/stable-diffusion.cpp/ggml/src/ggml.c:653:34: note: expanded from macro
'GGML_F32x4_REDUCE_ONE'
653 | #define GGML_F32x4_REDUCE_ONE(x) vaddvq_f32(x) | ^~~~~~~~~~~~~
/data/data/com.termux/files/home/stable-diffusion.cpp/ggml/src/ggml.c:3155:6: warning: no previous prototype for function
'ggml_broadcast' [-Wmissing-prototypes] 3155 | void ggml_broadcast( | ^
/data/data/com.termux/files/home/stable-diffusion.cpp/ggml/src/ggml.c:3155:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
3155 | void ggml_broadcast( | ^ | static
/data/data/com.termux/files/home/stable-diffusion.cpp/ggml/src/ggml.c:11953:11: error: type specifier missing, defaults to 'int'; ISO
C99 and later do not support implicit int [-Wimplicit-int]
11953 | const so2 = ne00 * ne01; | ~~~~~ ^ | int
/data/data/com.termux/files/home/stable-diffusion.cpp/ggml/src/ggml.c:11954:11: error: type specifier missing, defaults to 'int'; ISO
C99 and later do not support implicit int [-Wimplicit-int]
11954 | const so3 = ne00 * ne01 * ne02; | ~~~~~ ^ | int
/data/data/com.termux/files/home/stable-diffusion.cpp/ggml/src/ggml.c:11955:11: error: type specifier missing, defaults to 'int'; ISO
C99 and later do not support implicit int [-Wimplicit-int]
11955 | const do2 = ne0 * ne1; | ~~~~~ ^ | int
/data/data/com.termux/files/home/stable-diffusion.cpp/ggml/src/ggml.c:11956:11: error: type specifier missing, defaults to 'int'; ISO
C99 and later do not support implicit int [-Wimplicit-int]
11956 | const do3 = ne0 * ne1 * ne2; | ~~~~~ ^ | int
/data/data/com.termux/files/home/stable-diffusion.cpp/ggml/src/ggml.c:11948:15: warning: unused variable 'padding_factor' [-
Wunused-variable]
11948 | const int padding_factor = dst->op_params[0]; | ^~~~~~~~~~~~~~
/data/data/com.termux/files/home/stable-diffusion.cpp/ggml/src/ggml.c:19127:28: warning: comparison of integers of different signs:
'const size_t' (aka 'const unsigned long') and 'const int' [-Wsign-compare]
19127 | if (offset_pad != cur_offset) { | ~~~~~~~~~~ ^ ~~~~~~~~~~
5 warnings and 4 errors generated.
make[2]: *** [ggml/src/CMakeFiles/ggml.dir/build.make:76: ggml/src/CMakeFiles/ggml.dir/ggml.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:212: ggml/src/CMakeFiles/ggml.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
~/stable-diffusion.cpp/build $
This is an upstream issue with GGML. Manually replacing const with const int in ggml/src/ggml.c on the lines mentioned in the error message (11953-11956) fixes the problem.