Skip to content

v4: pluggable expert-store backend registry - #964

Open
8PotatoChip8 wants to merge 1 commit into
JustVugg:devfrom
8PotatoChip8:v4/expert-store-registry
Open

v4: pluggable expert-store backend registry#964
8PotatoChip8 wants to merge 1 commit into
JustVugg:devfrom
8PotatoChip8:v4/expert-store-registry

Conversation

@8PotatoChip8

Copy link
Copy Markdown

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, and COLI_EXPERT_STORE unset (or "auto") lands on it — so nothing changes unless someone opts in. Set COLI_EXPERT_STORE=foo and the engine routes to whatever foo backend 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 through coli_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 on dev without a model/CUDA)
  • CUDA — N/A, no CUDA paths touched
  • Performance — N/A, default path unchanged

Compatibility

  • The default CPU build remains dependency-free — the registry is plain C with no new libs, and COLI_EXPERT_STORE unset is the exact prior call
  • No model files, generated binaries, or benchmark artifacts — only .c/.h sources and a unit test

Notes

coli_v4_expert_store_open_planned picks up a config argument 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) and test_deepseek_v4_dspark_source.py (source-order grep) — are updated to the new call site. Makefile.deepseek-v4 also gains a deepseek-v4-objs target that prints the unit object list, so a downstream tree can link exactly what the plain binary links without recompiling the units.

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
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