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).
tools/kernel-ab - the C++ reference half of the CPU kernel A/B (STRA-248, S0.8a)
Retired (STRA-406). The C++ driver (
cpp/) and its wrappers (smoke.sh,time_smoke.sh,aa.sh) compiled the Strata CPU kernels from the vendored tree, which was removed (history:third_party/strata/UPSTREAM.md). Onlyverify_manifest.py(the KAB1 reader rule) is kept; the sections below describe the measurement as it was run.
Out-of-tree measurement tooling in the pattern of scripts/cuda-q5-oracle, scripts/cuda-qsa-oracle and
scripts/cuda-projection-family-oracle: the kernels are the unchanged Strata 41cf05a0 sources, built outside the tree,
and every output goes to a private run directory outside Git. Nothing here is a Cargo package, nothing is linked into
production, and Python is used offline only (verify_manifest.py, standard library, Python >= 3.9).
| Path | What |
|---|---|
cpp/Makefile |
builds kab from the pin's CPU-kernel translation units and the pinned ggml with g++/gcc/make (below: why not CMake) |
cpp/kab.cpp |
the driver: gen, internal run-tree, and poolcheck |
cpp/avxvnni_probe.cpp |
the engine's own STRATA_HAVE_AVXVNNI_INTRINSICS probe, run by the Makefile |
verify_manifest.py |
the KAB1 reader rule (exit 0 / 1 / 2) |
smoke.sh |
build, gen, verify, negative tests, poolcheck in one command; last line SMOKE OK |
cpp/kab_time.cpp |
the time sub-command (STRA-317); #included by kab.cpp, one translation unit |
aa.sh |
the C++ A/A control: N rounds of two fresh kab time processes, per-round ratios only (STRA-317) |
time_smoke.sh |
STRA-317 acceptance in one command (time, verify, A/A); last line TIME SMOKE OK |
The time mode (resident / streamed regimes, clock calibration, A/A control) is STRA-317 (S0.8a2): section "Timing" below.
The Rust half (examples/kernel_ab/main.rs, reader, comparison, alternation) is STRA-289.
Why a Makefile and not CMake
The leaf was written as a CMake project that add_subdirectory(<the Strata tree>). The Linux server has no cmake (attempt 1 of
the leaf stopped there). By the orchestrator's decision of 2026-10-28 (comment 49943e61 on STRA-248) the driver is built from
the needed translation units with the server's g++ 15.2.0 / make, in a user-space directory, with no installation, no
container and no change to the host. The KAB1 contract is unchanged; only the build recipe differs.
What "the flags are the engine's by construction" becomes: the Makefile transcribes the Release flags and per-file options of
Strata 41cf05a0, CMakeLists.txt and of ggml 3cf03257f's own CMake files, and make check-pin greps both CMake trees for every
transcribed string (the five per-file option lists, CMAKE_CXX_STANDARD 20, CMAKE_CXX_EXTENSIONS OFF, Release, GGML_NATIVE ON,
the source lists, the ggml -march=native / GGML_USE_CPU_REPACK / _XOPEN_SOURCE / _GNU_SOURCE lines, the llama.cpp GIT_TAG).
A drift of the engine's flags makes check-pin fail instead of being copied silently. This is a transcription with a drift
check, not a CMake run: a reader who needs bit-for-bit CMake provenance still has to build with CMake somewhere.
Recorded in manifest.json (provenance) and printed by the build: compiler id/version/banner, target triple, the flag
strings (strata_cxx_flags, strata_per_file_flags, ggml_c_flags, ggml_cxx_flags, ggml_cpu_arch_flags),
GGML_NATIVE=ON (ggml-cpu is built with -march=native for the build host, so build and run on the same machine),
STRATA_PORTABLE=OFF, STRATA_ISA_FLOOR empty, STRATA_ENABLE_CUDA=OFF, the ggml commit (pin + the checkout's actual HEAD),
the Strata 41cf05a0 pin from third_party/strata/UPSTREAM.md, and the tools commit. The comparator flags are the pin's CMake flags, not
those of upstream's release packaging (third_party/strata/UPSTREAM.md: the packaging recipes were not run here).
The Makefile's STRATA_AVXVNNI define comes from running the engine's own probe (cpp/avxvnni_probe.cpp); ggml's own
generated header ggml-version.h is regenerated from ggml/CMakeLists.txt and the pin.
Commands
make -C tools/kernel-ab/cpp BUILD=<dir outside the tree> [GGML_DIR=<llama.cpp at 3cf03257f>] # builds <dir>/kab, <dir>/build-info.txt
make -C tools/kernel-ab/cpp BUILD=<dir> check-pin # drift check
<dir>/kab gen --run-dir D --seed 1 --cases all # D = <run root>/kernel-ab/<run-id>
python3 tools/kernel-ab/verify_manifest.py D [--ids]
<dir>/kab poolcheck --run-dir D [--workers N] # stage composition vs the real ExpertPool
bash tools/kernel-ab/smoke.sh # everything above, ends with SMOKE OK
BUILD must lie outside the repository (the Makefile refuses otherwise). Without GGML_DIR the Makefile does one shallow
fetch of the pinned commit 3cf03257f219afbe7334045ff7c6a06ac68c627d from github.com/ggml-org/llama.cpp into <BUILD>/llama.cpp
(what FetchContent in CMakeLists.txt does) and refuses a checkout whose HEAD is not the pin. TMPDIR is pointed into BUILD
so a full root file system is not touched. Run kab and make under nice -n 19 on a machine that carries a timing job: a build is
timing load (SC14).
--cases all is 40 cases: every (gate/up, down) pair of the row-type list, gate/up in {18, 21, 22, 23, 42} x down in {20, 42}, at
1, 2, 3 and 8 tokens (one token takes the single-token dot paths; two and three take the multi-token kernels of the #152 rule; 8 is
MAXT). --cases ext (STRA-329, not yet run: the C++ driver needs the pinned ggml, see the leaf) adds 72 cases and leaves the 40 of all untouched: the token counts 4, 5, 6 and 7 for the 10 pairs of the row-type list, and the gate/up types IQ2_XXS (16) and IQ2_XS (17) with both down types at 1..8 tokens. 16 tokens are not covered: KAB1 rows is 1..8 (MAXT). verify_manifest.py --ids accepts the id set of all or that set plus {16, 17}. --cases gu:down:rows[,...] selects others. Data is synthetic and the seed is informational (KAB1: inputs are always
the dumped bytes).
Contract KAB1 (normative copy of the leaf text; files only, no FFI)
All integers little-endian, hashes sha256 lowercase hex, run directory D outside Git.
D/case-<id>.in(id =<gu>-<down>-r<rows>): 64-byte header =u32 magic 0x4942414B ("KABI"),u32 version = 1,i32 gu_type,i32 down_type(ggml ids aslib.rs kind(): gate/up 18 IQ3_XXS, 21 IQ3_S, 22 IQ2_S, 23 IQ4_XS, 42 Q2_0; down 20 IQ4_NL, 42 Q2_0),u32 rows(1..8),u32 n_embd = 2560,u32 n_ff = 640,u32 gate_bytes,u32 up_bytes,u32 down_bytes, zero padding to 64; then gate bytes, up bytes, down bytes (argument order ofPreparedJob::new), thenrows x 2560finite f32. The file length equals the header-derived length exactly; the three byte counts equal2560 / block_elems x block_bytes x 640(gate, up) and640 / block_elems x block_bytes x 2560(down); every block's leading FP16 header is finite.D/case-<id>.cpp-<tree>.out(treeavx512|avx2):u32 magic 0x4F42414B ("KABO"),u32 version = 1,u32 rows,u32 n_embd,u32 tree id(0 = avx512, 1 = avx2), thenrows x 2560f32 raw bit patterns (header = 20 bytes, no padding). The Rust writer usesrust-<tree>in the same positions.D/manifest.json, written last by tmp + rename (its presence means the directory is complete):format: "KAB1",provenance(above, plusavx2_ok/avx512_okas computed by the default-dispatch process on this host,trees.{avx512,avx2}with each process's own probes and effectiveSTRATA_*environment,host_cpu_brand, CPUID leaf 7 sub-leaf 0 and 1 registers,strata_env_seen),cases[](id, type ids and names, rows, informationalseed,equality: "bitwise",tolerance: null, file names with sha256 and byte length of the.inand of both.out), and a flatfilestablename -> {sha256, bytes}.- Equality verdict: bitwise on the f32 bit patterns (NaN absent by construction; -0 and +0 differ). This leaf chooses no tolerance. A tolerance would
be written into the case (
tolerance, with its basis) before the run, by ARCHITECT/TL. - Reader rule: verify the manifest, recompute every sha256 and length, check header-derived sizes, then use; any mismatch refuses the
whole directory.
verify_manifest.py: exit 0OK <n> files; exit 1 naming the file; exit 2incomplete directory(no manifest.json). It also refuses an extra or missing file, a manifest older than another file, non-finite values, and (with--ids) an id set other than {18, 20, 21, 22, 23, 42}.
The two trees are two processes: kab gen runs itself twice with every STRATA_* / LELEKA_* variable scrubbed, avx512 with nothing set and
avx2 with only STRATA_FORCE_AVX2=1 (expert_layout.cpp cpu_avx512_ok() reads it once per process). If the host has no AVX-512, avx512_ok is
recorded false and the two trees are identical by construction.
Stage composition (parent AC7 / this leaf's AC6)
kab computes nothing itself. compose_expert() in cpp/kab.cpp calls the stage entry points declared in
Strata 41cf05a0, include/strata/kernels/cpu/native_expert.hpp (native_fmt line 49, native_quant_act line 52, native_quant_h line 54,
native_gu_rows line 60, native_down_rows line 63) and the Q2_0 kernels of expert_layout.hpp (q2_native_kernels line 81, q2_rows_any,
act_quant_any), in the order and with the branches the engine's pool uses for one routed expert over nt tokens:
| Step | Engine C++ (pin, Strata 41cf05a0) | kab.cpp |
|---|---|---|
| layer format | crates/native-cpu-expert/src/miss_abi.cpp:91 native_fmt(gu, down, H, FF, ...) |
format_for() (also asserts the engine's up_off / bytes - down_off equal the KAB1 sizes) |
| quantize each token | miss_abi.cpp:108-109: gu_type == 42 ? act_quant_any : native_quant_act |
first loop of compose_expert() |
| gate/up rows + SwiGLU | src/kernels/cpu/pool.cpp:1219-1234 (mode 5): q2_native_kernels(gu) -> two q2_rows_any + (g / (1.f + std::exp(-g))) * u (line 1230), else native_gu_rows |
same branch, rows [0, 640) |
| quantize the hidden | pool.cpp:1374-1375 (run_split_multi_native): q2_native_kernels(d) ? act_quant_any : native_quant_h |
second loop |
| down rows | pool.cpp:1235-1244 (mode 6): q2_native_kernels(d) -> q2_rows_any, else native_down_rows |
same branch, rows [0, 2560) |
Rows are independent in every kernel, so splitting the row range across the pool's threads does not change a bit; kab poolcheck
checks exactly that on every case by running the real ExpertPool::run_split_multi_native (miss_abi's sequence, 1 and 4 workers) and comparing
bitwise with compose_expert() in the same process and tree (see the smoke output).
The Rust side the A/B compares against: DirectCpuPool::compute_group (crates/native-cpu-expert/src/lib.rs:155) -> ffi::NativePool::compute_borrowed
-> rust_pool.rs:134 compute_borrowed (token quantization line 155: f.gu == 42 -> q8_one_*, else q8_k) -> run_published
(rust_pool.rs:109-113: phase(5, ...) gate/up + silu, hidden requantization, phase(6, ...); the row kernels are lines 62-72). Same stage order and
same branch keys (gu == 42 / down == 42) as the engine C++ above. Not shown: that the Rust arithmetic is bit-equal to the C++; that is
the A/B itself (STRA-289). In this tree the Rust crate no longer calls miss_abi.cpp (ffi.rs: "Closed Rust replacement for the former C++ miss
ABI"); miss_abi.cpp is read here only as the engine-side description of the sequence.
For one PreparedJob-shaped group (one expert, rows tokens, pairs (t, 0), stride 1) the Rust job has rows tokens per expert, which is
the C++ ExpertJobMulti.nt; the dispatch keys on nt (mt_min, #152), so the case's rows is the token count of the A/B cell.
Not covered here
- Rust reader, comparison, alternation: STRA-289; the Rust
timemode: STRA-318. MSVC build: STRA-255. The A/A class (slower/equal/faster): STRA-313. - Row types outside the KAB1 list (the K-quants, NVFP4, the trellis types, IQ1_*): not generated. IQ2_XXS / IQ2_XS only in
--cases ext. - CMake itself was not run (see above).
GGML_NATIVE=ONties the ggml-cpu half to the build host's CPU.
Timing (kab time, aa.sh; STRA-317 / S0.8a2)
<dir>/kab time --run-dir D --case <id> --slices N --pin <cpu> --out F.json [--slice-ms 60] [--regime both|resident|streamed] [--llc-bytes B]
bash tools/kernel-ab/aa.sh D <case> <rounds> <seed> <cpu> # env: E2E_ROOT, KAB, AA_CELL=avx512|avx2, AA_SLICES, AA_SLICE_MS, AA_OUT
bash tools/kernel-ab/time_smoke.sh # time + verify_manifest + A/A (TS_ROUNDS shortens the A/A)
The command line is the same as the Rust half's (STRA-318), so one runner can alternate both programs. D is never written to
(verify_manifest.py D still prints OK after a run); F.json and the A/A output go next to it, outside the repository.
- What is timed. One routed expert for the case's
rowstokens: the activation quantization, the gate/up rows + SwiGLU, the hidden quantization and the down rows, i.e. the stage sequence ofcompose_expert()(same code path, kernels unchanged) with all scratch pre-allocated.selfcheck_bitwise_equal_compose_expertin the output proves, before any slice, that its output equals the reference composition's on the resident copy and the first/last streamed copy. Pool = 1 worker: one thread, pinned withsched_setaffinityto--pin(verified withsched_getcpubefore every slice; a migrated slice makes the run exit 3). Buffers and scratch are 4096-aligned. - Regimes (both in one run by default, labelled
RESIDENT/STREAMEDinregimes[]): RESIDENT cycles one copy of the expert; STREAMED cycles K distinct 4096-aligned copies with K x stride >= 2 x the last-level cache of the pinned CPU, read at run time from/sys/devices/system/cpu/cpu<pin>/cache/index*/size(the highest-level data/unified cache;--llc-bytesoverrides and is recorded). The factor 2 is a design choice recorded in the file, not a drop threshold. STREAMED does one untimed pass over all copies first. - Slices. Each slice runs calls for
--slice-ms(default 60,tq_cpu_parity.cpp:461), at least 2, and records monotonic ns (CLOCK_MONOTONIC) and TSC ticks (lfence-serialisedrdtsc) per call, plus the dependent-add core-clock calibration before and after. - Dropped slices. The method and the constant are
tq_cpu_parity --bench's:core_ghz()(tq_cpu_parity.cpplines 273-284) andtime_slice()(lines 290-304); a slice is dropped whenstd::fabs(g1 - g0) > 0.05 * g0, i.e. the clock moved by more than 5 percent (Strata 41cf05a0, src/kernels/cpu/tq_cpu_parity.cpp, line 303, copied, no new threshold).slices[]holds the kept slices,dropped[]the dropped ones,dropped_countandslices_keptthe counts; the median of the kept slices is inmedian_ns_per_call/median_tsc_per_call. - Recorded in
F.json:manifest_sha256and the case'sinput_sha256(checked against the manifest before use; a mismatch refuses the run),tree(avx512|avx2, fromcpu_avx512_ok()) with its probes,effective_env(everySTRATA_*/LELEKA_*variable the process saw), the pin (CPU,thread_siblings_list, sibling CPU, the sibling's and the pin's busy fraction from/proc/statover the run, governor, boost, load average at start and end),clock_calibration(method, the cited drop rule with file and line, GHz at start and end,tsc_invariant), and the build record ofkab. - The runner scrubs the environment, not
kab time:aa.shremoves everySTRATA_*andLELEKA_*variable and sets only what the cell needs (AA_CELL=avx2setsSTRATA_FORCE_AVX2=1, whichexpert_layout.cpp cpu_avx512_ok()honours; the default cellavx512sets nothing). - Exit codes: 0 ok; 1 usage / refused input; 3 a regime kept no slice, or a slice migrated off the pin; 4 the final output differs from the reference.
- A/A (
aa.sh). A seeded schedule (balanced a-first / b-first, SplitMix64 Fisher-Yates) is written toschedule.tsvbefore the first run; each round runs two freshkab timeprocesses in that order;ratios.tsvholds exactly<rounds>data lines (#lines are comments) with, per regime, the ratio of the median slice ns of process b over process a. No verdict and no class: the A/A class belongs to the S0.10b classifier (STRA-313). - Noise. On a shared host the numbers are not evidence by themselves; every record carries the load average and the SMT sibling's busy fraction. The leaf's acceptance is correctness (builds, runs, shape of the records), not a timing claim.