Skip to content

ggml-cpu: Fix build with sve #12059

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

Merged
merged 2 commits into from
Feb 25, 2025
Merged

Conversation

MollySophia
Copy link
Collaborator

Fix build issue when __ARM_FEATURE_SVE is enabled:

# molly @ o6-archlinux in ~/llama.cpp/build-sve on git:master o [11:27:44] 
$ cmake --build . -j12                                                             
[  0%] Generating build details from Git
-- Found Git: /usr/bin/git (found version "2.48.1")
[  1%] Built target sha256
[  2%] Built target xxhash
[  2%] Built target sha1
[  6%] Built target ggml-base
[  6%] Building C object ggml/src/CMakeFiles/ggml-cpu.dir/ggml-cpu/ggml-cpu-quants.c.o
[  6%] Building CXX object common/CMakeFiles/build_info.dir/build-info.cpp.o
[  6%] Built target build_info
/home/molly/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-quants.c: In function ‘ggml_vec_dot_q3_K_q8_K’:
/home/molly/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-quants.c:5292:26: error: initialization of ‘uint32_t *’ {aka ‘unsigned int *’} from incompatible pointer type ‘const uint8_t (*)[12]’ {aka ‘const unsigned char (*)[12]’} [-Wincompatible-pointer-types]
 5292 |         uint32_t * aux = &x[i].scales;
      |                          ^
/home/molly/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-quants.c:5279:14: warning: unused variable ‘pred_s32’ [-Wunused-variable]
 5279 |     svbool_t pred_s32 = svnot_b_z (svptrue_b32(), svptrue_pat_b32(SV_VL4));
      |              ^~~~~~~~
make[2]: *** [ggml/src/CMakeFiles/ggml-cpu.dir/build.make:135: ggml/src/CMakeFiles/ggml-cpu.dir/ggml-cpu/ggml-cpu-quants.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2179: ggml/src/CMakeFiles/ggml-cpu.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

Signed-off-by: Molly Sophia <[email protected]>
@github-actions github-actions bot added the ggml changes relating to the ggml tensor library for machine learning label Feb 25, 2025
Copy link
Member

@ggerganov ggerganov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi @Vithulep

@ggerganov
Copy link
Member

@MollySophia Can you also fix the "unused variable" warning in this PR?

@MollySophia
Copy link
Collaborator Author

@MollySophia Can you also fix the "unused variable" warning in this PR?

Sure! sry that I left that one

@MollySophia MollySophia merged commit 393fca6 into ggml-org:master Feb 25, 2025
47 checks passed
@Vithulep
Copy link
Contributor

Fix build issue when __ARM_FEATURE_SVE is enabled:

# molly @ o6-archlinux in ~/llama.cpp/build-sve on git:master o [11:27:44] 
$ cmake --build . -j12                                                             
[  0%] Generating build details from Git
-- Found Git: /usr/bin/git (found version "2.48.1")
[  1%] Built target sha256
[  2%] Built target xxhash
[  2%] Built target sha1
[  6%] Built target ggml-base
[  6%] Building C object ggml/src/CMakeFiles/ggml-cpu.dir/ggml-cpu/ggml-cpu-quants.c.o
[  6%] Building CXX object common/CMakeFiles/build_info.dir/build-info.cpp.o
[  6%] Built target build_info
/home/molly/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-quants.c: In function ‘ggml_vec_dot_q3_K_q8_K’:
/home/molly/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-quants.c:5292:26: error: initialization of ‘uint32_t *’ {aka ‘unsigned int *’} from incompatible pointer type ‘const uint8_t (*)[12]’ {aka ‘const unsigned char (*)[12]’} [-Wincompatible-pointer-types]
 5292 |         uint32_t * aux = &x[i].scales;
      |                          ^
/home/molly/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-quants.c:5279:14: warning: unused variable ‘pred_s32’ [-Wunused-variable]
 5279 |     svbool_t pred_s32 = svnot_b_z (svptrue_b32(), svptrue_pat_b32(SV_VL4));
      |              ^~~~~~~~
make[2]: *** [ggml/src/CMakeFiles/ggml-cpu.dir/build.make:135: ggml/src/CMakeFiles/ggml-cpu.dir/ggml-cpu/ggml-cpu-quants.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2179: ggml/src/CMakeFiles/ggml-cpu.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

Can You mention the System Information you have build. On My system it was showing only warning. Initially My code was same what you added, but i have changed to earlier one. Because removing memcpy contributes to better cache usage, efficient use of memory bandwidth.

@MollySophia
Copy link
Collaborator Author

Can You mention the System Information you have build. On My system it was showing only warning. Initially My code was same what you added, but i have changed to earlier one. Because removing memcpy contributes to better cache usage, efficient use of memory bandwidth.

Hi. Here's some of my system information:

$ cc -v
Using built-in specs.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-unknown-linux-gnu/14.1.1/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc/configure --enable-languages=c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://github.com/archlinuxarm/PKGBUILDs/issues --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-linker-build-id --enable-lto --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-multilib --disable-werror --host=aarch64-unknown-linux-gnu --build=aarch64-unknown-linux-gnu --with-arch=armv8-a --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.1.1 20240507 (GCC)

$ cmake --version
cmake version 3.31.5

@Vithulep
Copy link
Contributor

Can You mention the System Information you have build. On My system it was showing only warning. Initially My code was same what you added, but i have changed to earlier one. Because removing memcpy contributes to better cache usage, efficient use of memory bandwidth.

Hi. Here's some of my system information:

$ cc -v
Using built-in specs.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-unknown-linux-gnu/14.1.1/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc/configure --enable-languages=c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://github.com/archlinuxarm/PKGBUILDs/issues --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-linker-build-id --enable-lto --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-multilib --disable-werror --host=aarch64-unknown-linux-gnu --build=aarch64-unknown-linux-gnu --with-arch=armv8-a --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.1.1 20240507 (GCC)

$ cmake --version
cmake version 3.31.5

Thank you! This is because of the different gcc compiler version. I am Using gcc 13.1.0 and got warning.

orca-zhang pushed a commit to orca-zhang/llama.cpp that referenced this pull request Feb 26, 2025
* ggml-cpu: Fix build with sve

Signed-off-by: Molly Sophia <[email protected]>

* ggml-cpu: Remove unused variable in sve q3_k vec dot

Signed-off-by: Molly Sophia <[email protected]>

---------

Signed-off-by: Molly Sophia <[email protected]>
mglambda pushed a commit to mglambda/llama.cpp that referenced this pull request Mar 8, 2025
* ggml-cpu: Fix build with sve

Signed-off-by: Molly Sophia <[email protected]>

* ggml-cpu: Remove unused variable in sve q3_k vec dot

Signed-off-by: Molly Sophia <[email protected]>

---------

Signed-off-by: Molly Sophia <[email protected]>
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Mar 19, 2025
* ggml-cpu: Fix build with sve

Signed-off-by: Molly Sophia <[email protected]>

* ggml-cpu: Remove unused variable in sve q3_k vec dot

Signed-off-by: Molly Sophia <[email protected]>

---------

Signed-off-by: Molly Sophia <[email protected]>
mostlyuseful pushed a commit to mostlyuseful/llama.cpp that referenced this pull request May 12, 2025
* ggml-cpu: Fix build with sve

Signed-off-by: Molly Sophia <[email protected]>

* ggml-cpu: Remove unused variable in sve q3_k vec dot

Signed-off-by: Molly Sophia <[email protected]>

---------

Signed-off-by: Molly Sophia <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ggml changes relating to the ggml tensor library for machine learning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants