okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

waveringanaclarify unconfirmed DS4 validation shutdown cause7637554e0

main
6.4 KiB42 linesraw

DS4 SCR validation

implementation

STRATA_DS4_SCR=1 enables F32 pre-RoPE master capture and live text-only suffix reuse. It is off by default. The core planner is reused with block 2, seed 32, minimum relocated span 256, maximum 64 runs, and 16 fresh extend tokens per run. Its existing Qwen/checkpoint behavior remains the default; DS4 selects bounded-replay mode instead.

Relocation stages all packed rows and F32 master tails before any destination write. It currently refuses multiple devices, remote readers, missing masters, ratios other than 1/2, non-group-aligned RoPE widths, non-128 SWA geometry and invalid/evenness-breaking ranges. Missing masters have no approximate fallback. Allocation or preflight failure leaves the caches untouched; a failure after destination writes resets the conversation and reports ERR/DONE.

A crop above zero and every relocated run end are repaired by exactly 128 rows, processed as eight existing 16-token windows. SWA reads are clipped to the replay start. Main/index writes and master capture are suppressed during replay; rings, Engram ids, compressor carry and DSpark seed rows are rebuilt. The final fresh segment goes through the existing prompt loop and produces logits/checkpoints. The adapter carries prefix pads between requests, and inserts newline id 201 to keep shifts even. It refuses image requests rather than splitting spans.

deviations from the recipe

The normalized inputs to RoPE are F32 in this engine. Rounding the master to BF16 would change fresh-write bytes, so the master remains F32 (twice the recipe's master memory). Repacking invokes the real finish() kernel directly at the target angle, not an old/new delta path; complete RoPE groups are merged into an otherwise byte-for-byte copy of the source row.

This first implementation is live, single-source only. Checkpoint import, master/provenance persistence, image relocation and the recipe's multi-source/seconds-cost planner are not implemented. With SCR enabled, legacy conversation slots are disabled because they have no masters, pad maps or provenance fields; SCR-derived state is also refused by slot_save(). Exact legacy slots remain unchanged with SCR off. Reset and legacy slot load invalidate masters. Master allocation passes element counts to dalloc(); the inherited capture code passed byte counts to this typed allocator, reserving four times the required F32 tail storage.

With STRATA_PORTABLE=ON, SCR=0 matched all 32 greedy continuation ids from the supplied rebase baseline on a fixed 16-token prompt (token SHA1 prefix 34d238e693). This establishes identity for that case only, not all inputs. Both used the same model/options and exact routing (DS4_CP_LAMBDA=0). Binary and input SHA256 hashes are recorded in /data/tmp/ds4-scr-validation/manifest.json.

measured greedy comparisons

One cold comparison per edit, not repeated timing trials:

requestexact / relocated / fresh physical rowsSCR TTFTcold TTFTgreedy continuation
first edit3000 / 2890 / 8328.120 s39.100 sall 24 ids equal
second edit, carried pad4502 / 1390 / 8326.780 s39.007 sfirst divergence at output index 12 (zero-based)

Cold inputs contain the original logical ids; SCR inputs additionally contain one/two newline pads. The second divergence is an observation of the approved approximation (stale context and pads together), not an isolated row-packer comparison. No general quality or repeated performance claim follows from these two cases.

tests

CPU oracle: 252 target fresh-write equality, round-trip and 26-repeated-move cases over both FP4 formats, dimensions 128/512 and RoPE widths 32/64/128. It uses host math and does not prove device sin/cos equivalence. Planner: 100 odd/even insertion/pad-carry cases plus multi-run repair gaps. Existing core scr_test remains green.

The CUDA test compares actual finish() against scr_repack() byte for byte at both ratio-1 and ratio-2 row positions. Build target: ds4_scr_gpu_test. It is registered in CTest with the gpu label and a 120-second timeout. It passed on the RTX 5070 under the shared flock (0.51 seconds). The 5,971-token live seed followed by two edits completed. Edit one: 5,973 physical tokens = 3,000 exact + 2,890 relocated + 83 fresh; 256 band rows; TTFT 28.120 seconds. Edit two: 5,975 physical tokens = 4,502 exact + 1,390 relocated + 83 fresh; 256 band rows; TTFT 26.780 seconds. Both inserted one pad; edit two carried the earlier pad as well. Explicit SWA-only write-preservation, DSpark replay and overlapping/swapped relocation tests remain pending (these engine runs disabled DSpark). HIP builds have not been checked.

Configure with -DSTRATA_PORTABLE=ON -DCMAKE_CUDA_ARCHITECTURES=120 (the portable flag enables AVX2/FMA in the Nix build). Build: nix develop /data/src/strata -c cmake --build /data/src/strata-ds-scr/build --target strata-dsv41 ds4_scr_cpu_test ds4_scr_gpu_test ds4_scr_plan_test scr_test -j 6.

CPU tests only: nix develop /data/src/strata -c flock /tmp/ds41-bench.lock ctest --test-dir /data/src/strata-ds-scr/build -R '^(scr_test|ds4_scr_cpu_test|ds4_scr_plan_test)$' --output-on-failure.

Validation completed: the Release/sm_120 engine and all four named test executables built successfully with at most six compilation jobs. All three CPU CTest targets passed under /tmp/ds41-bench.lock (0.67 seconds total test execution). git diff --check passed. CMake reported that unrelated IQ parity fixtures were not registered because its Python interpreter lacks NumPy.

GPU follow-up used flock /tmp/ds41-bench.lock for every invocation, PCI ordering, device1, driver LD path, and 175-second per-lease deadlines. Evidence and the direct-protocol harness are under /data/tmp/ds4-scr-validation/. Initial CLI parsing was repaired to accept comma-separated ids; the first attempt logs were retained. All three serve invocations completed their requested generations, but the harness then hit its 15-second wait after QUIT and killed the engine. Request outputs and result JSON were preserved, and no validation engine remains running. The harness kept stdin open; the shutdown cause has not been established. These runs have a cleanup failure, not a successful process-exit result. The legacy DONE/PP frontier field credits the full final replay frontier as “reused”; use the explicit ds4 SCR stderr accounting above for actual exact/relocated/fresh counts.

1# DS4 SCR validation
2
3## implementation
4
5`STRATA_DS4_SCR=1` enables F32 pre-RoPE master capture and live text-only suffix reuse. It is off by default. The core planner is reused with block 2, seed 32, minimum relocated span 256, maximum 64 runs, and 16 fresh extend tokens per run. Its existing Qwen/checkpoint behavior remains the default; DS4 selects bounded-replay mode instead.
6
7Relocation stages all packed rows and F32 master tails before any destination write. It currently refuses multiple devices, remote readers, missing masters, ratios other than 1/2, non-group-aligned RoPE widths, non-128 SWA geometry and invalid/evenness-breaking ranges. Missing masters have no approximate fallback. Allocation or preflight failure leaves the caches untouched; a failure after destination writes resets the conversation and reports ERR/DONE.
8
9A crop above zero and every relocated run end are repaired by exactly 128 rows, processed as eight existing 16-token windows. SWA reads are clipped to the replay start. Main/index writes and master capture are suppressed during replay; rings, Engram ids, compressor carry and DSpark seed rows are rebuilt. The final fresh segment goes through the existing prompt loop and produces logits/checkpoints. The adapter carries prefix pads between requests, and inserts newline id 201 to keep shifts even. It refuses image requests rather than splitting spans.
10
11## deviations from the recipe
12
13The normalized inputs to RoPE are F32 in this engine. Rounding the master to BF16 would change fresh-write bytes, so the master remains F32 (twice the recipe's master memory). Repacking invokes the real `finish()` kernel directly at the target angle, not an old/new delta path; complete RoPE groups are merged into an otherwise byte-for-byte copy of the source row.
14
15This first implementation is live, single-source only. Checkpoint import, master/provenance persistence, image relocation and the recipe's multi-source/seconds-cost planner are not implemented. With SCR enabled, legacy conversation slots are disabled because they have no masters, pad maps or provenance fields; SCR-derived state is also refused by `slot_save()`. Exact legacy slots remain unchanged with SCR off. Reset and legacy slot load invalidate masters. Master allocation passes element counts to `dalloc()`; the inherited capture code passed byte counts to this typed allocator, reserving four times the required F32 tail storage.
16
17With `STRATA_PORTABLE=ON`, SCR=0 matched all 32 greedy continuation ids from the supplied rebase baseline on a fixed 16-token prompt (token SHA1 prefix `34d238e693`). This establishes identity for that case only, not all inputs. Both used the same model/options and exact routing (`DS4_CP_LAMBDA=0`). Binary and input SHA256 hashes are recorded in `/data/tmp/ds4-scr-validation/manifest.json`.
18
19## measured greedy comparisons
20
21One cold comparison per edit, not repeated timing trials:
22
23| request | exact / relocated / fresh physical rows | SCR TTFT | cold TTFT | greedy continuation |
24| --- | --- | --- | --- | --- |
25| first edit | 3000 / 2890 / 83 | 28.120 s | 39.100 s | all 24 ids equal |
26| second edit, carried pad | 4502 / 1390 / 83 | 26.780 s | 39.007 s | first divergence at output index 12 (zero-based) |
27
28Cold inputs contain the original logical ids; SCR inputs additionally contain one/two newline pads. The second divergence is an observation of the approved approximation (stale context and pads together), not an isolated row-packer comparison. No general quality or repeated performance claim follows from these two cases.
29
30## tests
31
32CPU oracle: 252 target fresh-write equality, round-trip and 26-repeated-move cases over both FP4 formats, dimensions 128/512 and RoPE widths 32/64/128. It uses host math and does not prove device sin/cos equivalence. Planner: 100 odd/even insertion/pad-carry cases plus multi-run repair gaps. Existing core `scr_test` remains green.
33
34The CUDA test compares actual `finish()` against `scr_repack()` byte for byte at both ratio-1 and ratio-2 row positions. Build target: `ds4_scr_gpu_test`. It is registered in CTest with the `gpu` label and a 120-second timeout. It passed on the RTX 5070 under the shared flock (0.51 seconds). The 5,971-token live seed followed by two edits completed. Edit one: 5,973 physical tokens = 3,000 exact + 2,890 relocated + 83 fresh; 256 band rows; TTFT 28.120 seconds. Edit two: 5,975 physical tokens = 4,502 exact + 1,390 relocated + 83 fresh; 256 band rows; TTFT 26.780 seconds. Both inserted one pad; edit two carried the earlier pad as well. Explicit SWA-only write-preservation, DSpark replay and overlapping/swapped relocation tests remain pending (these engine runs disabled DSpark). HIP builds have not been checked.
35
36Configure with `-DSTRATA_PORTABLE=ON -DCMAKE_CUDA_ARCHITECTURES=120` (the portable flag enables AVX2/FMA in the Nix build). Build: `nix develop /data/src/strata -c cmake --build /data/src/strata-ds-scr/build --target strata-dsv41 ds4_scr_cpu_test ds4_scr_gpu_test ds4_scr_plan_test scr_test -j 6`.
37
38CPU tests only: `nix develop /data/src/strata -c flock /tmp/ds41-bench.lock ctest --test-dir /data/src/strata-ds-scr/build -R '^(scr_test|ds4_scr_cpu_test|ds4_scr_plan_test)$' --output-on-failure`.
39
40Validation completed: the Release/sm_120 engine and all four named test executables built successfully with at most six compilation jobs. All three CPU CTest targets passed under `/tmp/ds41-bench.lock` (0.67 seconds total test execution). `git diff --check` passed. CMake reported that unrelated IQ parity fixtures were not registered because its Python interpreter lacks NumPy.
41
42GPU follow-up used `flock /tmp/ds41-bench.lock` for every invocation, PCI ordering, device1, driver LD path, and 175-second per-lease deadlines. Evidence and the direct-protocol harness are under `/data/tmp/ds4-scr-validation/`. Initial CLI parsing was repaired to accept comma-separated ids; the first attempt logs were retained. All three serve invocations completed their requested generations, but the harness then hit its 15-second wait after QUIT and killed the engine. Request outputs and result JSON were preserved, and no validation engine remains running. The harness kept stdin open; the shutdown cause has not been established. These runs have a cleanup failure, not a successful process-exit result. The legacy DONE/PP frontier field credits the full final replay frontier as “reused”; use the explicit `ds4 SCR` stderr accounting above for actual exact/relocated/fresh counts.