rope_plan_golden compared kernel_args.corr_low/corr_high bit-for-bit, while the
corr_dims check right above already (correctly) treats NaN payload/sign as a libm
detail. For beta_slow=-1 the fixture, generated on arm64, holds 0x7fc00000, but
x86 SSE's default NaN is 0xffc00000, so the test failed on Linux x86_64. Compare
NaN-vs-NaN as equal for these two fields; all non-NaN bits stay exact.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Two table errors in the Original-literal physical layout, both invisible to
type and extent checks and both reached only on the GPU:
1. Layout::full_role mapped tail buffers 8, 9, 10 (hit_dst, parts, hit_slot)
to roles 34, 35, 36. Role 35 (hit_dst_) is 40 bytes and 36 (hit_count_) 16,
but tail 9 (the 102400-byte expert parts) and tail 10 (40 bytes) were
placed there, so FullOwned::handle returned InvalidSize for them and no
round or step program could be planned. Map them to 35, 31 (parts_), 34.
2. Layout::scalar mapped the attention hyper-connection injection (scalar 10)
to inj2_ (role 14), the very buffer the tail uses as the MLP half's
inject_out (tail 20). mlp_gr passes the attention inject as inj_prev and
the MLP inject as inject_out, so the fused GR kernels read and wrote the
same 4 floats concurrently. Map scalar 10 to inj_ (role 13), as Original.
Add pure tests (red before, green after) that every tail buffer fits its
role without overlap and that the scalar and tail views share only the
step/pos records, which Original shares too.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Driver::load resolves cuMemsetD8_v2 (the `zero` entry point) up front, but the
synthetic mock_cuda.c (also #included by the q5/q6/projection-family mocks)
never defined it, so every isolated CPU ELF gate died in Driver::load with
MissingSymbol("cuMemsetD8_v2") before reaching its protocol assertions. Add a
load-only stub (same policy as the existing cuMemcpyDtoD_v2 stub) and an opt-in
`run.sh --mocks` mode that builds the fake libraries and runs the mock_driver,
q5_mock and q6_mock matrices in the Linux container.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The Python-compatible `tojson` renderer (control-plane/src/prompt.rs, also
compiled into leleka-runtime) must reproduce json.dumps(json.loads(x)). Without
serde_json's float_roundtrip feature the default float parser is not correctly
rounded: 123456789012345680000.0 rendered as 1.2345678901234567e+20 instead of
Python's 1.2345678901234568e+20. The test only passed in whole-workspace builds
where leleka-context's dev-dependency happened to enable the feature; building
leleka-runtime alone failed. Enable the feature on both consumers.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The test mutated only quartet member [3].layer and expected IdentityMismatch, but
validate_descriptors (which runs first) rejects a quartet whose members disagree
on the layer with InvalidDimension. Cover both branches explicitly: a consistent
quartet at the wrong layer index -> IdentityMismatch, a split quartet ->
InvalidDimension.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
QwenStepTxn::commit folded "no logits/argmax was produced" into the generic
`_ => IdentityMismatch` arm of the output match when prefill-finish support was
added. The previous guard (and its test
full_forward_guard_refuses_skipped_layers_missing_logits_and_wrong_callback_token)
distinguished a skipped forward (Unsupported(Executor)) from a wrong callback
token (IdentityMismatch). Restore that classification; wrong tokens, and the
finish_prefill None path, are unchanged.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
leleka-cuda-driver, leleka-runtime and leleka-native-cpu-expert are gated on
linux/x86_64 and had only ever been type-checked with `cargo check --target`.
scripts/linux-tests/run.sh builds a linux/amd64 image from the toolchain pinned
in rust-toolchain.toml (Rosetta/qemu on Apple Silicon), mounts the repo read-only
with a persistent cargo cache and target volume, runs one `cargo test
--no-fail-fast` shard per crate and prints a pass/fail/ignored/time summary.
No GPU is used: #[ignore]d tests stay ignored and libcuda.so.1 is absent.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
open_regular lstat'ed then opened by path; a dense.txt/dense.bin/experts.bin
swapped for a symlink or FIFO between the two steps was followed (or blocked
the loader). The control-plane preflight already opens with these flags.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
prefix_commands (used by prepare_round and prepare_step, i.e. every draft)
required ring.slots == MTP_ORIGINAL_WINDOW / 4 == 8192. The ring that the
shared layout creates has (window + 4 * max_t + 64) / 4 = 8208 + max_t slots
(mtp.cpp: ring = window + 4 * max_t + 64 cells, 4 cells per slot), or 65536
for the fully-resident retry, so the check failed with InvalidQwenShape for
every configuration and no round or step graph could ever be prepared.
Accept exactly those two counts.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Resolves the window-producer and experimental-modes merges. The verifier
assembly now attaches the native projections, hyper-connection/PLE, QSA and
router/shared-expert operands (borrowed from the dense and MoE caches) to every
window graph and the commit graph; the asset probe also lists the unsealed
window kernels; auto selection refuses a configuration with an experimental mode.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
full_forward_weights handed OriginalMtpRetainedFullWeights::retain the roles
in the wrong order: slots 3..6 (read by mlp_gr as the MLP hyper-connection:
norm, down, up, inject) got the ATTENTION hyper-connection tensors, slots
12..14 (final mixer norm/down/up) got the MLP hyper-connection tensors, and
slots 8..10 (shared expert gate, up, down per record_forward) got
down, gate, up. The driver only checks byte extents and allows identical
aliases, and these tensors have equal sizes, so the permutation passed every
check and would run silently with the wrong weights: garbage drafts (zero
acceptance, only speed lost, never correctness). mlp_hyper_connection inject
and hyper_connection_mixer tensors were never used at all.
Pin the order in one table (FULL_FORWARD_ROLES) with a name-level test
against mtp.cpp record_forward.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The resident layers mint a fresh witness per roll-back; the session adopts
those objects so a layer and the session name one witness. Adds the opt-in
GPU smoke and docs/original-serve.md, and updates the stale claims in the
port-gaps ledger and the sampler/rope notes.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- QSA KV binding admits the serving index image size; kv addresses refuse until the resolver is reset
- GR shared-memory attributes only emitted for sm_70+
- docs/cuda-seal-plan-additions-window.json merges the new sources, bound pins and fast-math risk list
- ignored GPU smokes for asset load and shared opt-in
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
--backend-mode auto|original|preview (default auto; an --experimental-* flag
selects preview unless the mode is given), --original-prefill-capacity,
--mtp-rt-dir, --spec-min-p, parsed first at tuple boundaries. The two binaries
get the kar_expert_source initializer their runtime config already required.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Explicit Auto/Original/Preview selection (pure, over the asset probe that now
also lists the verifier window producers still unbound), the Original owner
loop with the preview loop's emission rules, and spawn_backend_original_serve.
The earlier stub factory becomes the explicit Original mode.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
OriginalServeStack opens every model-lifetime owner of the mode17 path and
serves a request as reset -> batched Original prefill -> verified-window
decode over a freshly assembled native Verifier, with the QSA owners handed
to and back from it. The per-request sequencing and failure classes are a
pure function over RequestOwners with fake-owner tests. The empty-prompt
checkpoints are re-stamped onto the current branch generation so a reset
stays possible after any abort.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
PlanOps drives the literal recorder through the pure planners with synthetic weights and
pins the launch order of GDN/QSA layers, post phase, split groups, head and PLE; fixes two
hand-derived expectations (mmvf block for 320 inputs is 160).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
OriginalVerifyWindowOps now records quantize/mmvq, hc read, final write, head mix +
captured head tail, PLE layer 1, the QSA K/V chain, router, shared expert, expert groups,
hit add and combine from the pure Planner; weight bindings per family, pre-capture asset
preload, fused-GR device decisions and dynamic-shared attributes; UNBOUND_PRODUCERS is
empty and unsealed assets are listed by name.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Window PLE rows, penalty-history sampling and the expert pool around
Verifier::run, resident QSA witness publication after the commit event,
literal draft_from_verifier over the published branch, MTP history/restore/drain,
end-of-phase recurrent state settlement. The port settles the commit before the
draft and tells the host when a commit is enqueued.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
K/V append, norm+RoPE, q/gate split, indexer paths, block scores+top-k, device-side KV
resolve, batched decode attention and the output gate (new fast-math source with a
placeholder PTX); pub(crate) address views on the mapped KV owner, resolver and QSA journal.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Native grouped expert gate/up and down kernels are a new source with a placeholder
PTX (UNSEALED) and a seal-plan fragment; everything else binds the sealed assets.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
hc_read (fused_gr_read_multi variants + down_chunk), final_write, per-token lm_head_mix
and the layer-1 PLE block, with the exact-size weight binding.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Two-phase session publication of a verified Original window (rows per round,
GDN/PLE once per phase), QSA owner handoff to and from the verifier, and
fail-closed guards while the recurrent state lags.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Port of serve/mcp.py: server config validation, background start, paged
tools/list, <server>__<tool> namespacing, error-as-text results with the
character cap, restart on demand, cancellation, GET /mcp. Tested against the
Original's fake MCP server. The server-side tool loop is intentionally not
ported (documented).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- original_serve_pool: OriginalServePool seam and the all-CPU CpuExpertPool over the pinned mapped
routed weights (the empty-plan tier of the verifier window); pure expert planning/scatter tested.
- original_serve_ledger: the host's committed-token mirror and window state machine (Idle/Open/
Committing, dirty flag for physical repair), free of device owners; unit tested.
- original_serve_config: RoPE constants, MTP scalar/full policies, sampler path, verifier geometry,
prefill arena carve (INT8 KV staging runs checked against the serving geometry) and expert blob sizes.
- InputStage::original_window_ple: the PLE input rows of a verifier window from the model's own provider.
- OriginalCommittedMtpReceipt::for_published_window and OriginalDraftSession::restore_current.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Six literal .cu ports get a pure admission/geometry module (every entry signature is
cross-checked against the .cu text), a Linux-gated driver facade, #[ignore]d GPU smokes
and zero-pin placeholder PTX. All modes are off by default; KAR's closed-launch ABI is
widened to 24 arguments with a 64-bit scalar.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
crates/context is taken verbatim from claude/port-rope (rope scaling incl. setup_resolve_rope/derived_factor, memory
plan, context policy). New setup_policy module: ram_ctx, ctx_ram_need, resident_budget_gib, low_ram_*; a golden grid
from 'import setup' (resolve_rope/derived_factor too, which the branch had only transcribed) checked bit for bit.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Pinned 31-entry SHA-256 table, 206 + exact Content-Range, retry-once on wrong bytes, inventory re-read on a revision
change, verified.json stamps. model::http_client is now shared. Tests port test_mtp_fetch.py onto a real local HTTP
mirror; scripts/offline/diff_mtp_fetch.py runs the unmodified Python against the same mirror (10 scenarios).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
leleka-serving-policy gains the Original's host-side vision and steering code: the SVE1
record reader and the (t,h,w) position table (compiled verbatim from generate.cpp for the
golden fixture), image sources, Python-compatible base64, the <|image_pad|> expansion of
Service.prepare, and the control-vector GGUF loader with its add/project tables (bit-exact
against the verbatim load_control_vectors). control-plane accepts engine.control_vector in
its config, preflights the files and passes the engine its arguments.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>