refactor: split glm.c → colibri.c + 4 header modules (−18%)#391
Merged
Conversation
Merged
Owner
|
Sequencing note after v1.0.0 shipped: this refactor is wanted, but it's a 78-file rename+split that conflicts with everything in flight — merging it now would invalidate the rebase we just requested on #399 (the KV-quant series, which predates today's dev movement in the exact code this PR relocates). Proposed order: #399 lands first (it's semantically hard, this PR is mechanically hard — rebasing mechanics over semantics is the cheaper direction), then this gets a fresh rebase in a quiet window and goes in as the only open change touching the core. We'll ping you when the runway is clear — apologies for the wait, and thanks for the patience. |
Rename glm.c → colibri.c and extract four self-contained modules into header-only files (same pattern as st.h/tier.h/grammar.h): quant.h (672 lines) — SIMD matmul kernels, quantization sample.h (143 lines) — RNG, top-p sampling, stop-set kv_persist.h (121 lines) — .coli_kv disk persistence telemetry.h (189 lines) — dashboard protocol, stats, usage Main engine file shrinks from 6588 to 5396 lines (−18%). Build system: primary target is now colibri$(EXE); `make glm` remains as a phony alias for backward compat. CI, setup.sh, coli CLI, and all 10 test files that include the engine are updated. make check passes (C + Python, 73 tests, zero warnings).
New files: README.zh-CN.md — simplified Chinese (大陆用词) README.it.md — Italian (the project's "mother tongue") All four READMEs now link to each other in a consistent nav bar. Updated zh-TW to reflect glm.c → colibri.c rename and new headers.
Lightweight i18n without react-i18next: a LocaleProvider context +
useLocale() hook with {{var}} interpolation, auto-detect from
navigator.language, persisted to localStorage.
98 translation keys across 4 locale files (en/zh-CN/zh-TW/it).
All user-visible strings in App/Brain/Profiling/ErrorBoundary are
now t() calls. Language switcher added to the sidebar footer.
Build clean (tsc + vite), 18 tests pass.
ZacharyZcR
force-pushed
the
refactor/split-colibri
branch
from
July 19, 2026 13:12
a1badb0 to
93b4a8e
Compare
This was referenced Jul 19, 2026
Open
JustVugg
pushed a commit
that referenced
this pull request
Jul 19, 2026
…d onto #391 split) Re-derivation of e7/disk-class-instr @ de6dd6d (base caa49f7) onto origin/dev @ 61004dc, after PR #391 split c/glm.c into c/colibri.c plus quant.h/sample.h/kv_persist.h/telemetry.h/grammar.h. Semantic equivalence, not a copy: same events, same accounting, re-sited onto the new tree. Placement: colibri.c, unchanged from before the split. telemetry.h (#391) is the dashboard/stats module (HWINFO/TIERS/EMAP/HITS protocol lines + usage persistence) — prof_report(), expert_load_impl(), moe(), g_prof_io and g_edisk_ns all stayed in colibri.c, so DISK-CLASS's aggregation and printing follow them there. No relocation needed, no DEVIATION. Read path: #362 (prefetcher-v3, 22509fc) turned out to be testbed-only scope per its own merge message ("glm.c untouched") — confirmed zero c/glm.c changes in that merge's diff. The seven expert_load() call sites this patch touches (pipe_worker, expert_host_ensure, moe()'s OMP miss loop, pilot_realload, repin_pass_limit, pin_load x2) are structurally identical to the pre-split tree; the demand flag re-attaches at the same sites with the same semantics (1 only at moe()'s own PIPE/OMP miss path, 0 everywhere else), so DISK-CLASS still counts demand loads only. One real drift, unrelated to #362: #417 (cfcc742) fixed the exact "Metal pre-routed FASE A never bumps the real elast/eaccess_clock" defect this feature's comments described as a documented, deliberately-unfixed upstream issue — the real clock now ticks in FASE A too. The private elast_dc/eaccess_clock_dc clock is kept anyway: its job was never only to route around that freeze, it also snapshots pre-bump state so a call's own routing bump can't contaminate its own classification, and keeping DISK-CLASS's bookkeeping fully separate from stock elast state is what makes "byte-identical with PROF=0" provable by construction instead of by argument. Code comments referencing the old defect are updated to reflect the fix (historical note + #417/cfcc742 pointer) rather than describing a bug that no longer exists. Gates: make glm METAL=0 and METAL=1 both clean, zero warnings (matches stock 61004dc, also built clean with zero warnings for comparison). make test-c: 0 failures. make test-python: 77 tests, OK. Authored by Fable 5 in Claude Code, analysis in partnership with @monotophic. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
glm.c→colibri.c(the project is called colibrì, not glm)st.h/tier.h/grammar.hpattern:quant.hsample.hkv_persist.h.coli_kvon-disk KV cache persistencetelemetry.hmake colibriis the new primary target;make glmkept as a phony aliassetup.sh,coliCLI, and all 10 test files updatedmake checkpasses: C + Python, 73 tests, zero warningsMotivation
The 6.6k-line single file was the #1 barrier to review and community contribution — every PR touching the engine conflicted with every other. This is the first split pass, targeting the four cleanest modules (lowest coupling). The remaining ~5.4k lines (MoE dispatch, attention, expert I/O, serve protocol, main) are candidates for a follow-up once this lands.
Test plan
make colibri— zero errors, zero warnings (Linux, CPU)make check— 73 tests pass (C unit + Python)make glm— backward-compat alias works