v4: pluggable expert-store backend registry - #964
Open
8PotatoChip8 wants to merge 1 commit into
Open
Conversation
The DeepSeek-V4 engine opens its expert store by calling the on-disk
opener directly, so anyone who wants experts read from somewhere else
has to fork the engine and keep the diff up to date.
Add a small name->open_fn registry. The on-disk opener registers as
"auto" at link time; COLI_EXPERT_STORE unset (or "auto") dispatches to
it, so the default path is unchanged. Setting the env to another name
routes to whatever backend a build links in, and an unregistered name
errors cleanly with a message naming it.
This is the smallest change that lets a downstream build plug in its
own store without touching the engine: a name->open function table,
register/lookup, and the one call site in coli_v4_engine_open (plus the
standalone CLI path) going through coli_expert_store_backend_open_selected.
- expert_store_registry.{c,h}: register/lookup/count + open_selected;
standalone, no engine link, no deps
- test_expert_store_registry.c: auto registered, lookup hit/miss, env
dispatch, clean error on unknown backend
- deepseek_v4.c: engine_open + CLI path route through the registry;
coli_v4_expert_store_open_planned takes a config arg so a backend
outside the engine still gets the parsed config
- Makefile, Makefile.deepseek-v4: link the registry into the binary and
the RUNTIME-linked test; add deepseek-v4-objs so downstream trees
reuse the unit .o's without recompiling
- test_v4_ownership.c, test_deepseek_v4_dspark_source.py: track the new
signature / call site
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
Right now the DeepSeek-V4 engine opens its expert store by calling the on-disk/mmap opener directly. That works for the default case, but it means anyone who wants the engine to read experts from somewhere else — a different SSD layout, a remote store, whatever — has to fork the engine and keep that diff alive as upstream moves.
This adds a small registry so the engine asks for a backend by name instead. The on-disk opener registers itself as
"auto"at link time, andCOLI_EXPERT_STOREunset (or"auto") lands on it — so nothing changes unless someone opts in. SetCOLI_EXPERT_STORE=fooand the engine routes to whateverfoobackend a build links in; a name that isn't registered errors out cleanly with a message naming it.The aim is the smallest change that lets a downstream build plug in its own store without touching the engine: a name→open-function table, register/lookup, and the one call site in
coli_v4_engine_open(plus the standalone CLI path) going throughcoli_expert_store_backend_open_selected. No new dependencies, and the default CPU path is byte-for-byte the same.Validation
make -C c check— 421 tests, 0 failures (52 skipped, the same set that skips ondevwithout a model/CUDA)Compatibility
COLI_EXPERT_STOREunset is the exact prior call.c/.hsources and a unit testNotes
coli_v4_expert_store_open_plannedpicks up aconfigargument so a backend that lives outside the engine (linked in by a downstream build) still receives the parsed config. The two existing tests that reference the old direct call —test_v4_ownership.c(stub signature) andtest_deepseek_v4_dspark_source.py(source-order grep) — are updated to the new call site.Makefile.deepseek-v4also gains adeepseek-v4-objstarget that prints the unit object list, so a downstream tree can link exactly what the plain binary links without recompiling the units.