fix: guard llama.cpp backend init against SIGILL on x86_64 CPUs without FMA/AVX2 - #10105
Merged
Merged
Conversation
jbg
force-pushed
the
fix/10073-guard-llamacpp-fma
branch
from
July 9, 2026 16:06
9f3caa7 to
ae4adc8
Compare
jbg
approved these changes
Jul 9, 2026
Contributor
Author
|
Thanks for merging, @jbg - guarding llama.cpp init against SIGILL keeps older x86_64 CPUs from hard-crashing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On Linux x86_64,
goosedaborts with SIGILL on older Intel CPUs that lack FMA (the reporter's Ivy Bridge i5-3230M has AVX + F16C but no FMA/AVX2). The faulting instruction isvfmadd213ssinsideggml_cpu_init, which the bundled llama.cpp (ggml) CPU backend runs unconditionally whenLlamaBackend::init()is called fromLlamaCppBackend::new(). Because the illegal instruction takes down the whole backend process, the Desktop frontend then loses every backend-dependent feature (Skills, Apps, session history, ACP websocket).This adds an x86_64 CPU capability precheck that runs before
LlamaBackend::init(). When a required instruction set is missing, it returns a clear, actionable error naming the missing features instead of letting ggml execute an illegal instruction, so local inference is cleanly disabled and the rest of the backend stays alive.check_cpu_supports_local_inference()is gated by#[cfg(target_arch = "x86_64")]and usesstd::arch::is_x86_feature_detected!to check the instruction sets the bundled ggml CPU build relies on: FMA, AVX2, F16C, BMI2, and SSE4.2.Ok(()), leaving those paths untouched.Testing
cargo test -p goose --features local-inference --lib -- providers::local_inference::llamacpp(the two added unit tests pass):local_inference_cpu_support_check_accepts_current_hostderives its expectation from the host's detected features, so it assertsOkon a supported host andErron an x86_64 host missing the required sets (the exact environment this fix handles) rather than spuriously panicking there.local_inference_cpu_support_error_names_missing_instruction_setschecks the error message names the missing sets.Also verified with
cargo fmt --checkandcargo clippy -p goose --features local-inference -- -D warnings.Related Issues
Closes #10073
Screenshots/Demos (for UX changes)
N/A. This is a backend change to local inference initialization with no UI surface.