Skip to content

Feature/disable backends cmake fix#3709

Open
Frank-Schruefer wants to merge 2 commits intoggml-org:masterfrom
Frank-Schruefer:feature/disable-backends-cmake-fix
Open

Feature/disable backends cmake fix#3709
Frank-Schruefer wants to merge 2 commits intoggml-org:masterfrom
Frank-Schruefer:feature/disable-backends-cmake-fix

Conversation

@Frank-Schruefer
Copy link
Copy Markdown

@Frank-Schruefer Frank-Schruefer commented Mar 15, 2026

This PR contains two independent fixes:

1. Add disable_backends parameter to skip specific backends

Allow selectively disabling specific GPU backends by passing a comma-separated
list of backend names via a new disable_backends field in whisper_context_params
and 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=native when already set in CFLAGS

If -march= is already specified in CMAKE_C_FLAGS/CMAKE_CXX_FLAGS, do not
append -march=native again. Prevents compiler warnings about redundant flags
and 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.

@Frank-Schruefer Frank-Schruefer force-pushed the feature/disable-backends-cmake-fix branch from 037060f to a9114b0 Compare March 31, 2026 14:54
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.
@Frank-Schruefer Frank-Schruefer force-pushed the feature/disable-backends-cmake-fix branch from a9114b0 to 1b67c53 Compare March 31, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant