Feature/disable backends cmake fix#3709
Open
Frank-Schruefer wants to merge 2 commits intoggml-org:masterfrom
Open
Feature/disable backends cmake fix#3709Frank-Schruefer wants to merge 2 commits intoggml-org:masterfrom
Frank-Schruefer wants to merge 2 commits intoggml-org:masterfrom
Conversation
037060f to
a9114b0
Compare
Allow selectively disabling GPU backends by passing a comma-separated list of backend names (e.g. "vulkan,opencl") via the new ggml_backend_load_all_from_path_with_disable() function and the disable_backends field in whisper_context_params. This is useful when certain backends are available but cause issues (driver bugs, unsupported hardware features, etc.) and should be skipped without recompiling. Example usage: whisper_context_params params = whisper_context_default_params(); params.disable_backends = "vulkan,opencl"; struct whisper_context * ctx = whisper_init_from_file_with_params(path, params);
If -march= is already specified via CMAKE_C_FLAGS/CMAKE_CXX_FLAGS or ARCH_FLAGS, do not append -march=native again. This prevents compiler warnings about redundant flags and allows users to override the march target by setting it in their build environment. Fixes duplicate -march flag in ggml-cpu and ggml-amx backends.
a9114b0 to
1b67c53
Compare
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.
This PR contains two independent fixes:
1. Add
disable_backendsparameter to skip specific backendsAllow selectively disabling specific GPU backends by passing a comma-separated
list of backend names via a new
disable_backendsfield inwhisper_context_paramsand a new
ggml_backend_load_all_from_path_with_disable()function.Useful when certain backends are available on the system but cause issues
(driver bugs, unsupported hardware features, crashes) and should be skipped
without recompiling.
Example:
whisper_context_params params = whisper_context_default_params();
params.disable_backends = "vulkan,opencl";
struct whisper_context * ctx = whisper_init_from_file_with_params(path, params);
2. CMake: avoid duplicate
-march=nativewhen already set in CFLAGSIf
-march=is already specified inCMAKE_C_FLAGS/CMAKE_CXX_FLAGS, do notappend
-march=nativeagain. Prevents compiler warnings about redundant flagsand allows users to override the march target via their build environment.
Affects ggml-cpu and ggml-amx backends.
P.S.: When cross-compiling, the user typically sets -march= via
CMAKE_C_FLAGS / CMAKE_CXX_FLAGS. If CMake unconditionally appends
-march=native afterwards, GCC uses the last -march on the command
line — silently overriding the intended target architecture and producing
a binary for the build host instead of the cross-compile target.