Linux x86_64 CPU builds: enable GGML_BACKEND_DL and GGML_CPU_ALL_VARIANTS (closes #68) #152
All Vouch review confidence checks passed
Residual risk 0.25 = Change Risk (0.47) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 497 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.372
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #152"
general
weight: 0.35
traversaro
Closes #68.
The
cpu_mklbuild for linux-64 compiles ggml's CPU backend for the baseline x86_64 target only. On 12004cpu_mkl,objdump -doflibggml-cpu.sofinds noymmregister use at all, so the quantized matmul and attention kernels run on SSE code even on AVX2, AVX-VNNI and AVX-512 machines; only what goes through MKL's BLAS is vectorized. The recipe sets noGGML_NATIVEand no AVX flag on Linux. ggml turnsGGML_NATIVEoff by default when cross-compiling or whenSOURCE_DATE_EPOCHis set (ggml/CMakeLists.txt:105-107); the missingymmcode says the native path was not taken on the build machines, which is the right outcome for a redistributable package, and leaves only the baseline.Upstream solves this for its own release archives with runtime dispatch:
GGML_BACKEND_DL=ONbuilds each backend as a loadable module, andGGML_CPU_ALL_VARIANTS=ONbuilds the CPU backend once per x86_64 level (x64,sse42,sandybridge,haswell,skylakex,alderlake,zen4, … —ggml/src/CMakeLists.txt:489-516). At start-up ggml scores each variant against the running CPU and loads the best one. That is the change #68 asks for, and this PR applies it to the linux-64 CPU builds only.Measured with the package this PR builds, against conda-forge's 12004
cpu_mkl_hf7acbac_0, on a 16-core desktop CPU with AVX-512 (Ubuntu 24.04), Gemma 4 E2B Q4_0, an 11 231-token cold prompt,llama-server --device none --parallel 2 --ctx-size 131072 --ubatch-size 512, three alternated runs each: prefill median 171.0 tok/s before, 584.1 tok/s with this PR, which loaded itszen4variant. One CPU, one model; generation not measured.What changes
cuda_compiler_version == "None":-DGGML_NATIVE=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON.GGML_BACKEND_DIR: the backend modules (libggml-cpu-*.so,libggml-blas.so,libggml-vulkan.so) install tobin/, upstream's default (ggml/src/CMakeLists.txt:388-391), and ggml finds them through the executable's directory (ggml-backend-reg.cpp:486-499). A compiled-in$PREFIX/libdoes not work: conda relocates it with NUL padding, ggml keeps the literal's full length in the search path, and no module loads.libllamaneed nothing new when their executable is in$PREFIX/bin(pythonincluded):llama_backend_init()callsggml_backend_load_all()when no backend is registered (src/llama.cpp:128-134). A program elsewhere callsggml_backend_load_all_from_path()with$PREFIX/bin.libggml-cpu-x64.so,libggml-cpu-haswell.soandlibggml-blas.soinbin/; runllama-cli --list-devices | grep BLAS, which fails when no module loads; skipllama-convert-llama2c-to-ggml,llama-cvector-generatorandllama-export-lora, which upstream does not build underGGML_BACKEND_DL(examples/CMakeLists.txt:37-38,tools/CMakeLists.txt:38-42).Built locally with
build-locally.py(linux_64_c_compiler_version15c_stdlib_version2.17cuda_compiler_versionNonecxx_compiler_version15); all tests pass.Open questions for the maintainers
ubuntu-x64archive ships neithercvector-generatornorexport-loraeither. Keeping them would take a second, non-DL build of ggml. Is dropping them acceptable?.condagoes from about 17.4 to 20.2 MiB.Checklist
conda-smithy(no new variant or dependency; happy to ask the bot if needed)