Files
leleka/PORT-GAPS-MODE17.md
Pavlo Ratushnyi 056ab3d689 Retire the oracles, generators and scripts that only worked against the vendored Strata tree (STRA-406)
The vendored Strata tree engine/strata is removed for good (owner decision 2026-11-23): Leleka never builds or runs it, the vanilla
benchmark builds from its own checkout, the comparison measurements are finished and the CUDA ports are frozen. Everything below
compiled or read that tree, so it cannot run without it and is retired (the tree stays in git history, see third_party/strata/UPSTREAM.md).
Checked-in fixtures, golden JSON, sealed PTX, seal plans and MANIFEST hashes are untouched and keep being replayed by the cargo tests.

Drift guard
- crates/experimental-ref/tests/literal_port.rs: include_str! of the Original .cu files compared with the checked-in experimental ports.

Oracle generators and builders (they compile or extract from the Strata C++/Python sources; their outputs are the checked-in goldens)
- crates/experimental-ref/oracle/gen_{cvec,kv,remote,stream}_golden.{cpp,sh}, gen_seal_additions.py and the cuda_runtime stub they used
- crates/sampler-ref/oracle/build_oracle.sh, gen_fixtures.cpp, gen_sampling_keys.py, stub/ (run_port_host_tests.sh and the fixtures stay)
- crates/serving-policy/oracle/ (build_oracle.sh, gen_{host,cvec,vision}_fixtures.cpp)
- crates/context/tests/rope_plan_golden/gen_* (plan, rope, kv pool)
- crates/engine-core/src/conversation/golden/gen*.{sh,cpp} and stub/
- crates/cuda-driver/oracle/gen_prefill_ring_trace.py and drivers/prefill_ring_trace.cpp (extracted prefill.cpp), check_cu_syntax.sh
- crates/engine-qwen35-cuda/tests/stra161_reference/reference.py (fixtures.json and the Rust constants stay)
- control-plane/tests/golden/gen_goldens.py, scripts/offline/ (Python differentials and golden generators against the Strata Python tools)

Source-compiling CUDA oracles and builders
- scripts/build-cuda-{projection-family,q5,q6,qsa}-oracle.sh with scripts/cuda-{projection-family,q5,q6,qsa}-oracle/ (include the Original .cu; sha256 pins of them)
- scripts/build-original-verify-ptx.sh, scripts/q8/rebuild_quantizer_ptx.sh, scripts/decode-sm120/make_iq_prefix.py (needs engine/strata/include)
- scripts/cuda-stubs/ (check-cu.py and literal_diff.py need the strata headers and the Original sources; the stub headers served only them)
- tools/chain-probe/build.sh, tools/kernel-ab/{cpp,aa.sh,smoke.sh,time_smoke.sh} (the C++ comparator is built from the Strata CPU kernels; verify_manifest.py stays)
- scripts/e2e/codex/speed/verify-hc-down-kernel-microbench-vs-upstream/ (compiles the upstream kernel from the tree)

Engine builds and Python smokes that need the tree
- scripts/build-cpu.sh, scripts/build-static-cuda.sh, scripts/check-keyless-gpu.sh, scripts/test-static-cuda-profile.py (CMake of engine/strata)
- scripts/compare-real-tokenizer.py, scripts/smoke-mtp-pack.py (reads src/core/mtp.cpp and a bench manifest), scripts/prepare-keyless-routing.py and its test
- scripts/smoke-native-pack.py became scripts/native-pack-fixture.py: the synthetic GGUF fixtures the four other smokes import stay, the iq_pack.py oracle comparison goes

Gates and CI
- scripts/check-local.sh: no live Python oracle differentials, no literal_port note, no check-cu, no build-cpu, no retired test scripts
- .github/workflows/linux.yml: the keyless-cuda, static-cuda-package and hosted-cuda-package jobs (they built the engine from the tree) and their dispatch
  inputs, and the two oracle smoke steps; .github/workflows/port.yml: the Python oracle environment and the llama.cpp fetch of port-oracles
  (the sampler host shim still runs)
- limits.json and scripts/check_limits_test.py exclude third_party/strata/ instead of engine/strata/

Documentation and comments: README.md names third_party/strata and the pin; deploy/README.md marks the retired build and smoke commands; comments
in Rust, Python and Markdown that named engine/strata/... now name "Strata 41cf05a0, ..."; the gpu-bringup scratch-copy test no longer copies the
removed include directories. Stale engine/strata paths in sealed .cu, .ptx, seal-plan and MANIFEST files are left as they are (hashes may depend on the bytes).
2026-11-23 21:19:11 +01:00

67 lines
8.9 KiB
Markdown

# Mode17 MTP / NativeHead / Verifier source gaps
Read-only snapshot, 2026-10-12. Audit artifact only; no builds, tests, GPU,
Strata, model or daemon execution. Paths below are relative to this source-port
tree or to the Strata tree that was imported (removed, see `third_party/strata/UPSTREAM.md`). Root integration remains mutable.
This is a bounded core-path ledger, not a whole-project completion certificate.
## Actionable remaining boundaries
| Original source / function | Current Rust boundary | Required completion |
| --- | --- | --- |
| `src/core/mtp.cpp:143` `MtpDrafter::load`; `:380` `bind`; `:677` `kv_restore`; `include/strata/core/mtp.hpp` `idle/device/tensor_*` | SOURCE-COMPLETE, NOT GPU-RUN (2026-10-14, branch `claude/port-mtp-loader`). `original_mtp_rt.rs` reads dense.txt/dense.bin/experts.bin/draft_vocab.bin; `original_mtp_bank.rs` places them (Original order, nine-name check last); `original_mtp_loader.rs` plans geometry/session/KV/coupled and admits the retained ring; `original_mtp_draft_head.rs` gathers the subset head; `original_mtp_actor_loaded.rs` adopts the genuine drafter and links `idle/device/kv_restore/set_*/draft*/coupled`. Runtime: `RetainedOriginalMtpWeights::from_rt_bank`, `OriginalMtpFullOwner::assemble_rt`, `OriginalPromptExecutor::select_rt_mtp` and the actor-driven `draft_committed_mtp`/`draft_first_committed_mtp`. | Remaining is GPU-only evidence: run the ignored `original_mtp_bank_gpu` tests (`LELEKA_MTP_RT_BANK_GPU=yes`), a real-pack load, and compare drafts with the Original. `OriginalServeStack::open` (`qwen_forward/original_serve_stack.rs`) now calls `select_rt_mtp` (option `--mtp-rt-dir`) or the pinned-pack assembly, and the serve loop drives `draft_committed_mtp` (`OriginalServeHost::draft_committed`); `draft_first` stays CLI-only (the serve loop never reaches it). Not repeated: Original `cudaMemset(cring_, 0xff)`; the Original single-allocation `dense_` (each indexed tensor is its own allocation, same total bytes); `tensor_f32/bf16/q8` host accessors (roles are the retained `Rc<DeviceBuffer>` bank). |
| `src/core/verify.cpp:405` `record_window`, `:925` `capture`, `:988` `capture_commit`, `:1054` `run` | `original_verify.rs:235` defines `OriginalVerifyGraphResources`; `original_verify_schedule.rs` owns real streams/graphs/doorbells and accepts a caller recording closure. The concrete aggregate is `OriginalVerifyWindowResources` (`original_verify_window_ops.rs`). | `OriginalVerifyWindowOps` now has capture-time producers for every former `UNBOUND_PRODUCERS` entry (pure planners over SHA-pinned sealed PTX: projections/head, GR, GDN, QSA, MoE; unit-tested against verify.cpp order). Still open: seal `original_verify_window_moe_experts.ptx` and `original_verify_window_qsa_gate.ptx` (`crates/cuda-driver/seal-plans/cuda-seal-plan-additions-window.json`; the window fails closed with those names until then), GPU smokes/golden comparisons per kernel and for a whole window, the fast-math re-seal question listed in that JSON, and the hardware run. The runtime-side wiring (weights, QSA/PLE journals, CPU pool callbacks, graph registration before `run`) is SOURCE-WIRED, NOT GPU-RUN on `claude/port-serve-host`: `original_serve_verifier::assemble` builds the canonical GDN image, the QSA journal over the prompt executor's twelve resident owners, the PLE history and the window/commit aggregates per decode phase; `original_serve_pool` is the CPU callback (all-CPU expert tier: the driver publishes the empty plan). The asset probe (`original_serve_asset_status`) lists the unsealed assets and any producer still unbound, so `--backend-mode auto` stays on the preview path until they are sealed and `original` refuses naming them. |
| `mtp.cpp` `draft/draft_first` and `verify.cpp` `run/commit/wait_commit`, used together by mode17 generation | SOURCE-WIRED, NOT GPU-RUN. `OriginalServeEngine` implements `OriginalSpecEngine` over `NativeServePort`, which binds the driver `OriginalVerifier`; `OriginalServeHost` (`original_serve_host.rs`) supplies the owners (window PLE rows, penalty-history sampling, expert pool, lineage ledger, session publication of the accepted prefix, MTP history/restore/drain) and `OriginalServeStack` drives prompt + decode. `OriginalServeSettings::controller` is called by the stack; `--backend-mode` selects it in the serving owner. Commit and draft are serialized (the commit event completes and the session is published before the draft launches), so the Original's commit/draft overlap is not reproduced. | Hardware run of `backend_original_serve_smoke.rs` (`LELEKA_ORIGINAL_SERVE_SMOKE=yes`), then parity and a keep-the-overlap pass. |
| `include/strata/core/verify.hpp` `set_stage/set_next`; `src/core/verify.cpp:191,1054,1382,1412`; `core/on_device.hpp` | `OriginalVerifier` loops all 48 layers, has no next-stage owner or stage handoff fields. Context identity exists, but the unselected MTP actor cannot infer an actual current CUDA device ordinal. | Port stage bounds, mapped portable R+pending-bo+inject handoff, next-user CPU dispatch and last-stage head/sampling/final_R/commit forwarding. This is an absent multi-GPU mode17 leaf, not a single-device quality defect. |
| `verify.cpp:137,158,899,1323,1422` public release/diag/profile/logprob/logit APIs | Internal Rust bounded wait release, commit event and completed-row bridge are present. No equivalent public diagnostic/watchdog registry, profile report, window_logprobs or copy_logits API was found in the inspected Original Rust modules. | Expose the actual live verifier release/diagnostic owner; port literal GPU-stage stamps and completed logit/logprob readout (including LOGPOS_TOPK). Keep capture-only graphs inadmissible for readout. Do not call the existing internal release absent. |
## Existing source that must not be reported missing
- `native_head.rs` / `output_native.rs` retain unchanged head weights and real
mapped/fallback embedding, T1..8 head rows, request sampling/history and MTP
head-weight loans. `model-format/src/gguf_native_head.rs` has shard/architecture
and `strata-embd` override parsing. The owners are bound by `OriginalServeStack`/`OriginalServeHost`
(see spec node original-serve.md); the remaining gap is the unbound window producers and the GPU run.
- NativeHead's earlier penalties-off empty-history refusal is already corrected
in current `native_head.rs:140..158`; do not reopen that stale finding.
- Verifier GDN/QSA accepted-prefix journals, stream release and async commit event
are real implementations; the missing piece is their complete window resource
adapter and serving use, not fake reimplementation of those owners.
- `original_session_state.rs` implements physical carve/primary RoPE registration
and release. This audit does not certify every optional `session.cpp` graph,
replay sweep or loop frontend as ported.
## Sealing status, not an arithmetic gap
`original_serve_assets.rs` reports which compiled assets are unsealed in a build; the serving backend reads it.
Thirty assets were compiled with nvcc 13.2.86 and sealed on 2026-10-15 (pins patched in Rust, including
`native_head.rs` NATIVE/IQ/SAMPLER_ASSET, `original_verify.rs` ASSET/QSA_ASSET and both new window sources
`original_verify_window_moe_experts` / `original_verify_window_qsa_gate`). The unit tests assert the sealed state
(pin = length + sha256 of the checked-in PTX, real sm_120, every named entry exported) and that corrupted synthetic
copies are still refused. Loading on a GPU is verified separately by the host smokes. Sealing is a structural and
provenance fact only: it is not a numerical acceptance result. Six PTX files remain placeholders
(`mmq_original_group_{fixup,mul,swiglu}`, `mtp_original_scalar_{gr,norm}`, `native_parity`); constructors that need
them still refuse and the MTP scalar/full leaves still check for them.
## Observed source pins
Original imported upstream: `d9ab8435f654c368c586340d490915f6addf56a3`.
SHA256:
- `core/mtp.cpp`: `71d8a93f6edc18916a5df9954cba372833f3cfd4efd952e2aedaed089a8d3fb4`
- `core/native_head.cpp`: `e4c7865002ad5a22b797c055c0780956469b8128b47bc03529e469a7c93e82c6`
- `core/verify.cpp`: `b5af6d947a4c2afbfd66db7a7dab0282e8fbf9ab8b58227f5e0f2ea502f8a0dd`
- `core/session.cpp`: `1e3a979614dae1910924e592ae1e2190afd8c6eb14438d7fdba5886ea034de18`
Rust pins below are the read-time snapshot, not a seal of Root's entire tree.
No runtime trace or hardware parity is inferred from these source reads.
- `original_mtp_actor.rs`: `803343141b4540fc1a6294d5f72ccea27d8f39f10b356f56285306f6862b3e8a`
- `original_mtp_loader.rs`: `40d89efb3da51bdfd854999d00828518869a43c352cfb716c612d612bd7e6267`
- `original_verify.rs`: `4fdf15d8d1070bccd4ae7617e2caf35137a605e9cea2843b36fa9a9f4023e85f`
- `original_verify_schedule.rs`: `ad8c2e457f66bd9f60a75b4ba7257684e13b76813c1e5a6815213414fb3b32e8`
- `native_head.rs`: `3f39fd575336a232d609c8a3f968f222b819e75603b36ccd0fbaf533d5d43a4d`
- `original_spec_controller.rs`: `04c50717e0f0cd34af9116c2e2977acb7c8b7145e674dd5c8880617d517f5df3`
- `original_spec_draft.rs`: `fce64b72b628201f1d3f61b4ff21a92b1d32f5f3352642fa9b4bc0d2561c8572`