Skip to content

feat(v4): the expert history lives in route_trace.h now — #700 completed - #969

Open
terrizoaguimor wants to merge 1 commit into
JustVugg:devfrom
terrizoaguimor:fix/v4-usage-route-trace
Open

feat(v4): the expert history lives in route_trace.h now — #700 completed#969
terrizoaguimor wants to merge 1 commit into
JustVugg:devfrom
terrizoaguimor:fix/v4-usage-route-trace

Conversation

@terrizoaguimor

Copy link
Copy Markdown
Contributor

#700 left one engine out

V4 kept a private .coli_usage reader/writer after the telemetry unification: same file format hand-duplicated (header records, FNV-1a identity, tmp+rename), but:

  • "deepseek_v4" was never registered in rt_engine_names, so a V4-written history announced itself as "an unknown engine" to every sibling's refusal message;
  • its copy had already drifted from the header: no COLI_USAGE_DECAY on save, no legacy-layout path (a stricter dims-record requirement silently dropped headerless histories the siblings accept), and the duplicated loops were one more place for the recurring "landed in one engine, never reached the siblings" defect to live.

The change

V4 adopts route_trace.h, which is also where the next fix in this class reaches V4 automatically:

  • rt_init("deepseek_v4", layers, experts) at hot-store creation; rt_count feeds the shared counters at each store lookup, next to policy->usage (same site, same semantics: store lookup == selection);
  • save: rt_save — cumulative across sessions, same header records byte-for-byte (-1 dims, -2 1 fnv("deepseek_v4")), the standard [STATS] line, and COLI_USAGE_DECAY now applies to V4 like everyone else. The COLI_V4_SAVE_USAGE=0 opt-out is preserved;
  • load: rt_read with a callback into policy->usage — same bounds admission as the private reader, plus the standard dimension/identity refusals and the PIN=<path> trusted-override semantics its private copy lacked. Existing V4 histories carry over unchanged (formats agree byte for byte);
  • hot_engine_id() and the hand-rolled parse/serialize loops go away (−91 LOC);
  • test_route_trace section 6 now proves the deepseek_v4 id resolves to its name;
  • Makefile.deepseek-v4 objects depend on route_trace.h.

One thing deliberately NOT wired

Per-row ROUTE_TRACE routing lines stay GLM/K3/Inkling/OLMoE-only. The amalgam builds one object per COLI_V4_UNIT_*, so the header's statics get a single owner — the hot-store unit — while the router runs in other units. rt_init opens the stream, so when ROUTE_TRACE is set, V4 prints one explicit note that the stream will hold no rows rather than silently suggesting otherwise. Wiring the router units is a clean follow-up for whoever wants V4 in the route-pairs pipeline.

…completed

V4 kept a private .coli_usage reader/writer after the JustVugg#700 unification:
same file format hand-duplicated (header records, FNV-1a identity,
tmp+rename), but the engine was never registered in rt_engine_names, so
a V4-written history announced itself as "an unknown engine" to every
sibling, and its copy had already drifted (no COLI_USAGE_DECAY, no
legacy-layout acceptance, a stricter dims record that silently dropped
headerless files).

Move V4 onto the shared header, which is also where this fix class is
guaranteed to reach every sibling next time:

- rt_init("deepseek_v4", ...) at hot-store creation; store lookups feed
  the shared counters next to policy->usage (rt_count), which the next
  save now persists via rt_save — cumulative across sessions, byte-
  identical header records to the private writer, decay knob included;
- the reader is rt_read with a callback into policy->usage: same bounds
  admission as the private reader, the standard dimension/identity
  refusals and PIN= override semantics, and inkling's IKU1 refused by
  name. Deliberate widening: legacy headerless histories are accepted
  now, matching the siblings;
- hot_engine_id and the hand-rolled parse/serialize/delete loops go
  away (-91 LOC);
- rt_engine_names gains "deepseek_v4", and test_route_trace section 6
  now proves the id resolves to the name;
- Makefile.deepseek-v4 objects depend on route_trace.h.

Not wired, on purpose: per-row ROUTE_TRACE for V4. The amalgam builds
one object per COLI_V4_UNIT_*, so the header's statics have exactly one
owner (the hot-store unit) and the router lives in other units; rt_init
opens the stream, so when ROUTE_TRACE is set a one-line note says the
stream will hold no rows instead of silently suggesting it will.

Placement only: policy->usage, the pin ranking, the repin cadence and
every forward output are untouched; the private and shared formats agree
byte for byte, so existing V4 histories carry over.
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