Drop the stale engine/strata paths and retired generator names from comments, doc strings and generated fixtures (STRA-407)

Rust comments that named scripts/offline/*, gen_goldens.py, oracle/gen_*.{sh,cpp,py}, build_oracle.sh and similar retired generators now say where the data
came from (the Original's code, Strata 41cf05a0) or drop the sentence. The path/generator text of seven generated fixtures (sampler_oracle.json, sampling_keys.json,
memory_plan_golden.json, rope_golden.json, cvec_oracle.json, stra161 fixtures.json, commentary-tool-prompt.json) is reworded; no test reads those fields and no pin
covers their bytes. cmd_time/doc.rs: the two path texts in the format string; its lines are re-broken so they stay within 120 columns (the string is unchanged
otherwise). Comment-only except those data/string spots; no behaviour change.
This commit is contained in:
Pavlo Ratushnyi
2026-11-23 22:37:17 +01:00
parent a4afb2a182
commit da8c974f68
50 changed files with 64 additions and 67 deletions
@@ -1,5 +1,5 @@
{ {
"provenance": "Pinned engine/strata/serve/chat_template.jinja rendered with Jinja2 3.1.6; sanitized fixture", "provenance": "Pinned third_party/strata/serve/chat_template.jinja rendered with Jinja2 3.1.6; sanitized fixture",
"request": { "request": {
"model": "strata-local", "model": "strata-local",
"reasoning": { "reasoning": {
+2 -2
View File
@@ -35,7 +35,7 @@ fn single_commands(action: &str, rest: &[String]) -> Outcome {
fn batch_commands(action: &str, rest: &[String]) -> Outcome { fn batch_commands(action: &str, rest: &[String]) -> Outcome {
match (action, rest) { match (action, rest) {
// Batch forms for the differential harness (scripts/offline/diff_tokenizer.py): one JSON value per line. // Batch forms for the differential harness: one JSON value per line.
("pre-tokenize-batch", []) => Some(pre_tokenize_batch()), ("pre-tokenize-batch", []) => Some(pre_tokenize_batch()),
("tokenize-batch", [path, flags_rest @ ..]) if flags_rest.iter().all(|flag| flag == "--special") => { ("tokenize-batch", [path, flags_rest @ ..]) if flags_rest.iter().all(|flag| flag == "--special") => {
Some(tokenize_batch(path, !flags_rest.is_empty())) Some(tokenize_batch(path, !flags_rest.is_empty()))
@@ -122,7 +122,7 @@ fn request_kwargs(request: &Json) -> Vec<(&str, Json)> {
} }
/// JSON lines {"messages": [...], "tools": [...]|null, "add_generation_prompt": true, "kwargs": {...}} -> /// JSON lines {"messages": [...], "tools": [...]|null, "add_generation_prompt": true, "kwargs": {...}} ->
/// {"ok": "<prompt>"} or {"error": "<message>"}: the pinned chat template, for scripts/offline/diff_chat_template.py. /// {"ok": "<prompt>"} or {"error": "<message>"}: the pinned chat template.
fn render_chat() -> Result<(), BoxError> { fn render_chat() -> Result<(), BoxError> {
for line in std::io::stdin().lines() { for line in std::io::stdin().lines() {
let request: Json = serde_json::from_str(&line?)?; let request: Json = serde_json::from_str(&line?)?;
+1 -1
View File
@@ -65,7 +65,7 @@ fn the_native_ple_key_encodings_are_the_originals() {
} }
/// Numpy (`astype(float16)`) and gguf-py (`BF16.quantize_blocks`) answers for 4096 f32 bit patterns, from /// Numpy (`astype(float16)`) and gguf-py (`BF16.quantize_blocks`) answers for 4096 f32 bit patterns, from
/// `scripts/offline/gen_goldens.py`. The packer's F32 -> F16 / BF16 helpers must match bit for bit. /// the Original's offline tooling (Strata 41cf05a0). The packer's F32 -> F16 / BF16 helpers must match bit for bit.
#[test] #[test]
fn f16_and_bf16_rounding_match_numpy_and_gguf_py() { fn f16_and_bf16_rounding_match_numpy_and_gguf_py() {
let vectors = include_bytes!("../../tests/fixtures/offline/f16_bf16_vectors.golden"); let vectors = include_bytes!("../../tests/fixtures/offline/f16_bf16_vectors.golden");
+1 -1
View File
@@ -2,7 +2,7 @@
//! that is not an inference API: `GET /props`, `GET /slots`, `GET /v1/status`, `GET /api/health`, //! that is not an inference API: `GET /props`, `GET /slots`, `GET /v1/status`, `GET /api/health`,
//! `GET|POST /settings`, `POST /load`, `POST /unload`, `POST /v1/load`, `POST /v1/unload`, CORS and //! `GET|POST /settings`, `POST /load`, `POST /unload`, `POST /v1/load`, `POST /v1/unload`, CORS and
//! the own-page guard. Behaviour is checked against the real Python handlers in //! the own-page guard. Behaviour is checked against the real Python handlers in
//! `tests/http_surface.rs` (fixtures from `tests/golden/gen_goldens.py http`). //! `tests/http_surface.rs` (fixtures recorded from the Original's Python server).
//! //!
//! One engine at a time: `total_slots` is 1 and `/slots` lists one slot while the engine is loaded. //! One engine at a time: `total_slots` is 1 and `/slots` lists one slot while the engine is loaded.
+1 -1
View File
@@ -184,7 +184,7 @@ mod tests {
} }
/// Every GEN/GENI line equals what the Original's `StrataEngine.generate` writes to the pipe /// Every GEN/GENI line equals what the Original's `StrataEngine.generate` writes to the pipe
/// (fixture from `tests/golden/gen_goldens.py`, which runs that real code with a fake pipe). /// (fixture recorded by running that real code with a fake pipe).
#[test] #[test]
fn gen_lines_equal_the_python_servers_for_every_sampling_key() { fn gen_lines_equal_the_python_servers_for_every_sampling_key() {
let fixture: serde_json::Value = let fixture: serde_json::Value =
+1 -2
View File
@@ -1,10 +1,9 @@
//! The native Jinja renderer against the Python server's `ChatTemplate` (jinja2) on generated conversations. //! The native Jinja renderer against the Python server's `ChatTemplate` (jinja2) on generated conversations.
//! //!
//! `tests/fixtures/offline/chat_template_oracle.json` comes from `scripts/offline/gen_goldens.py chat_template_oracle`: //! `tests/fixtures/offline/chat_template_oracle.json` was recorded from the Original's Python code (Strata 41cf05a0):
//! 90 renders (every role incl. developer and tool, list content with image/video parts, assistant `tool_calls` //! 90 renders (every role incl. developer and tool, list content with image/video parts, assistant `tool_calls`
//! with mapping arguments, tools, `enable_thinking` / `reasoning_effort` / `preserve_thinking`, no generation //! with mapping arguments, tools, `enable_thinking` / `reasoning_effort` / `preserve_thinking`, no generation
//! prompt) and 25 conversations the template refuses, with the exact `raise_exception` message. //! prompt) and 25 conversations the template refuses, with the exact `raise_exception` message.
//! `scripts/offline/diff_chat_template.py` runs the same generator live over thousands of cases.
use leleka_control_plane::prompt::{ChatInput, Json, pinned}; use leleka_control_plane::prompt::{ChatInput, Json, pinned};
use serde::Deserialize; use serde::Deserialize;
+2 -2
View File
@@ -1,8 +1,8 @@
//! Dequantization versus the pinned gguf-py (`quants.dequantize`, llama.cpp 3cf03257) and `tools/iq_fixture.py`. //! Dequantization versus the pinned gguf-py (`quants.dequantize`, llama.cpp 3cf03257) and `tools/iq_fixture.py`.
//! //!
//! `tests/fixtures/offline/dequant_oracle.json` holds one seeded 256-value row of each of 23 block types and the //! `tests/fixtures/offline/dequant_oracle.json` holds one seeded 256-value row of each of 23 block types and the
//! oracle's float32 bits (`scripts/offline/gen_goldens.py dequant_oracle`; `scripts/offline/diff_dequant.py` runs //! oracle's float32 bits (recorded from the Original's Python code, Strata 41cf05a0). The production
//! 32 rows x 3 seeds live). The production visitor (`gguf_f32_stream::visit`: independent Rust decoders where they //! visitor (`gguf_f32_stream::visit`: independent Rust decoders where they
//! exist, the pinned ggml C bridge otherwise) must reproduce every float bit for bit. Q8_K has no gguf-py //! exist, the pinned ggml C bridge otherwise) must reproduce every float bit for bit. Q8_K has no gguf-py
//! dequantizer; its reference is `d * qs`. //! dequantizer; its reference is `d * qs`.
use leleka_control_plane::{gguf, gguf_f32_stream}; use leleka_control_plane::{gguf, gguf_f32_stream};
@@ -1,10 +1,9 @@
//! GGUF header reader versus `Strata 41cf05a0, tools/gguf_reader.py`. //! GGUF header reader versus `Strata 41cf05a0, tools/gguf_reader.py`.
//! //!
//! `tests/fixtures/offline/gguf_headers.json` is generated by `scripts/offline/gen_goldens.py` from the unmodified //! `tests/fixtures/offline/gguf_headers.json` was recorded offline from the unmodified
//! Python reader: random GGUF v3 headers (all 13 metadata value types, arrays, unicode, alignment, split keys, //! Python reader: random GGUF v3 headers (all 13 metadata value types, arrays, unicode, alignment, split keys,
//! 1-4 dimensional tensors of every block geometry) with the metadata and tensor directory it parses from each, and //! 1-4 dimensional tensors of every block geometry) with the metadata and tensor directory it parses from each, and
//! its `BLOCK_GEOMETRY` table. The live differential over thousands of files is //! its `BLOCK_GEOMETRY` table.
//! `scripts/offline/diff_gguf_header.py`.
use leleka_control_plane::{gguf, gguf_json}; use leleka_control_plane::{gguf, gguf_json};
use serde_json::Value; use serde_json::Value;
use std::{fs, path::PathBuf}; use std::{fs, path::PathBuf};
+1 -1
View File
@@ -2,7 +2,7 @@
//! The operational HTTP surface (`/props`, `/slots`, `/settings`, `/load`, `/unload`, `/v1/load`, //! The operational HTTP surface (`/props`, `/slots`, `/settings`, `/load`, `/unload`, `/v1/load`,
//! `/v1/unload`, `/v1/status`, `/api/health`, CORS, own-page guard) against the real Python //! `/v1/unload`, `/v1/status`, `/api/health`, CORS, own-page guard) against the real Python
//! handlers: every scenario in `tests/fixtures/golden/http_surface.json` was recorded from //! handlers: every scenario in `tests/fixtures/golden/http_surface.json` was recorded from
//! `Strata 41cf05a0, serve/server.py` by `tests/golden/gen_goldens.py http`, and is replayed here //! `Strata 41cf05a0, serve/server.py`, and is replayed here
//! against the Rust router with a real worker supervisor and the mock engine. //! against the Rust router with a real worker supervisor and the mock engine.
//! //!
//! Deliberate differences, skipped in the comparison: the chat template text, the build/version //! Deliberate differences, skipped in the comparison: the chat template text, the build/version
@@ -1,7 +1,7 @@
//! The reasoning-budget logic against the Python server's `Service.reasoning_budget` and `Service.run` (#123). //! The reasoning-budget logic against the Python server's `Service.reasoning_budget` and `Service.run` (#123).
//! //!
//! `tests/fixtures/offline/reasoning_budget_oracle.json` comes from `scripts/offline/gen_goldens.py //! `tests/fixtures/offline/reasoning_budget_oracle.json` was recorded from the Original's Python
//! reasoning_budget_oracle`: 247 budget lookups (request and configured values of every JSON type, with the message //! code (Strata 41cf05a0): 247 budget lookups (request and configured values of every JSON type, with the message
//! of the 400) and 400 generations of the unmodified `Service.run` over a scripted engine and a byte-level toy //! of the 400) and 400 generations of the unmodified `Service.run` over a scripted engine and a byte-level toy
//! vocabulary, recording each engine call (prompt, max_new), the finish reason, the completion tokens and the text //! vocabulary, recording each engine call (prompt, max_new), the finish reason, the completion tokens and the text
//! the output parser was fed. //! the output parser was fed.
+1 -1
View File
@@ -4,7 +4,7 @@
//! (`derived_factor`, `setup_resolve_rope`); this module holds the rest: which contexts the RAM allows //! (`derived_factor`, `setup_resolve_rope`); this module holds the rest: which contexts the RAM allows
//! ([`ram_ctx`], [`ctx_ram_need`]), how many GiB of experts to keep resident ([`resident_budget_gib`]) and the //! ([`ram_ctx`], [`ctx_ram_need`]), how many GiB of experts to keep resident ([`resident_budget_gib`]) and the
//! low-RAM mode's arithmetic (`low_ram_*`). Every function is checked against `import setup` over a grid by //! low-RAM mode's arithmetic (`low_ram_*`). Every function is checked against `import setup` over a grid by
//! `tests/setup_policy_oracle.rs` (golden from `scripts/offline/gen_goldens.py setup_policy`). //! `tests/setup_policy_oracle.rs` (golden recorded from the Original's `setup.py`).
//! //!
//! Floating point is IEEE double on both sides, evaluated in the same order; Python's `round()` is round-half-even //! Floating point is IEEE double on both sides, evaluated in the same order; Python's `round()` is round-half-even
//! (`f64::round_ties_even`). //! (`f64::round_ties_even`).
+1 -1
View File
@@ -1,5 +1,5 @@
//! Golden tests for `rope_scaling` and `memory_plan` against fixtures produced by the ORIGINAL's host code //! Golden tests for `rope_scaling` and `memory_plan` against fixtures produced by the ORIGINAL's host code
//! (see `rope_plan_golden/gen_rope_golden.sh` and `gen_plan_golden.sh`; clang++ on macOS, arm64). //! (clang++ on macOS, arm64).
//! //!
//! Rope: the C++ side links `rope_scaling.hpp` unmodified and the two `build_rope_table` definitions extracted //! Rope: the C++ side links `rope_scaling.hpp` unmodified and the two `build_rope_table` definitions extracted
//! verbatim from `rope.cu`, compiled `-O2 -ffp-contract=off`. Tables are checked bit-for-bit through FNV-1a 64 //! verbatim from `rope.cu`, compiled `-O2 -ffp-contract=off`. Tables are checked bit-for-bit through FNV-1a 64
@@ -1,5 +1,5 @@
{ {
"generator": "strata-plan built from engine/strata/src/plan/plan_main.cpp (unmodified) + extracted layer.cpp kv_pool_bytes", "generator": "strata-plan built from Strata 41cf05a0, src/plan/plan_main.cpp (unmodified) + extracted layer.cpp kv_pool_bytes",
"state_bytes_default": 117669888, "state_bytes_default": 117669888,
"cli": [ "cli": [
{ {
@@ -1,5 +1,5 @@
{ {
"generator": "gen_rope_golden.cpp over rope_scaling.hpp + rope.cu build_rope_table (verbatim)", "generator": "host build over rope_scaling.hpp + rope.cu build_rope_table (verbatim)",
"cases": [ "cases": [
{ {
"name": "none_default", "desc": "default-constructed RopeScaling (today's engine)", "n_rot": 64, "name": "none_default", "desc": "default-constructed RopeScaling (today's engine)", "n_rot": 64,
+1 -1
View File
@@ -1,5 +1,5 @@
//! `setup.py` sizing rules versus `import setup` (the unmodified oracle), over the grid in //! `setup.py` sizing rules versus `import setup` (the unmodified oracle), over the grid in
//! `tests/fixtures/setup_policy_oracle.json` (`scripts/offline/gen_goldens.py setup_policy`). Floats are compared //! `tests/fixtures/setup_policy_oracle.json`. Floats are compared
//! bit for bit. //! bit for bit.
use leleka_context::{ use leleka_context::{
rope_scaling::{RopeScalingType, derived_factor, setup_resolve_rope}, rope_scaling::{RopeScalingType, derived_factor, setup_resolve_rope},
@@ -33,7 +33,7 @@ pub(in super::super) fn all_window_assets() -> Vec<&'static AssetSpec> {
} }
/// The kernel assets that are placeholders or fail their SHA-256 pin (none while every window PTX is the one /// The kernel assets that are placeholders or fail their SHA-256 pin (none while every window PTX is the one
/// sealed with nvcc 13.2.86 on 2026-10-15): a window cannot be recorded while any is listed /// sealed with nvcc 13.2.86 on 2026-10-15): a window cannot be recorded while any is listed
/// (`scripts/build-original-verify-ptx.sh`, `crates/cuda-driver/seal-plans/cuda-seal-plan-additions-window.json`). /// (`crates/cuda-driver/seal-plans/cuda-seal-plan-additions-window.json`).
pub fn unsealed_window_assets() -> Vec<&'static str> { pub fn unsealed_window_assets() -> Vec<&'static str> {
unsealed_keys(all_window_assets()) unsealed_keys(all_window_assets())
} }
@@ -9,7 +9,7 @@
//! runtime executor have an executable specification of the order they must reproduce, and //! runtime executor have an executable specification of the order they must reproduce, and
//! * a ring/event simulator ([`check_trace`]) proves slot reuse safety and the absence of waits on events that //! * a ring/event simulator ([`check_trace`]) proves slot reuse safety and the absence of waits on events that
//! have not been recorded. //! have not been recorded.
//! Golden traces come from `oracle/gen_prefill_ring_trace.py`, which EXTRACTS the Original's scheduling code //! Golden traces come from an offline run that EXTRACTS the Original's scheduling code
//! verbatim (sequence builder, issue/give-back lambdas, stage_one, the walks, the PLE block, the fusion line) into a //! verbatim (sequence builder, issue/give-back lambdas, stage_one, the walks, the PLE block, the fusion line) into a
//! host harness with logging cuda stubs; `tests::*golden*` replays every scenario and compares text lines. //! host harness with logging cuda stubs; `tests::*golden*` replays every scenario and compares text lines.
//! //!
@@ -1,5 +1,5 @@
//! Differential tests against fixtures produced by compiling the ORIGINAL //! Differential tests against fixtures produced by compiling the ORIGINAL
//! C++ headers (`golden/gen_cache_golden.cpp`, rebuilt by `golden/gen.sh`): //! C++ headers:
//! random buffer/eviction/meminfo/admission cases and long cache operation //! random buffer/eviction/meminfo/admission cases and long cache operation
//! traces. Every observable of the C++ run is compared to this port. //! traces. Every observable of the C++ run is compared to this port.
@@ -1,5 +1,5 @@
//! Differential test of [`ConversationManager`] against the conversation //! Differential test of [`ConversationManager`] against the conversation
//! block of `generate.cpp` (transliterated in `golden/gen_manager_golden.cpp` //! block of `generate.cpp` (transliterated into a host program
//! over the real C++ cache, eviction policy and memory admission): 28 random //! over the real C++ cache, eviction policy and memory admission): 28 random
//! serving traces of 30 requests each, with parking budgets, memory telemetry, //! serving traces of 30 requests each, with parking budgets, memory telemetry,
//! steering flips, cancelled prompts, invalid parked images and the //! steering flips, cancelled prompts, invalid parked images and the
@@ -4,7 +4,7 @@
use super::{ConversationCheckpoint, ConversationKv, SavedConversation}; use super::{ConversationCheckpoint, ConversationKv, SavedConversation};
// --------------------------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------------------------
// Differential tests against the ORIGINAL C++ (golden/gen_state_golden.cpp). // Differential tests against the ORIGINAL C++ (Strata 41cf05a0 host build).
pub(super) fn golden_state() -> serde_json::Value { pub(super) fn golden_state() -> serde_json::Value {
serde_json::from_str(include_str!("../golden/state_golden.json")).expect("state golden parses") serde_json::from_str(include_str!("../golden/state_golden.json")).expect("state golden parses")
@@ -1,5 +1,5 @@
// Independent original-source literals frozen before STRA161 candidate. // Independent original-source literals frozen before STRA161 candidate.
// Generated offline by stra161_reference/reference.py; imports no candidate. // Generated offline from the Original's source; imports no candidate.
#![allow(dead_code)] #![allow(dead_code)]
pub struct HashCase { pub struct HashCase {
pub name: &'static str, pub name: &'static str,
@@ -2,11 +2,11 @@
"schema": "stra161-independent-reference-v1", "schema": "stra161-independent-reference-v1",
"provenance": "Original source and preexisting independent PLE literal vectors, no candidate imports", "provenance": "Original source and preexisting independent PLE literal vectors, no candidate imports",
"sources": { "sources": {
"engine/strata/src/kernels/ngram.cpp": "111c0ef89403af9d4a7ab2ce45bd5fc95291fca326be46e83652b2fba65bead0", "Strata 41cf05a0, src/kernels/ngram.cpp": "111c0ef89403af9d4a7ab2ce45bd5fc95291fca326be46e83652b2fba65bead0",
"engine/strata/src/kernels/ple_oracle_vectors.inc": "81db49806af4a3c8d333cb00ad0353a322b61f34f62e96a1eaffe4b782611fd3", "Strata 41cf05a0, src/kernels/ple_oracle_vectors.inc": "81db49806af4a3c8d333cb00ad0353a322b61f34f62e96a1eaffe4b782611fd3",
"crates/model-format/src/qwen4exp.rs": "8b3361c89c197a8c98baff83505e2158f17362be622bc2b39c77b5589d34d120", "crates/model-format/src/qwen4exp.rs": "8b3361c89c197a8c98baff83505e2158f17362be622bc2b39c77b5589d34d120",
"engine/strata/src/kernels/cuda/ple.cu": "afcd6efac591acf6c7ff95d8c756a782cfa6dbb4490146f924cb32a55d9d6262", "Strata 41cf05a0, src/kernels/cuda/ple.cu": "afcd6efac591acf6c7ff95d8c756a782cfa6dbb4490146f924cb32a55d9d6262",
"engine/strata/src/kernels/cuda/native_ple_postops.cu": "91849f4257d6ee9c85b1dc04cb16397963eac51d725aa31575e63c8f0d0f56f4" "Strata 41cf05a0, src/kernels/cuda/native_ple_postops.cu": "91849f4257d6ee9c85b1dc04cb16397963eac51d725aa31575e63c8f0d0f56f4"
}, },
"multipliers": [ "multipliers": [
23703573157769, 23703573157769,
+1 -1
View File
@@ -114,7 +114,7 @@ fn write_artifact(m: &Model, matrix_value: f32) -> Vec<u8> {
for v in [1u32, m.g.qsa_layers.len() as u32, m.g.n_head, m.g.head_dim] { for v in [1u32, m.g.qsa_layers.len() as u32, m.g.n_head, m.g.head_dim] {
out.extend_from_slice(&v.to_le_bytes()); out.extend_from_slice(&v.to_le_bytes());
} }
// layout of scripts/prepare-keyless-routing.py: "<8s4I", then per layer "<I", 3 x "<IQQ", f32 matrices // layout of the keyless routing file: "<8s4I", then per layer "<I", 3 x "<IQQ", f32 matrices
for layer in &m.g.qsa_layers { for layer in &m.g.qsa_layers {
out.extend_from_slice(&layer.to_le_bytes()); out.extend_from_slice(&layer.to_le_bytes());
for role in ["q", "k", "v"] { for role in ["q", "k", "v"] {
+1 -1
View File
@@ -1,5 +1,5 @@
//! Control-vector loading against `load_control_vectors` of `generate.cpp` (extracted verbatim, run on synthetic //! Control-vector loading against `load_control_vectors` of `generate.cpp` (extracted verbatim, run on synthetic
//! control-vector GGUF files by `oracle/gen_cvec_golden.sh`). //! control-vector GGUF files on the host).
mod common; mod common;
+1 -1
View File
@@ -1,5 +1,5 @@
//! Golden tests: the Rust references against fixtures produced by the Original's own host code //! Golden tests: the Rust references against fixtures produced by the Original's own host code
//! (`oracle/gen_kv_golden.sh`; the reference functions are extracted verbatim from Strata 41cf05a0). //! (the reference functions are extracted verbatim from Strata 41cf05a0).
use leleka_experimental_ref::{ use leleka_experimental_ref::{
fwht, kv_q8, fwht, kv_q8,
@@ -1,4 +1,4 @@
//! The second-GPU expert tier against the Original's decision code (`oracle/gen_remote_golden.sh` extracts the //! The second-GPU expert tier against the Original's decision code (the golden host build extracts the
//! selection, slot sizing, claim bookkeeping, grouping, RemoteMeta packing and result scatter of //! selection, slot sizing, claim bookkeeping, grouping, RemoteMeta packing and result scatter of
//! `remote_experts.cpp` verbatim and runs them on the host). //! `remote_experts.cpp` verbatim and runs them on the host).
+1 -1
View File
@@ -1,4 +1,4 @@
//! The KV streaming planner against `layer.cpp`'s own functions (`oracle/gen_stream_golden.sh` extracts them //! The KV streaming planner against `layer.cpp`'s own functions (the golden host build extracts them
//! verbatim and drives them over a grid of formats, contexts, rings and `--kv-resident` values). //! verbatim and drives them over a grid of formats, contexts, rings and `--kv-resident` values).
mod common; mod common;
+1 -2
View File
@@ -4,8 +4,7 @@
//! Unsloth's developer-role and tool fixes) is rendered with `minijinja`, configured like the Python server's //! Unsloth's developer-role and tool fixes) is rendered with `minijinja`, configured like the Python server's
//! `ChatTemplate` (`serve/frontend.py`): `trim_blocks` and `lstrip_blocks`, no autoescape, Python-style string //! `ChatTemplate` (`serve/frontend.py`): `trim_blocks` and `lstrip_blocks`, no autoescape, Python-style string
//! methods, a `raise_exception` global, and Python-compatible `tojson` and `trim` filters. All ten cases of //! methods, a `raise_exception` global, and Python-compatible `tojson` and `trim` filters. All ten cases of
//! `serve/chat_golden.json` render byte for byte; `scripts/offline/diff_chat_template.py` compares the two renderers //! `serve/chat_golden.json` render byte for byte.
//! over generated conversations.
//! //!
//! * [`Renderer`] renders any template source with arbitrary JSON messages, tools and keyword arguments //! * [`Renderer`] renders any template source with arbitrary JSON messages, tools and keyword arguments
//! ([`ChatInput`]); [`pinned`] is the compiled default. //! ([`ChatInput`]); [`pinned`] is the compiled default.
+1 -1
View File
@@ -289,7 +289,7 @@ fn assert_turns_kept() {
/// Strata 0.1.50 `ChatTemplate.render` (#843): completed empty assistant turns are not rendered, the final message /// Strata 0.1.50 `ChatTemplate.render` (#843): completed empty assistant turns are not rendered, the final message
/// is kept whatever it is, and a reasoning content does not keep a turn. The expectation is the unmodified /// is kept whatever it is, and a reasoning content does not keep a turn. The expectation is the unmodified
/// `serve/frontend.py`'s (`scripts/offline/diff_chat_template.py` runs the same comparison over thousands of /// `serve/frontend.py`'s (the same comparison was run offline over thousands of
/// generated conversations). /// generated conversations).
#[test] #[test]
fn completed_empty_assistant_turns_are_not_rendered() { fn completed_empty_assistant_turns_are_not_rendered() {
@@ -150,10 +150,11 @@ impl TimeDoc<'_> {
fn clock_json(&self) -> String { fn clock_json(&self) -> String {
format!( format!(
" \"clock_calibration\": {{\"method\": {}, \"source\": \"engine/strata/src/kernels/cpu/tq_cpu_parity.cpp \ " \"clock_calibration\": {{\"method\": {}, \"source\": \"Strata 41cf05a0, \
--bench: core_ghz() lines 273-284, time_slice() lines 290-304; the dependent-add chain needs inline \ src/kernels/cpu/tq_cpu_parity.cpp --bench: core_ghz() lines 273-284, time_slice() lines 290-304; the \
assembly, so the safe Rust twin chains multiplies\", \"drop_rule\": {{\"source_file\": \ dependent-add chain needs inline assembly, so the safe Rust twin chains multiplies\", \"drop_rule\": \
\"engine/strata/src/kernels/cpu/tq_cpu_parity.cpp\", \"source_line\": 303, \"source_text\": \"std::fabs(g1 \ {{\"source_file\": \"Strata 41cf05a0, src/kernels/cpu/tq_cpu_parity.cpp\", \"source_line\": 303, \
\"source_text\": \"std::fabs(g1 \
- g0) > 0.05 * g0\", \"fraction\": {}, \"meaning\": \"a slice whose calibrated clock moved by more than 5 \ - g0) > 0.05 * g0\", \"fraction\": {}, \"meaning\": \"a slice whose calibrated clock moved by more than 5 \
percent between its before and after calibration is dropped\"}}, \"slice_ms_source\": \ percent between its before and after calibration is dropped\"}}, \"slice_ms_source\": \
\"tq_cpu_parity.cpp:461 slice_ms = quick ? 40 : 60\", \"ghz_at_start\": {}, \"ghz_at_end\": {}, \ \"tq_cpu_parity.cpp:461 slice_ms = quick ? 40 : 60\", \"ghz_at_start\": {}, \"ghz_at_end\": {}, \
+2 -2
View File
@@ -8,8 +8,8 @@
//! | `make_profile` | `tools/make_profile.py` | `STRP` v1 expert-cache profile | //! | `make_profile` | `tools/make_profile.py` | `STRP` v1 expert-cache profile |
//! | `mtp_rt` | `tools/mtp_rt.py` | MTP `experts.bin`, `dense.bin`, `dense.txt` | //! | `mtp_rt` | `tools/mtp_rt.py` | MTP `experts.bin`, `dense.bin`, `dense.txt` |
//! //!
//! Differential harness: `scripts/offline/diff_tools.py` runs each oracle and the matching `leleka-api tools` //! Differential harness (run offline): each oracle and the matching `leleka-api tools`
//! subcommand on synthetic inputs and compares every output byte. Offline conversion only; production serving //! subcommand run on synthetic inputs and every output byte is compared. Offline conversion only; production serving
//! never links this crate's CLI paths into a request path. //! never links this crate's CLI paths into a request path.
pub mod cli; pub mod cli;
+2 -2
View File
@@ -1,8 +1,8 @@
//! The ported tools against the Python originals' exact outputs. //! The ported tools against the Python originals' exact outputs.
//! //!
//! `tests/fixtures/tools_oracle.json` is written by `scripts/offline/gen_goldens.py tools_oracle`, which runs the //! `tests/fixtures/tools_oracle.json` was recorded by running the
//! unmodified `Strata 41cf05a0, tools/{embd_bf16_pack,ple_fp8_pack,draft_vocab,make_profile,mtp_rt}.py` on tiny //! unmodified `Strata 41cf05a0, tools/{embd_bf16_pack,ple_fp8_pack,draft_vocab,make_profile,mtp_rt}.py` on tiny
//! synthetic inputs. `scripts/offline/diff_tools.py` is the live differential over more cases. //! synthetic inputs.
use std::{ use std::{
fs, fs,
path::{Path, PathBuf}, path::{Path, PathBuf},
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
"meta":{"generator":"crates/sampler-ref/oracle/gen_fixtures.cpp","oracle":"Original engine/strata sampler_parity.cpp host reference, included unmodified; sampler.hpp + coupled_draft.hpp headers","compile":"-std=c++17 -O1 -ffp-contract=off -fno-fast-math","encoding":"floats are IEEE-754 binary32 bit patterns (u32)"}, "meta":{"generator":"host build of the Original's sampler (Strata 41cf05a0)","oracle":"Original sampler_parity.cpp host reference (Strata 41cf05a0), included unmodified; sampler.hpp + coupled_draft.hpp headers","compile":"-std=c++17 -O1 -ffp-contract=off -fno-fast-math","encoding":"floats are IEEE-754 binary32 bit patterns (u32)"},
"philox":[ "philox":[
[0,0,1064655353], [0,0,1064655353],
[0,1,1050774260], [0,1,1050774260],
+1 -1
View File
@@ -1,4 +1,4 @@
{"meta":{"generator": "crates/sampler-ref/oracle/gen_sampling_keys.py", "oracle": "engine/strata/serve/server.py StrataEngine.sampling_keys"}, {"meta":{"generator": "StrataEngine.sampling_keys lifted verbatim", "oracle": "Strata 41cf05a0, serve/server.py StrataEngine.sampling_keys"},
"cases":[ "cases":[
{"request": {}, "keys": ""}, {"request": {}, "keys": ""},
{"request": {"temperature": 0.0}, "keys": ""}, {"request": {"temperature": 0.0}, "keys": ""},
+1 -1
View File
@@ -1,6 +1,6 @@
//! `RequestSampling::gen_keys` against the strings the Original's Python //! `RequestSampling::gen_keys` against the strings the Original's Python
//! `StrataEngine.sampling_keys` emits (fixture produced by //! `StrataEngine.sampling_keys` emits (fixture produced by
//! `oracle/gen_sampling_keys.py`, which lifts that function verbatim). //! lifting that function verbatim).
use leleka_sampler_ref::params::{RequestSampling, SamplingParams}; use leleka_sampler_ref::params::{RequestSampling, SamplingParams};
use serde_json::Value; use serde_json::Value;
+1 -1
View File
@@ -1,5 +1,5 @@
//! The Rust reference against golden fixtures produced by the Original's host //! The Rust reference against golden fixtures produced by the Original's host
//! sampler logic (see `oracle/gen_fixtures.cpp`). Floats travel as binary32 bit //! sampler logic. Floats travel as binary32 bit
//! patterns, so every comparison here is bitwise on the integer/RNG side and on //! patterns, so every comparison here is bitwise on the integer/RNG side and on
//! the selected list; picks follow from them. //! the selected list; picks follow from them.
+1 -1
View File
@@ -4,7 +4,7 @@
//! //!
//! This is the host side: reading the files and building the `dir` / `s` tables the kernel //! This is the host side: reading the files and building the `dir` / `s` tables the kernel
//! uploads. The tables are bit-exact against the Original's loader (golden fixture compiled from //! uploads. The tables are bit-exact against the Original's loader (golden fixture compiled from
//! the verbatim function, `oracle/gen_cvec_fixtures.cpp`). The device side //! the verbatim function). The device side
//! (`h <- h + d` / `h <- h - s (h.v) v`) is a kernel and stays with the engine. //! (`h <- h + d` / `h <- h - s (h.v) v`) is a kernel and stays with the engine.
//! //!
//! * `add`: `d_l` = sum over files of `scale * direction.<l>`; the table row is `d_l`, `s_l = 1`. //! * `add`: `d_l` = sum over files of `scale * direction.<l>`; the table row is `d_l`, `s_l = 1`.
+1 -1
View File
@@ -2,7 +2,7 @@
//! host-side parts of `src/program/generate.cpp`). No I/O, no async runtime, no `unsafe`. //! host-side parts of `src/program/generate.cpp`). No I/O, no async runtime, no `unsafe`.
//! //!
//! Each module cites the Original code it transcribes and is tested against fixtures produced by running //! Each module cites the Original code it transcribes and is tested against fixtures produced by running
//! that code (see `control-plane/tests/golden/gen_goldens.py` and `oracle/`). //! that code offline from Strata 41cf05a0.
pub mod cors; pub mod cors;
pub mod cvec; pub mod cvec;
+1 -1
View File
@@ -4,7 +4,7 @@
//! //!
//! * [`parse_embeddings`] and [`build_positions`] are transcriptions of the verbatim block of //! * [`parse_embeddings`] and [`build_positions`] are transcriptions of the verbatim block of
//! `generate.cpp` (`if (geni || !mrope_identity)`), golden-tested against that block compiled on //! `generate.cpp` (`if (geni || !mrope_identity)`), golden-tested against that block compiled on
//! the host (`oracle/gen_vision_fixtures.cpp`). //! the host.
//! * Qwen's interleaved M-RoPE gives each rotated pair a position from one of three streams (time //! * Qwen's interleaved M-RoPE gives each rotated pair a position from one of three streams (time
//! `t`, height `h`, width `w`): text has `t = h = w`, an image's tokens share `t = p` and differ in //! `t`, height `h`, width `w`): text has `t = h = w`, an image's tokens share `t = p` and differ in
//! `h = p + y`, `w = p + x`, and the text after it continues at `p + max(nx, ny)`. //! `h = p + y`, `w = p + x`, and the text after it continues at `p + max(nx, ny)`.
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,5 +1,5 @@
//! The control-vector loader against the Original's `load_control_vectors` compiled verbatim on the host //! The control-vector loader against the Original's `load_control_vectors` compiled verbatim on the host
//! (fixture from `oracle/build_oracle.sh`): same tables bit for bit, same error text. //! (fixture recorded from that build): same tables bit for bit, same error text.
use leleka_serving_policy::cvec::{Mode, Options, build_tables, parse_gguf}; use leleka_serving_policy::cvec::{Mode, Options, build_tables, parse_gguf};
use serde_json::Value; use serde_json::Value;
+1 -1
View File
@@ -1,5 +1,5 @@
//! Stride selection and the stall watchdog against the Original's C++ host build //! Stride selection and the stall watchdog against the Original's C++ host build
//! (fixture from `oracle/build_oracle.sh`: `logits_selection.hpp` unmodified, the watchdog loop driven //! (fixture recorded from that build: `logits_selection.hpp` unmodified, the watchdog loop driven
//! by an injected clock). //! by an injected clock).
use leleka_serving_policy::stride::{parse_stride, row_count, selected}; use leleka_serving_policy::stride::{parse_stride, row_count, selected};
@@ -1,5 +1,5 @@
//! `BudgetTracker` and `parse_budget` against the Original's real `Detokenizer` + `OutputParser` loop and //! `BudgetTracker` and `parse_budget` against the Original's real `Detokenizer` + `OutputParser` loop and
//! `Service.reasoning_budget` (fixture from `control-plane/tests/golden/gen_goldens.py reasoning`). //! `Service.reasoning_budget` (fixture recorded from the Original's Python code).
use leleka_serving_policy::reasoning::{BudgetTracker, Verdict, WRAP_UP, parse_budget}; use leleka_serving_policy::reasoning::{BudgetTracker, Verdict, WRAP_UP, parse_budget};
use serde_json::Value; use serde_json::Value;
+1 -1
View File
@@ -1,5 +1,5 @@
//! `clean_shared_defaults` / `sampling_defaults_from_config` against the Original's real Python output //! `clean_shared_defaults` / `sampling_defaults_from_config` against the Original's real Python output
//! (fixture from `control-plane/tests/golden/gen_goldens.py shared`). //! (fixture recorded from the Original's Python code).
use leleka_serving_policy::shared::{ConfigSampling, clean_shared_defaults, sampling_defaults_from_config}; use leleka_serving_policy::shared::{ConfigSampling, clean_shared_defaults, sampling_defaults_from_config};
use serde_json::{Value, json}; use serde_json::{Value, json};
@@ -1,5 +1,5 @@
//! `request_timings` and `Service.set_aliases` against the Original's real Python //! `request_timings` and `Service.set_aliases` against the Original's real Python
//! (fixture from `control-plane/tests/golden/gen_goldens.py timings`). //! (fixture recorded from the Original's Python code).
use leleka_serving_policy::shared::normalize_aliases; use leleka_serving_policy::shared::normalize_aliases;
use leleka_serving_policy::timings::{Last, request_timings}; use leleka_serving_policy::timings::{Last, request_timings};
+2 -2
View File
@@ -1,6 +1,6 @@
//! The image path against the Original: the SVE1 reader and M-RoPE table against the verbatim C++ block //! The image path against the Original: the SVE1 reader and M-RoPE table against the verbatim C++ block
//! (`oracle/build_oracle.sh`), image sources, base64 and the pad expansion against the real Python //! (recorded host build), image sources, base64 and the pad expansion against the real Python
//! (`control-plane/tests/golden/gen_goldens.py vision`). //! code (recorded fixtures).
use leleka_serving_policy::vision::{ use leleka_serving_policy::vision::{
IMAGE_PAD_ID, ImageKey, Positions, b64decode, build_positions, expand_image_pads, identity_table, image_source, IMAGE_PAD_ID, ImageKey, Positions, b64decode, build_positions, expand_image_pads, identity_table, image_source,
+1 -1
View File
@@ -36,7 +36,7 @@ pub const QWEN35_PATTERN: &str = concat!(
type Result<T> = std::result::Result<T, Box<dyn Error>>; type Result<T> = std::result::Result<T, Box<dyn Error>>;
/// The `qwen35` pre-tokenizer alone: the pieces `text` is split into before byte-level BPE. Exposed so the split can /// The `qwen35` pre-tokenizer alone: the pieces `text` is split into before byte-level BPE. Exposed so the split can
/// be compared with Python's `regex` for every Unicode scalar value (scripts/offline/diff_tokenizer.py). /// be compared with Python's `regex` for every Unicode scalar value.
pub fn pre_tokenize(text: &str) -> Result<Vec<&str>> { pub fn pre_tokenize(text: &str) -> Result<Vec<&str>> {
static PATTERN: std::sync::OnceLock<Regex> = std::sync::OnceLock::new(); static PATTERN: std::sync::OnceLock<Regex> = std::sync::OnceLock::new();
let pattern = match PATTERN.get() { let pattern = match PATTERN.get() {
@@ -1,11 +1,10 @@
//! Tokenizer versus `Strata 41cf05a0, tools/strata_tokenizer.py` (the unmodified oracle, regex 2026.9.10). //! Tokenizer versus `Strata 41cf05a0, tools/strata_tokenizer.py` (the unmodified oracle, regex 2026.9.10).
//! //!
//! `tests/fixtures/tokenizer_oracle.json` is produced by `scripts/offline/gen_goldens.py tokenizer_oracle`: a //! `tests/fixtures/tokenizer_oracle.json` was recorded from the Original's Python code: a
//! synthetic byte-level BPE vocabulary (256-byte alphabet, 300 trained merges that reach past the 64-symbol heap //! synthetic byte-level BPE vocabulary (256-byte alphabet, 300 trained merges that reach past the 64-symbol heap
//! path, type-3 and type-4 specials including ones with regex metacharacters) and the oracle's answers for ~190 //! path, type-3 and type-4 specials including ones with regex metacharacters) and the oracle's answers for ~190
//! boundary and fuzzed texts (ids with and without special parsing, decoded text, pre-tokenizer pieces) plus the //! boundary and fuzzed texts (ids with and without special parsing, decoded text, pre-tokenizer pieces) plus the
//! pre-tokenizer split of sampled Unicode scalar values in five contexts. //! pre-tokenizer split of sampled Unicode scalar values in five contexts.
//! `scripts/offline/diff_tokenizer.py` runs the exhaustive live version (every scalar value x 13 contexts).
use leleka_tokenizer::{Tokenizer, pre_tokenize}; use leleka_tokenizer::{Tokenizer, pre_tokenize};
use serde_json::Value; use serde_json::Value;
+1 -1
View File
@@ -280,7 +280,7 @@ def main():
parser.add_argument('--cargo-target-dir', type=Path, required=True, help='dedicated build directory; do not run other Cargo commands here concurrently') parser.add_argument('--cargo-target-dir', type=Path, required=True, help='dedicated build directory; do not run other Cargo commands here concurrently')
parser.add_argument('--cpu-fixture', action='store_true', help='explicit non-CUDA test artifact; never a GPU release') parser.add_argument('--cpu-fixture', action='store_true', help='explicit non-CUDA test artifact; never a GPU release')
parser.add_argument('--build-features', type=Path, parser.add_argument('--build-features', type=Path,
help='exact build feature receipt emitted by build-static-cuda.sh') help='exact build feature receipt emitted by the engine build')
parser.add_argument('--probe-in-runtime-image', action='store_true', parser.add_argument('--probe-in-runtime-image', action='store_true',
help='execute actual provision in the pinned runtime base instead of the assembly host') help='execute actual provision in the pinned runtime base instead of the assembly host')
args = parser.parse_args() args = parser.parse_args()
+1 -1
View File
@@ -1,6 +1,6 @@
// claude/chain-kernels: model-free micro-benchmark of kernel-to-kernel latency inside a CUDA graph, with and without // claude/chain-kernels: model-free micro-benchmark of kernel-to-kernel latency inside a CUDA graph, with and without
// programmatic dependent launch (PDL, griddepcontrol), and of the L2-prefetch-before-wait trick for weight streaming. // programmatic dependent launch (PDL, griddepcontrol), and of the L2-prefetch-before-wait trick for weight streaming.
// Prints "RESULT <name> key=value" lines. Build: tools/chain-probe/build.sh. Never touches the model. // Prints "RESULT <name> key=value" lines. Never touches the model.
#include <cuda_runtime.h> #include <cuda_runtime.h>
#include <cstdio> #include <cstdio>
#include <cstdint> #include <cstdint>