Skip to content

feat(st): COLI_MODEL_DIRS ΓÇö split model shards across N drives, no duplication (capacity aggregation; composable with #421 mirror)#469

Merged
JustVugg merged 1 commit into
JustVugg:devfrom
mohamedmastouri2000-boop:feat/model-dirs-split
Jul 20, 2026
Merged

feat(st): COLI_MODEL_DIRS ΓÇö split model shards across N drives, no duplication (capacity aggregation; composable with #421 mirror)#469
JustVugg merged 1 commit into
JustVugg:devfrom
mohamedmastouri2000-boop:feat/model-dirs-split

Conversation

@mohamedmastouri2000-boop

Copy link
Copy Markdown
Contributor

What

Per the green light in #467 (finding 4): COLI_MODEL_DIRS=<dir>[;<dir>...] — split the model's .safetensors shards across N drives with no duplication. Complementary to #421's mirror, not a competitor.

Why

The mirror gives 2× read bandwidth at 2× disk cost. The split gives capacity aggregation, which the mirror fundamentally can't: a 400 GB container fits across two smaller drives that individually can't hold it (or three, or N — ST_MAX_SHARDS is the only bound). Demand preads hit whichever drive holds the shard, so concurrent expert loads still parallelise across spindles when routing spreads.

Design

  • The dir list acts as a search path with dedup by basename: a shard present in two dirs is taken from the first-listed one (primary COLI_MODEL first). No layout convention imposed — any partition of the shards works; users move files between drives freely.
  • Each shard opens its own fd from its own path, exactly as today — the split needs no read-path changes at all: st_open_fd/pread/O_DIRECT twins/PIPE workers all work per-fd already. The whole feature is in indexing.
  • Composable with COLI_MODEL_MIRROR (the init-order ask from [Performance]: RTX 5080 / 128 GB resource matrix (drive x compute x RAM) ΓÇö RAM dominates; COLI_CUDA=0 Windows quirk; PR-ready N-drive shard split #467): st_mirror_init runs after indexing and matches per-shard by basename against the merged index, so a mirror dir may hold a copy of any subset of the split's shards — partial mirrors of a split are valid, divergent files are rejected per-file exactly as on a single-dir model. They cannot fight at init: split resolves which file is primary, mirror only ever adds a replica fd to an already-indexed shard.
  • Metadata (config.json, tokenizer, .coli_usage, .coli_kv) stays in the primary COLI_MODEL dir only — extra dirs are weights-only, never written.
  • st_init(S, dir) remains as a one-line back-compat wrapper over the new st_init_multi(S, dir, extra); every existing call site and test is untouched.
  • Startup logs the layout: [SPLIT] +C:\glm_split_b -> 70 shard(s) / [SPLIT] model across 2 dir(s): 142 shard(s) total (primary ... -> 72 shard(s)), no duplication.

Verification (RTX 5080 / Windows 11, g64 container, 142 shards, 399.8 GB)

Scope

+61/−10 over c/st.h (scan/dedup/init-multi), one call site in c/colibri.c (env read at model_init), docs/ENVIRONMENT.md row. No kernel, no read-path, no format changes. Happy to add a test_st_split.c sibling of test_st_mirror.c (dedup priority, partial-dir, missing-dir error) if you want one in-tree — say the word and I'll push it to this branch.

…plication

Each extra directory holds a DISTINCT subset of the .safetensors shards (search path, dedup by basename; first-listed dir wins). Demand preads hit whichever drive holds the shard, so concurrent expert loads parallelise across drives and combined capacity is used - a 400 GB container fits across two smaller drives that individually cannot hold it, which COLI_MODEL_MIRROR (a full second copy) cannot do. Composable with the mirror: st_mirror_init matches per-shard by basename against the merged index. st_init stays as a back-compat wrapper over st_init_multi. Verified on RTX 5080 / Windows: 72+70 shards across two NVMes, coherent output, [SPLIT] startup log, decode parity with single-drive at full RAM (0.92 vs 0.89-0.90).
@JustVugg
JustVugg merged commit e16ec68 into JustVugg:dev Jul 20, 2026
8 checks passed
BColsey added a commit to BColsey/colibri that referenced this pull request Jul 21, 2026
Retarget PR JustVugg#377 onto current dev (origin/dev @ 4aca059) after JustVugg#391 split
glm.c into colibri.c + quant.h/sample.h/kv_persist.h/telemetry.h. Reconciles
four collisions:

- JustVugg#391 split: all glm.c hunks resited -- prof_*/g_prof_io/ProfBase live in
  colibri.c (NOT telemetry.h); tiers_emit/emap_emit -> telemetry.h (with a
  rammap_slot forward-decl); st_fd_is_tmpfs/st_fd_fs_magic -> st.h; .coli_kv
  state-dir -> serve_ctx_init/run_serve/run_serve_mux + main.
- DISK-CLASS (1f00142): prof_physical_read_bytes/ProfPhysicalWire merged ON
  TOP of dev's dc_* fields; PROF protocol line extended 9->17 fields
  additively; expert_load_impl 6-arg `demand` signature preserved; g_prof_io
  routed through prof_ssd_tensor_bytes (tmpfs-excluded).
- DUAL-SSD mirror (JustVugg#298/JustVugg#469): ESlot.backing hand-merged with dev's
  aslab/afslab; map_of_fd exact-length + MADV_HUGEPAGE composes with rep_bfd.
- int3 fmt=5 (JustVugg#168): rammap_bind_one reuses dev's qt_resolve_fmt/detect_group_size
  (inline fmt-detection dropped; duplicate detect_group_size not re-added).

Verified: make colibri 0 warnings; make check 187 tests pass (test_uring skips
in sandboxes via the PR's helpers; test_rammap builds against colibri.c and
passes). Default path byte-identical -- oracle-safe by construction.

Co-Authored-By: Claude <noreply@anthropic.com>
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.

2 participants