feat(stablediffusion-ggml): Improve legacy CPU support for stablediffusion-ggml backend #8461
+107
−18
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.
Description
I'm running LocalAI on an old SandyBridge i7-2600K which doesn't have support for AVX2/AVX512. This change adds the same pattern that is currently in the
whisperbackend to build multiple libraries with varying degrees of instruction set support and dynamically load them at runtime based on the CPU features available.In addition, I've updated both backends to also disabled BMI2 instructions for the fallback and AVX variants of the library. It looks like SandyBridge was when AVX was added but BMI2 wasn't added until Haswell.
Notes for Reviewers
I tested this by building the backend locally, copying it to my SandyBridge PC and reloading the backends to see the illegal instruction error go away and the model run E2E.
Signed commits