Skip to content

Feature Request: Add Ivy Bridge/Piledriver CPU backends when GGML_CPU_ALL_VARIANTS=ON #17966

@bberberov

Description

@bberberov
Contributor

Prerequisites

  • I am running the latest code. Mention the version if possible as well.
    I carefully followed the README.md.
    I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
    I reviewed the Discussions, and have a new and useful enhancement to share.

Feature Description

Hello,

I looked at the CMake code and noticed that one could add an additional CPU backend for Ivy Bridge/Piledriver.

From ggml/src/CMakeLists.txt at b7360:

...
        ggml_add_cpu_backend_variant(x64)
        ggml_add_cpu_backend_variant(sse42        SSE42)
        ggml_add_cpu_backend_variant(sandybridge  SSE42 AVX)
        ggml_add_cpu_backend_variant(haswell      SSE42 AVX F16C AVX2 BMI2 FMA)
        ggml_add_cpu_backend_variant(skylakex     SSE42 AVX F16C AVX2 BMI2 FMA AVX512)
        ggml_add_cpu_backend_variant(icelake      SSE42 AVX F16C AVX2 BMI2 FMA AVX512 AVX512_VBMI AVX512_VNNI)
        ggml_add_cpu_backend_variant(alderlake    SSE42 AVX F16C AVX2 BMI2 FMA AVX_VNNI)
...

Ivy Bridge and Piledriver support F16C but not AVX2. Support could be added with:

        ggml_add_cpu_backend_variant(ivybridge    SSE42 AVX F16C)

I looked at the code rest of the code, and conditions on __F16C__ but not __AVX2__ are few, but not zero. I'm not sure what the performance difference would be, and it would increase the size of a package with GGML_CPU_ALL_VARIANTS=ON.

Piledriver also seems to support FMA. It could have its own backend with:

        ggml_add_cpu_backend_variant(piledriver   SSE42 AVX F16C FMA)

I noticed there are some issues with MSVC around these two features specifically, but I think it's worth adding support just for GCC/Linux.

I would like to know if you would consider adding these additional backend(s), or if we could add comments in the CMakeLists.txt that these and other specific targets would not have dedicated backends. Thanks.

Motivation

I think it's worth adding the backend(s) for people who don't build their own custom binaries, and use packages built with GGML_CPU_ALL_VARIANTS=ON on older hardware. I think it supports Better packaging for llama.cpp to support downstream consumers. I have some Ivy Bridges with a "larger" amount of RAM I would like to try out llama.cpp on, and I build my own generic Linux packages.

Possible Implementation

I've already looked at the code, and so far I noticed that 2 lines need to be added to build an additional ivybridge backend. I built openSUSE, Fedora, and AlmaLinux packages with the additional backend successfully. I haven't tried to run the complete CI pipeline as suggested, so I didn't open an PR, and am looking for your feedback on the issue.

Activity

taronaeo

taronaeo commented on Dec 13, 2025

@taronaeo
Member

Feel free to open a pull request :)

ggerganov

ggerganov commented on Dec 13, 2025

@ggerganov
Member

and it would increase the size of a package with GGML_CPU_ALL_VARIANTS=ON.

How much does it increase with?

bberberov

bberberov commented on Dec 14, 2025

@bberberov
ContributorAuthor

This is from my openSUSE Tumbleweed package for b7378

The additional ivybridge backend is 710Kib. You can compare to the others. I don't LTO (link-time optimization) in these packages yet; not sure if that will have an impact. The vulkan backend is huge by comparison!

▶ rpm -ql libggml0 | xargs ls -ldh
drwxr-xr-x 2 root root  4.0K Dec 13 10:12 /usr/lib64/ggml
-rwxr-xr-x 1 root root   63K Dec 13 08:15 /usr/lib64/ggml/libggml-blas.so
-rwxr-xr-x 1 root root  764K Dec 13 08:15 /usr/lib64/ggml/libggml-cpu-alderlake.so
-rwxr-xr-x 1 root root  768K Dec 13 08:15 /usr/lib64/ggml/libggml-cpu-haswell.so
-rwxr-xr-x 1 root root  865K Dec 13 08:15 /usr/lib64/ggml/libggml-cpu-icelake.so
-rwxr-xr-x 1 root root  710K Dec 13 08:15 /usr/lib64/ggml/libggml-cpu-ivybridge.so
-rwxr-xr-x 1 root root  701K Dec 13 08:15 /usr/lib64/ggml/libggml-cpu-sandybridge.so
-rwxr-xr-x 1 root root 1013K Dec 13 08:15 /usr/lib64/ggml/libggml-cpu-sapphirerapids.so
-rwxr-xr-x 1 root root  865K Dec 13 08:15 /usr/lib64/ggml/libggml-cpu-skylakex.so
-rwxr-xr-x 1 root root  587K Dec 13 08:15 /usr/lib64/ggml/libggml-cpu-sse42.so
-rwxr-xr-x 1 root root  579K Dec 13 08:15 /usr/lib64/ggml/libggml-cpu-x64.so
-rwxr-xr-x 1 root root  715K Dec 13 08:15 /usr/lib64/ggml/libggml-opencl.so
-rwxr-xr-x 1 root root  119K Dec 13 08:15 /usr/lib64/ggml/libggml-rpc.so
-rwxr-xr-x 1 root root   51M Dec 13 08:15 /usr/lib64/ggml/libggml-vulkan.so
lrwxrwxrwx 1 root root    17 Dec 13 08:15 /usr/lib64/libggml-base.so -> libggml-base.so.0
lrwxrwxrwx 1 root root    21 Dec 13 08:15 /usr/lib64/libggml-base.so.0 -> libggml-base.so.0.9.4
-rwxr-xr-x 1 root root  551K Dec 13 08:15 /usr/lib64/libggml-base.so.0.9.4
lrwxrwxrwx 1 root root    12 Dec 13 08:15 /usr/lib64/libggml.so -> libggml.so.0
lrwxrwxrwx 1 root root    16 Dec 13 08:15 /usr/lib64/libggml.so.0 -> libggml.so.0.9.4
-rwxr-xr-x 1 root root   50K Dec 13 08:15 /usr/lib64/libggml.so.0.9.4
drwxr-xr-x 2 root root  4.0K Dec 13 10:12 /usr/share/licenses/libggml0
-rw-r--r-- 1 root root  1.1K Dec 13 01:35 /usr/share/licenses/libggml0/LICENSE
added a commit that references this issue on Dec 19, 2025
f714331
added 2 commits that reference this issue on Dec 24, 2025
bf49f50
93b1248
added a commit that references this issue on Dec 28, 2025
94de74e
added a commit that references this issue on Feb 5, 2026
88b5ce2
added a commit that references this issue on Apr 27, 2026
755932c
added a commit that references this issue on May 7, 2026
8f6d2da
added 2 commits that reference this issue on May 16, 2026
f1d1539
f1e3c41
added a commit that references this issue on May 29, 2026
d0581c4
added a commit that references this issue on May 31, 2026
53acb75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @ggerganov@bberberov@taronaeo

      Issue actions