llama : add bounded routed expert store - #4
Conversation
Adapt the positional I/O and cache reservation design from ggml-org#25294, with lease-based in-flight safety informed by ggml-org#27861. Assisted-by: GPT-5.6 Sol Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Stop aligned reads once the complete expert payload is available and make buffered fallback explicit opt-in so page-cache growth cannot bypass the production memory budget. Assisted-by: GPT-5.6 Sol Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Report direct I/O unavailable until the Windows file path supports FILE_FLAG_NO_BUFFERING, and cover strict failure plus explicit buffered opt-in. Assisted-by: GPT-5.6 Sol Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Strix Linux focused validation completed at exact head Host: Fedora Linux 44, kernel This executes the Linux-only final-expert/non-aligned-EOF O_DIRECT regression. The new Windows policy is fail closed: |
|
CI follow-up: the Windows job passed, including the new Windows fail-closed regression. Ubuntu was retried once and failed again in unrelated server tests: Hugging Face returned HTTP 429 for |
Merge the current schema branch and preserve the expert-store source registration in the new core source list. Assisted-by: GPT-5.6 Sol Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Stack repair completed with normal merge commit Post-merge validation:
No Strix job was restarted; all validation was local. |
|
Post-restack Windows CI failure is unrelated to this PR. Run No expert-store product or test code is implicated. Per review direction, no code change was made and no retry is queued. |
Merge the updated schema support branch with the normal-RoPE classification needed by the shared model loader. Assisted-by: GPT-5.6 Sol Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Merged the updated schema support branch normally. The named remote branch resolves to New expert-store head: Post-merge local validation passed:
No Strix work was performed. |
Merge the current schema support branch before final expert-store review and validation. Assisted-by: GPT-5.6 Sol Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Load contexts that cross disk-owned holes without mmap, discard copied source pages where supported, preserve mlock for safe mapped spans, and make lease publication allocation-safe. Assisted-by: GPT-5.6 Sol Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use random file advice when disk-owned tensor ranges are excluded so Linux readahead cannot cross into the expert corpus. Assisted-by: GPT-5.6 Sol Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep lazy-table prefetch behavior unchanged, but give external routed tensors a strict policy that disables positive prefetch ranges on every platform. Assisted-by: GPT-5.6 Sol Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Throw before mmap when POSIX_FADV_RANDOM cannot be applied to an external-hole file. Keep legacy sequential advice warning-only and cover both paths through an injectable constructor seam. This successor binds corrective commits 9b53142 and c1a00d2, including c1 tree 56460c3. Assisted-by: GPT-5.6 Sol Copilot-Session: 6df503f4-c9eb-436d-a324-e8c5f8cabed9 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
3089e0a
into
jeromecoste-microsoft-deepseek-v41-support
Overview
Add the bounded routed-expert SSD store/cache core for the DeepSeek V4.1 stack tracked by halo-box#48.
cache_bytesFILE_FLAG_NO_BUFFERINGis implemented, so the production default fails closed instead of claiming bounded cached CRT readsThis is stacked on halo-box#49 at current head
65fdc19831d30b12f06b981c3ca74dd18731f90e. The repaired base, normal-RoPE classification, and KV A norm correction were merged normally into this branch. This PR must be retargeted tomasterafter ggml-org#49 merges.Measurements
No throughput claim is made. This PR does not alter
build_moe_ffn(), execute a model graph, upload experts to ROCm, or load the published 365 GB payload.Published-GGUF header accounting is covered as a model-free test vector:
The later runtime admission layer must derive these values from metadata. It must account for graph/state, process baseline, I/O buffers, and safety margin rather than selecting 256 slots from expert bytes alone.
Correctness:
test-expert-storetest-deepseek41-schematest-llama-archstest-ggufAll passed in a CPU-only local build.
After merging repaired schema head
ea7793dba3497a95ab2516e7bf36f15846b5bd4b, the same targeted tests passed again. The fulltest-llama-archssweep passed in a CPU-only build; the focuseddeepseek41invocation also passed with the expected schema-only skips.After merging the follow-up normal-RoPE classification at
6a473b7e942a2cc54f1e5bb2b2d5deacd247b888,test-expert-store,test-deepseek41-schema,test-gguf, the full CPU-onlytest-llama-archssweep, and diff checks passed again.At candidate head
f8d537e3642eb03539c5e840a929e86a76dde134, the same packet passed after the KV A norm correction and boundedness fixes. This provenance-only descendant has the same source tree as fail-closed corrective commit8805ae2d415e2ecc155a105659a9d49072550807.test-expert-storealso passed with AddressSanitizer and UndefinedBehaviorSanitizer enabled. Independent review found five issues: unsafe contexts now load without mmap and discard copied source pages where supported, safe retained mmap spans preserve mlock without crossing punched holes, lease publication performs all throwing allocations before pin ownership is visible, files with external holes use random file advice with no positive prefetch ranges, and a failure to apply the strict random policy now fails before mmap instead of continuing with kernel-default readahead.test-expert-storecovers exact slice offsets and native bytes, published IQ2_XXS/Q2_K plane sizing, direct-I/O alignment, actual reads above 32-bit offsets, truncated files, invalid IDs/types/strides/bounds, byte and slot limits, deterministic eviction, repeated IDs, multi-token unions, slot remapping, pin/unpin behavior, payload validation, and the absence of full external-tensor allocation. It also includes a Linux regression for a final expert plane ending at an unaligned file tail: the aligned read stops as soon as the complete payload is present and must remain on the direct descriptor.The focused Linux test also passed on the Strix host at exact head
a8364460999b94ac2ef52cf28bd1d0d4c925eef2:This ran on Fedora Linux 44, kernel
7.2.4-200.fc44.x86_64, without opening any model payload.Additional information
The positional I/O and cache reservation design is adapted from ggml-org#25294, primarily commit
4260e460832f5e95c41d8b6d8b2aea98007df524. Lease lifetime and delayed publication safety are informed by ggml-org#27861 commitbccbacdb8945680f1cfc7e6bffd1e59014705750.Fallback policy: production callers leave
direct_io=trueandallow_buffered_io=false, so an unavailable or failing direct descriptor returns an explicit error and cannot grow the page cache outside the configured expert-cache budget. Model-free and non-Linux tests may explicitly setallow_buffered_io=true; that mode logs the fallback and does not claim a host-wide memory bound.Files containing external tensor holes are not prefetched. A backend context whose normal tensor span crosses a hole loads its resident tensors through bounded staging rather than copying from the mapping, and drops the copied source ranges from the filesystem cache where the platform supports
POSIX_FADV_DONTNEED. Safe mmap-backed spans remain eligible for mlock; lazy mappings remain unlocked so they are not faulted into RAM.On Linux, external-hole mappings use
POSIX_FADV_RANDOMinstead of file-widePOSIX_FADV_SEQUENTIAL. The strict external policy also produces noPOSIX_MADV_WILLNEEDor platform-equivalent positive prefetch ranges. The regression covers first, middle, adjacent, boundary-misaligned, and last excluded ranges plus repeated policy evaluation. Existing lazy-table prefetch behavior remains unchanged.The Linux failure-path regression injects a
posix_fadviseerror into the real mapping constructor. Strict external mode throws before the constructor can continue to mmap, while the legacy sequential path remains warning-only and successfully maps the same model-free temporary file.Independent exact-head review approved
f8d537e3642eb03539c5e840a929e86a76dde134with no blocking correctness, resource-bound, direct-I/O, mmap-residency, cache, pin/lease-lifetime, or cross-platform findings.Windows currently uses cached CRT I/O in
llama_file.has_direct_io()therefore reports false there, strict production construction fails explicitly, and the Windows regression verifies both that failure and the explicit non-bounded buffered opt-in. This PR does not add aFILE_FLAG_NO_BUFFERINGimplementation.This PR intentionally does not port the upstream graph remap or waved-prefill implementation. Upstream testing retracted bit-exact parity for long multi-wave generations because changed accumulation order can diverge. A later integration must:
Engram disk rows remain owned by the separate Engram PR and are not changed here.
Requirements