Skip to content

feat(serving): K3 buft-override relaunch bridge — pager wired into the serving daemon, LIVE - #2038

Merged
joelteply merged 2 commits into
canaryfrom
feat/k3-daemon-bridge
Jul 27, 2026
Merged

joelteply merged 2 commits into
canaryfrom
feat/k3-daemon-bridge

Conversation

@joelteply

@joelteply joelteply commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

What

The complete continuum-side K3 bridge — the last mile that makes K3 physically page its expert layers. Two halves:

Construction — moe_serving_context(gguf) composes tested GGUF reads (locate_layer_sets, gguf_keys::block_count, locate_gate_magnitudes) into a sized, gate-seeded ServingExpertPager. Dense → None.

Daemon wiring — ServingDaemonModule holds the served MoE model's pager (keyed by model_id, rebuilt on model change) and each reconcile computes:

governed VRAM ceiling → tick_layer_placement → hot expert LAYERS that fit →
ServingTarget.expert_placement = Some(PlacementRequest)

M5's launcher (#2036) turns that into the --override-tensor cold-complement; the existing target-diff respawn fires when it changes. Debounced via committed_placement — only re-commits when hot-layer churn passes the threshold, so a 1–2 layer flap never respawns the (every-weight-reloading) llama-server.

  • Gate-seeded: the first placement already pins the model's baked-preferred layers before a live hit; hits refine it.
  • Glass-boxed (Joel's directive): a serving.k3_placement probe emits model / budget / hot-of-total-layers / relaunch? every pass.
  • Sync Mutex, never held across an await (reconcile_to_plan is sync).

Builds on M5's #2036 (-ot builder + ServingTarget.expert_placement + the None hook). cargo check --lib green on the 5090.

Result

K3 pages its expert layers on a 32 GB card as the served workload shifts — the substrate thesis, running.

🤖 Generated with Claude Code

…ngExpertPager

The construction half of the K3 daemon bridge. moe_serving_context(gguf_path, id,
margin, threshold) composes three tested GGUF reads — locate_layer_sets (MoE detect
+ per-layer expert geometry), gguf_keys::block_count (total blocks = the -ot
ceiling), and locate_gate_magnitudes (the router's baked per-expert preference) —
into a MoeServingContext { pager, n_experts_per_layer, n_layers }. Dense models
return None (served with no override, as before).

The gate seed matters: the pager's FIRST tick_layer_placement already pins the
model's inherently-preferred expert layers to GPU before a single live hit, then
refines as real activations arrive — K3 gets a sensible static residency
immediately and an adaptive one over time.

Also retargets tick_layer_placement from &SystemProfile to a raw
serving_budget_bytes: u64, so the serving daemon can pass its governed VRAM ceiling
(the resource-board authority) instead of re-probing hardware. plan_layer_residency
already took the budget directly; this just stops the wrapper from assuming a
SystemProfile the daemon doesn't hold.

Next: the daemon reconcile wiring (hold the context per served model, tick it, set
ServingTarget.expert_placement) — M5's #2036 landed the None hook + the -ot builder
for it. cargo check --lib --tests clean on the 5090.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
…ide relaunch LIVE

The daemon-reconcile half of the K3 bridge, completing the buft-override relaunch
end to end. ServingDaemonModule now holds the served MoE model's ServingExpertPager
(via moe_serving_context, keyed by model_id, rebuilt on a model change) and, each
reconcile, calls compute_expert_placement:

  governed VRAM ceiling → tick_layer_placement → hot expert LAYERS that fit →
  ServingTarget.expert_placement = Some(PlacementRequest)

M5's launcher (#2036) turns that into the `--override-tensor` cold-complement at
the spawn Command, and the existing target-diff respawn fires when it changes. The
placement is DEBOUNCED via committed_placement: it only re-commits when hot-layer
churn passes RELAUNCH_LAYER_CHURN_THRESHOLD, so a 1-2 layer flap never respawns the
(every-weight-reloading) llama-server; a real task shift does.

Gate-seeded, so the FIRST placement already pins the model's inherently-preferred
expert layers before a live hit; live hits refine it. Dense models / zero budget /
unresolved GGUF → None (served with no override, exactly as before).

Glass-boxed per Joel: a `serving.k3_placement` probe emits the load-bearing
quantities (model, budget, hot/total layers, relaunch?) every pass — the K3
residency decision is observable at the RTOS-probe seam, not a silent guess.

The sync Mutex is never held across an await (reconcile_to_plan is sync). This is
the last continuum-side mile: K3 physically pages its expert layers on the 5090 as
the served workload shifts. cargo check --lib green on the 5090 native toolchain.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
@joelteply joelteply changed the title feat(capacity): moe_serving_context — GGUF → sized, gate-seeded ServingExpertPager feat(serving): K3 buft-override relaunch bridge — pager wired into the serving daemon, LIVE Jul 27, 2026
@joelteply
joelteply merged commit e63fcfb into canary Jul 27, 2026
4 checks passed
@joelteply
joelteply deleted the feat/k3-daemon-bridge branch July 27, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant