Lane-b128res report -- the parked 128 residual arm re-measured after edge128: the bars 2160p 8-sample mismatch is gone (cdef owner map), the arm stays inert at 0.4-1.9 writer fires/frame with flat BD on both gates, disposition stays-off
Browse files at this commit329dee99deb9479cc6e899a9c4ccac80879daf92Parent: 2ed5165- docs
- lane-b128res report -- the parked 128 residual arm re-measured after edge128: the bars 2160p 8-sample mismatch is gone (cdef owner map), the arm stays inert at 0.4-1.9 writer fires/frame with flat BD on both gates, disposition stays-off
- pins unmoved at 8291 / 33227
2 changed files +214 -0
- lanes/b128res.charter.md +70 -0
- lanes/b128res.report.md +144 -0
lanes/b128res.charter.mdadded+70 -0
| @@ -0,0 +1,70 @@ | ||
| 1 | +# lane-b128res — re-measure the parked 128 residual arm after edge128 | |
| 2 | + | |
| 3 | +GOAL: `EC_AV1_B128RES` is written, witnessed, and OFF because (1) RD took it | |
| 4 | +0-2 times/frame (inert) and (2) bars 2160p q=90 frame 11 disagreed with | |
| 5 | +ffmpeg by 8 luma samples at a 128 block's horizontal edge. lane-edge128 | |
| 6 | +claimed that mismatch was CDEF search pricing four indices under a root | |
| 7 | +that carries one literal, fixed with an owner map. This lane decides | |
| 8 | +whether the residual arm can ship. | |
| 9 | + | |
| 10 | +Work ONLY in this worktree (`lane-b128res`). Never touch main, never | |
| 11 | +push, never `git checkout <file>`, never repo-wide `cargo fmt`. | |
| 12 | +`export CARGO_TARGET_DIR=$HOME/.cache/cargo-target-b128res` on every cargo | |
| 13 | +command. Logs under `~/.cache/b128res/`. TMPDIR only on gate command | |
| 14 | +lines, not on the sccache server. Gates: `systemd-run --user -p MemoryMax=14G`, | |
| 15 | +`--ignored --exact` on both BD tests (they are `#[ignore]`; without | |
| 16 | +`--ignored` they measure nothing). One gate at a time; record LOADAVG | |
| 17 | +before AND after. Pins 8291 / 33227. Keep rule: one film row ≥0.5 BD | |
| 18 | +down on a column, the other flat within ±0.3, screen not worse by 0.3, | |
| 19 | +wall ≤+15%. Sign: BD-rate, lower better. | |
| 20 | + | |
| 21 | +## 1. Refute or confirm the 8-sample mismatch (do this FIRST) | |
| 22 | + | |
| 23 | +Recipe: the native bars 2160p row, `EC_AV1_B128RES=1`, q=90, the frame | |
| 24 | +and rows named in `encode.rs` `b128_residual` (frame 11, luma rows | |
| 25 | +126..127, cols 1611..1616). Compare encoder reconstruction vs ffmpeg vs | |
| 26 | +`decode_stream`. Cite the command. | |
| 27 | + | |
| 28 | +- If the 8 samples are STILL wrong: STOP. Do not ship. Report the | |
| 29 | + remaining mismatch (class, path:line). Leave the default off. | |
| 30 | +- If they are gone: continue. | |
| 31 | + | |
| 32 | +INVARIANT from lane-ab128: a skip-only 128-wide piece writes no | |
| 33 | +`cdef_idx`. `cdef_unit_owner` currently only special-cases `Whole128`. | |
| 34 | +The residual arm IS Whole128. Do not extend the owner map to Rect128/Ab128 | |
| 35 | +in this lane unless you turn those pieces into residual carriers — that | |
| 36 | +is a different lane. | |
| 37 | + | |
| 38 | +## 2. If the mismatch is gone: measure | |
| 39 | + | |
| 40 | +Control = default (B128RES off) on this HEAD. Arm = `EC_AV1_B128RES=1`. | |
| 41 | + | |
| 42 | +- `cargo test -p ec-av1 --release --lib -- --ignored --exact --nocapture encode::tests::bd_rate_film_long_gop` | |
| 43 | + (deciding). Both films. | |
| 44 | +- 12-frame guard: `encode::tests::bd_rate_screen_native` with | |
| 45 | + `EC_AV1_NATIVE_FILM=1` then `EC_AV1_NATIVE_FILM4K=1` then the screen | |
| 46 | + arm, or however the standing table ran them — all five 12-frame rows. | |
| 47 | +- Residual fire count: `take_b128_residual_hits` / writer | |
| 48 | + `take_sb128_residual_hits` on the long-GOP arm. If still 0-2/frame, | |
| 49 | + it is still inert even if exact. | |
| 50 | + | |
| 51 | +Keep → default ON (and drop the "filter mismatch" paragraph). Inert + | |
| 52 | +exact → leave OFF, but rewrite the comment so it no longer names an | |
| 53 | +open filter bug. Mismatch remains → OFF, report. | |
| 54 | + | |
| 55 | +## 3. Witness / pins / suite (only if you change the default) | |
| 56 | + | |
| 57 | +Pins at default and `EC_AV1_SPEED=6`. Existing residual witnesses | |
| 58 | +(`a_128_root_block_with_a_real_residual_decodes_exact_through_both_decoders` | |
| 59 | +and the CDEF-covered-units one) `--ignored`. Workspace check | |
| 60 | +`timeout 900 cargo check --workspace --all-targets -j4` (0 ec-av1 | |
| 61 | +warnings). Do NOT run the full lib suite unless you change the default; | |
| 62 | +if you do, three lanes: `--skip stream::` / `stream:: --skip 10bit` / | |
| 63 | +`10bit`. | |
| 64 | + | |
| 65 | +## DONE | |
| 66 | + | |
| 67 | +Commit on `lane-b128res` + `lanes/b128res.report.md` with EVIDENCE lines | |
| 68 | +(`EVIDENCE: <artifact> | <steps> | <measurement>`), fire counts, BD | |
| 69 | +table, mismatch gone/still, disposition `ships-on | stays-off | stopped`. | |
| 70 | +Never merge or push. |
lanes/b128res.report.mdadded+144 -0
| @@ -0,0 +1,144 @@ | ||
| 1 | +# lane-b128res — the parked 128 residual arm after edge128 | |
| 2 | + | |
| 3 | +Base: `6de54e81` (lane-b128res worktree). Disposition: **stays-off**. | |
| 4 | +`EC_AV1_B128RES` keeps its default (off). Pins untouched at 8291 / 33227 | |
| 5 | +(no default change, so no pin run). Never merged, never pushed. | |
| 6 | + | |
| 7 | +## 1. The 8-sample mismatch: GONE | |
| 8 | + | |
| 9 | +lane-edge128's diagnosis was right: `read_cdef` codes ONE literal for the | |
| 10 | +block that first reaches a unit and copies it over every unit the block | |
| 11 | +spans, while the encoder's CDEF search priced a preset per 64x64 unit — | |
| 12 | +`crate::tile::cdef_unit_owner` (tile.rs) collapses the four to the one the | |
| 13 | +decoder derives. On this HEAD the parked recipe re-measures clean: | |
| 14 | + | |
| 15 | +- Command: `systemd-run --user -p MemoryMax=14G --wait --unit=b128res-probe | |
| 16 | + bash -lc 'cd <worktree> && CARGO_TARGET_DIR=$HOME/.cache/cargo-target-b128res | |
| 17 | + EC_AV1_B128RES=1 cargo test -p ec-av1 --release --lib -- | |
| 18 | + encode::tests::b128res_mismatch_probe --ignored --exact --nocapture'` | |
| 19 | + (throwaway probe, removed after the run; recipe = the gate's own: | |
| 20 | + bars 2160p fixture, `gate_crop` window 1920x1024:960:568, 12 frames, | |
| 21 | + `encode_sequence_with_ctx(…, 90, …)`). | |
| 22 | +- frame 11 q=90, luma rows 126..127 cols 1611..1616 (idx 243531..243536, | |
| 23 | + 245451..245456): encoder reconstruction == ffmpeg == decode_stream, all | |
| 24 | + eight samples read 107. Whole stream (12 frames, Y/U/V): three-way EXACT. | |
| 25 | +- Broader: with `EC_AV1_B128RES=1` BOTH BD gates passed their standing | |
| 26 | + three-way exactness assertion (encoder == ffmpeg == decode_stream) at | |
| 27 | + every clip x every q point x every frame — 5 clips x 4 q x 12 frames and | |
| 28 | + 2 films x 4 q x 48 frames. | |
| 29 | + | |
| 30 | +EVIDENCE: ~/.cache/b128res/probe-mismatch.log | EC_AV1_B128RES=1, q=90, | |
| 31 | +frame 11, rows 126..127 cols 1611..1616 + whole-stream sweep | 8/8 samples | |
| 32 | +agree (all 107); 0 differing samples in any plane/frame; "whole stream | |
| 33 | +three-way EXACT". LOADAVG 1.96/2.43/3.42 before, 2.44/2.51/3.41 after. | |
| 34 | + | |
| 35 | +## 2. Long-GOP BD (deciding; 48 pictures, gop=48, both films) | |
| 36 | + | |
| 37 | +Control = default (off), arm = `EC_AV1_B128RES=1`, same HEAD, same ladder | |
| 38 | +(`encode::tests::bd_rate_film_long_gop`, `--ignored --exact`). BD-rate, | |
| 39 | +lower better: | |
| 40 | + | |
| 41 | +| row | off vs libaom | off vs rav1e | on vs libaom | on vs rav1e | | |
| 42 | +|---|---|---|---|---| | |
| 43 | +| film A (1080p) 1920x768 | +20.9% | -9.0% | +20.8% | -9.1% | | |
| 44 | +| film B (2160p HDR) 1920x1024 | +70.4% | -2.2% | +70.5% | -2.1% | | |
| 45 | + | |
| 46 | +Wall ours: film A 542.3s -> 549.8s (+1.4%), film B 422.9s -> 445.5s (+5.3%). | |
| 47 | +Control reproduces the standing table (film B +70.4/-2.2) to the digit. | |
| 48 | + | |
| 49 | +EVIDENCE: ~/.cache/b128res/longgop-control.log | gate 2a, MemoryMax=14G | | |
| 50 | +film A +20.9%/-9.0%, film B +70.4%/-2.2%. LOADAVG 2.64/2.57/3.07 before, | |
| 51 | +3.44/2.79/2.76 after. | |
| 52 | +EVIDENCE: ~/.cache/b128res/longgop-arm.log | gate 2b, EC_AV1_B128RES=1, | |
| 53 | +MemoryMax=14G | film A +20.8%/-9.1%, film B +70.5%/-2.1%. LOADAVG | |
| 54 | +3.35/2.80/2.76 before, 3.07/3.53/3.19 after. | |
| 55 | + | |
| 56 | +## 3. 12-frame native guard (all five rows) | |
| 57 | + | |
| 58 | +`encode::tests::bd_rate_screen_native`, control and arm: | |
| 59 | + | |
| 60 | +| row | off vs libaom | off vs rav1e | on vs libaom | on vs rav1e | wall ours off->on | | |
| 61 | +|---|---|---|---|---|---| | |
| 62 | +| bars 1080p | -3.3% | -19.0% | -3.4% | -18.9% | 160.4s -> 164.4s | | |
| 63 | +| bars 2160p | +8.4% | -13.9% | +8.4% | -13.9% | 137.1s -> 143.7s | | |
| 64 | +| film A | +17.9% | -6.3% | +17.8% | -6.4% | 144.2s -> 145.0s | | |
| 65 | +| film B | +22.6% | -3.8% | +22.6% | -3.8% | 122.8s -> 123.8s | | |
| 66 | +| screen capture | +14.4% | -33.2% | +14.5% | -33.2% | 94.9s -> 94.3s | | |
| 67 | + | |
| 68 | +EVIDENCE: ~/.cache/b128res/native12-control.log | gate 3a, five rows, | |
| 69 | +MemoryMax=14G | table above, "off" columns. LOADAVG 2.38/3.32/3.13 before, | |
| 70 | +3.63/3.57/3.34 after. | |
| 71 | +EVIDENCE: ~/.cache/b128res/native12-arm.log | gate 3b, five rows, | |
| 72 | +EC_AV1_B128RES=1, MemoryMax=14G | table above, "on" columns; three-way | |
| 73 | +sample exactness held at every point. LOADAVG 3.42/3.53/3.33 before, | |
| 74 | +3.32/3.23/3.27 after. | |
| 75 | + | |
| 76 | +## 4. Residual fire counts (writer `take_sb128_residual_hits`) | |
| 77 | + | |
| 78 | +Per clip, cumulative over the run's four-q ladder (12-frame rows: 48 | |
| 79 | +encoded frames; long-GOP rows: 192): | |
| 80 | + | |
| 81 | +| clip (frames encoded) | search won | writer coded | per frame | | |
| 82 | +|---|---|---|---| | |
| 83 | +| bars 1080p (48) | 1567 | 63 | 1.3 | | |
| 84 | +| bars 2160p (48) | 985 | 32 | 0.7 | | |
| 85 | +| film A 12f (48) | 2331 | 92 | 1.9 | | |
| 86 | +| film B 12f (48) | 1797 | 47 | 1.0 | | |
| 87 | +| screen capture (48) | 307 | 61 | 1.3 | | |
| 88 | +| film A long-GOP (192) | 10205 | 320 | 1.7 | | |
| 89 | +| film B long-GOP (192) | 6056 | 75 | 0.4 | | |
| 90 | + | |
| 91 | +0.4-1.9 fires/frame against thousands of whole 128 roots — still INERT, | |
| 92 | +exactly the historical 0-2 band. The census is now a permanent line of the | |
| 93 | +native arm ("128x128 roots … with a residual … (search) / … (writer)"), so | |
| 94 | +the next reader does not need a custom run. | |
| 95 | + | |
| 96 | +## 5. Keep rule — NOT met | |
| 97 | + | |
| 98 | +One film row >=0.5 BD down on a column: best delta anywhere is -0.1 | |
| 99 | +(film A long-GOP and 12-frame). Other film row flat within +/-0.3: yes | |
| 100 | +(+0.1). Screen not worse by 0.3: yes (+0.1). Wall <= +15%: yes (max +5.3%). | |
| 101 | +The deciding column fails, and the arm is inert. Inert + exact = the | |
| 102 | +charter's stays-off branch. | |
| 103 | + | |
| 104 | +## 6. Witnesses (both `--ignored`, run standalone) | |
| 105 | + | |
| 106 | +- `a_128_root_residual_block_under_a_per_unit_cdef_list_decodes_exact`: | |
| 107 | + PASS as-is — writer coded 566 residual 128 blocks, 24 CDEF units taking | |
| 108 | + another unit's literal, byte-exact through both decoders. This is the | |
| 109 | + witness lane-edge128 built for the exact interaction that used to break | |
| 110 | + bars 2160p. | |
| 111 | +EVIDENCE: ~/.cache/b128res/witness-cdef.log | --ignored --exact run | | |
| 112 | +"writer coded 566; covered 24", ok. LOADAVG 2.03/2.21/3.13 before, | |
| 113 | +2.72/2.36/3.15 after. | |
| 114 | +- `a_128_root_block_with_a_real_residual_decodes_exact_through_both_decoders`: | |
| 115 | + was RED on its precondition at its fixture q (150: writer coded 0) and | |
| 116 | + still at 90 — the forced residual arm replaces the skip arm's cost | |
| 117 | + unconditionally, and the cost model moved under it since lane-b128r | |
| 118 | + (lane-rectdq's delta_q group on every non-skipped root; the pyramid's | |
| 119 | + per-level q), so the NONE root lost its partition at all 420 roots and | |
| 120 | + nothing reached the writer. Fixture re-vitalized at q=60: writer coded | |
| 121 | + 52, byte-exact through both decoders, PASS. q change + a doc paragraph | |
| 122 | + naming the drift class are in the commit; the `coded > 0` assert stays | |
| 123 | + as the guard. | |
| 124 | +EVIDENCE: ~/.cache/b128res/witness-residual.log (q=90, FAILED, writer 0), | |
| 125 | +witness-residual-q60.log (q=60, "search won 420, writer coded 52", ok). | |
| 126 | + | |
| 127 | +## 7. Changes on the lane | |
| 128 | + | |
| 129 | +- encode.rs `b128_residual` doc: the "open filter bug" paragraph is | |
| 130 | + replaced by the closed story (owner map, re-measured three-way EXACT) | |
| 131 | + and the inertness numbers; the knob stays as the arm's gate. | |
| 132 | +- encode.rs `native_bd_arm`: one census line added — residual fires | |
| 133 | + (search/writer) next to the standing 128-root census. | |
| 134 | +- encode.rs pan residual witness: fixture q 150 -> 60 + drift note. | |
| 135 | +- Throwaway probe removed after its run. | |
| 136 | + | |
| 137 | +## 8. Non-goals respected | |
| 138 | + | |
| 139 | +Rect128/Ab128 residual pieces (a rect half carrying a residual still | |
| 140 | +refuses in `write_inter_block_128_rect`, owner map still Whole128-only), | |
| 141 | +merging, pushing, full workspace suite (default did not flip). Media files | |
| 142 | +read-only; all runs gated under `systemd-run --user -p MemoryMax=14G`, one | |
| 143 | +gate at a time, `--ignored --exact` on the ignored tests, logs under | |
| 144 | +`~/.cache/b128res/`. |