Repository navigation
feat: expose explicit backend loaders in the internal GGML module - #2451
Open
original4422 wants to merge 2 commits into
Open
original4422 wants to merge 2 commits into
original4422 wants to merge 2 commits into
Conversation
This branch has not been deployed
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
Refs #2069 for the explicit-loader bindings only.
Bind the four existing GGML registry functions in the private
_ggmlmodule with the native pointer, path and void-return types, using the existing ctypes decorator.Keep native automatic discovery unchanged and document explicit loading, the existing
GGML_BACKEND_PATHoption, and the requirement to close all users before unloading a handle.Add native subprocess regressions, a private-API installation guide and an Unreleased changelog entry.
Evidence
Llamaconsumer fails with “no backends are loaded” from an ordinary working directory. Native registration enables the same tiny-model consumer. The four new binding tests fail on the original Python module.After: all 4 new tests pass without skips using the new Python bindings over real modules. They check missing paths/NULL handles, byte-path arguments, void returns, load → real 2-token completion → close/unload → model-load failure, and directory/default discovery. No model or loader mocks are used.
GGML_BACKEND_DL=ON: fullmake test30 passed, no skips. The ordinary tests use the existing nativeGGML_BACKEND_PATHoption to find the CPU plugin; the new subprocess cases clear it to exercise explicit registration.GGML_BACKEND_DL=OFF: normalmake test27 passed, 3 skipped. Only the three opt-in dynamic-module cases skip; all 26 original tests and the missing-path/argument case pass.make lint: Ruff checks and formatting pass for all 30 Python files. Both documentation Python fences compile, the MkDocs YAML/navigation parses, andgit diff --checkpasses; the full documentation site was not built.macOS arm64, Python 3.12.14, bundled llama.cpp
f5e6915c2, two build workers,GGML_NATIVE=OFFandGGML_ACCELERATE=ON.The original macOS build also enables Metal; model controls use
n_gpu_layers=0.Tests reuse existing local GGUF data with Hub offline mode.
The first full-suite attempt lacked the SOCKS client's optional
socksiodependency; installing that normal prerequisite offline resolved the environment failure without changing proxy settings or test code.Linux x86 CPU-variant dispatch, cross-platform/GPU compatibility and performance were not validated, so this does not close that broader part of #2069.
Implementation, source/diff review and validation were performed by an AI coding agent under the contributor's authorization.
Merge Danger
Door: two-way.
Blast Radius: explicit internal GGML backend registration. Callers own handle/resource lifetime; no top-level public export or automatic loading behavior is added.