Skip to content

feat: dynamic-backends (GGML_BACKEND_DL) — macOS+Linux DL modules#1

Merged
fiorelorenzo merged 6 commits into
mainfrom
feat/dynamic-backends
Jun 9, 2026
Merged

feat: dynamic-backends (GGML_BACKEND_DL) — macOS+Linux DL modules#1
fiorelorenzo merged 6 commits into
mainfrom
feat/dynamic-backends

Conversation

@fiorelorenzo

Copy link
Copy Markdown
Owner

Adds a dynamic-backends feature that builds ggml backends as runtime-loadable modules (GGML_BACKEND_DL), loads them via ggml_backend_load_all, and exposes the active device via Model::backend_name(). Validated on macOS (Metal loaded as a module). Includes a vendored parakeet.cpp DL patch + an RTLD_GLOBAL ggml patch (fixes a real DL crash). CI: static + DL legs on macOS/Linux. Windows DL deferred (MSVC symbol-deferral limitation — needs registry-routing patch).

Expose backend_name() (FFI to parakeet_capi_backend_name) returning the
resolved ggml device name, and add a macOS-gated integration test under the
dynamic-backends feature proving a dlopen'd Metal backend module is selected
for a real model (de-risk for the dynamic-backends path).

De-risk surfaced a DL-only crash: parakeet.cpp's backend.cpp calls CPU-backend
symbols directly, which under GGML_BACKEND_DL live only in a dlopen'd module.
ggml loaded modules RTLD_LOCAL, so those dynamic_lookup references resolved to
NULL -> SIGSEGV on first Backend construction (Metal path). Fixed with a
repo-tracked ggml patch (patches/ggml/0001-dl-load-global.patch) that loads
backend modules RTLD_GLOBAL on Unix; build.rs now applies patches/ggml to the
ggml submodule root. parakeet-cpp/build.rs re-emits the sys crate's backends
dir as PARAKEET_DL_BACKENDS_DIR so the test can point PARAKEET_BACKENDS_DIR at
the modules.
@fiorelorenzo fiorelorenzo merged commit 27ce3be into main Jun 9, 2026
5 checks passed
@fiorelorenzo fiorelorenzo deleted the feat/dynamic-backends branch June 9, 2026 12:40
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