llama.cpp icon indicating copy to clipboard operation
llama.cpp copied to clipboard

ggml-cpu: add arm64 CPU feature check for OpenBSD, FreeBSD

Open brad0 opened this issue 9 months ago • 2 comments

brad0 avatar Feb 18 '25 07:02 brad0

cc @ggerganov

brad0 avatar Feb 27 '25 14:02 brad0

These feature checks are not really functional, because enabling these features, which is necessary to use the intrinsics, may still cause the compiler to emit code using these instruction sets, even when the instrinsics are not directly used. So what we really need to do is remove it entirely, and rely only on the compile flags to determine which instruction sets to use.

slaren avatar Feb 27 '25 16:02 slaren

These feature checks are not really functional, because enabling these features, which is necessary to use the intrinsics, may still cause the compiler to emit code using these instruction sets, even when the instrinsics are not directly used. So what we really need to do is remove it entirely, and rely only on the compile flags to determine which instruction sets to use.

That sounds problematic from a perspective of building packages. Packages have to run on a wide range of systems and that just means having to build to the lowest common denominator which means no benefit from the newer CPU features.

brad0 avatar Mar 05 '25 00:03 brad0

For x64 we have the ability to build multiple versions of the CPU backend with different architecture flags and choose the best one to load at runtime. This allows building a package that works on every computer, and it is enabled by building with GGML_BACKEND_DL and GGML_CPU_ALL_VARIANTS enabled.

This is not support for ARM at the moment because it lacks the implementation of the feature checking interface that allows it to select the best variant to load. For x64 this is implemented in cpu-feats-x86.cpp. So that's where the development effort should be directed, not on this feature check that doesn't really work.

slaren avatar Mar 05 '25 13:03 slaren