wip(sbpart): builder's in-flight edits, committed verbatim at the 75-turn cap (state unverified by me)
Browse files at this commit8523a2857d50147cae406ec11432a0d8e65ab6b0Parent: 75f3f891 changed file +135 -0
- lanes/sbpart-r6.report.md +135 -0
lanes/sbpart-r6.report.mdadded+135 -0
| @@ -0,0 +1,135 @@ | |||
| 1 | +VERDICT: PARTIAL -- merged main and compiled clean (charter's order 1), built | ||
| 2 | +oracle rung 10 and range-laddered block2's mode-info reads (charter's order | ||
| 3 | +2-3), got a decisive result that OVERTURNS r5's own framing of where the | ||
| 4 | +desync starts, but did not reach a fix (order 4) before budget ran thin. | ||
| 5 | + | ||
| 6 | +## 1. Merge main (170a5a3), compiled | ||
| 7 | + | ||
| 8 | +`git merge origin/main` conflicted in exactly one file, `stream.rs`: both | ||
| 9 | +lane-realworld (deltaq gate) and lane-tiles (tile-group + non-uniform-spacing | ||
| 10 | +gates) added tests immediately adjacent to this lane's sbpart tests with no | ||
| 11 | +shared context lines between them, so git's 3-way merge produced one large | ||
| 12 | +interleaved conflict block spanning ~630 lines rather than several small | ||
| 13 | +ones. First attempted resolution (character-level "keep both sides") was | ||
| 14 | +WRONG -- it interleaved unrelated functions' local variables mid-body. | ||
| 15 | +Discarded that with `git checkout --merge` and re-resolved by function | ||
| 16 | +boundary instead: every complete test function from each side kept intact, | ||
| 17 | +in sequence (sbpart's rect64 gate + pinned replay, then realworld's deltaq | ||
| 18 | +gate, then tiles' r7/r9/non-uniform-spacing gates) -- no duplicated or | ||
| 19 | +truncated function bodies. `cargo check -p ec-av1 --tests`: clean, only | ||
| 20 | +pre-existing missing-doc warnings. Committed at bfb1b8f. | ||
| 21 | + | ||
| 22 | +## 2. Oracle rung 10 | ||
| 23 | + | ||
| 24 | +Rung 9 (charter's assignment) was already taken by lane-lr on `main` by the | ||
| 25 | +time this round started (`calculate_intermediate_result` export, landed on | ||
| 26 | +main before this merge). Took rung 10 instead, in | ||
| 27 | +`scripts/instrument-aom-oracle.sh`: `EC_TRACE_MODE_STEP=1` prints | ||
| 28 | +`EC_ISTEP mi_row=.. mi_col=.. name=.. val=.. rng=..` after each of `skip`, | ||
| 29 | +`cdef`, `dq`, `mode`, `angle_y`, `uv_mode`, `angle_uv` inside | ||
| 30 | +`ec_read_intra_frame_mode_info_impl` (rung 5's renamed body) -- the finest | ||
| 31 | +granularity the charter asked for, one line per symbol, not one line per | ||
| 32 | +block. Built clean after fixing a Python `%`-operator escaping bug (raw `%d`/ | ||
| 33 | +`%u` C format specifiers in the template collided with Python's own `%` | ||
| 34 | +substitution on the first attempt -- caught by the ninja build failing with | ||
| 35 | +"missing terminating \" character", reverted the bad decodemv.c edit with a | ||
| 36 | +targeted regex strip before rebuilding, not a full `git checkout` of the | ||
| 37 | +oracle source since rungs 1-9's uncommitted patches live in the same | ||
| 38 | +uncommitted working tree). `ninja -C ~/.cache/aom-oracle/build aomdec`: | ||
| 39 | +clean after the fix. | ||
| 40 | + | ||
| 41 | +Added the matching instrumentation to our own decoder | ||
| 42 | +(`read_intra_mode_rect` in `decode.rs`, gated on the same `EC_TRACE_MODE_STEP` | ||
| 43 | +env var, same `EC_ISTEP` line format) so the two traces diff directly by | ||
| 44 | +`grep`, no manual field-mapping between differently-shaped trace formats. | ||
| 45 | + | ||
| 46 | +## 3. Range-ladder result: block2's mode-info prefix is byte-exact | ||
| 47 | + | ||
| 48 | +Regenerated the pinned mismatch fresh this round (old pin was gone -- | ||
| 49 | +scratchpad reaped between sessions per [[oracle-in-reaped-dir]]'s pattern, | ||
| 50 | +though this time it was just session-scoped, not a tmpfs wipe): | ||
| 51 | +`EC_SBPART_GATE_ATTEMPTS=1 EC_AV1_GATE_DUMP=... cargo test ... a_real_aomenc_ | ||
| 52 | +stream_with_a_superblock_level_horz_vert_partition_decodes_pixel_exact -- | ||
| 53 | +--nocapture`, seed 42, same recipe as r2-r5. Decoded the pinned OBU through | ||
| 54 | +both `aomdec --i420` (oracle) and `pinned_sbpart_stream_decodes_pixel_exact` | ||
| 55 | +(ours), both with `EC_TRACE_MODE_STEP=1`. | ||
| 56 | + | ||
| 57 | +Block2 is `mi_row=0 mi_col=24` (px 96, matching r5's bounding-box finding). | ||
| 58 | +Side-by-side range ladder, every field: | ||
| 59 | + | ||
| 60 | +``` | ||
| 61 | + ours oracle | ||
| 62 | +skip val=0 rng=43948 val=0 rng=43948 | ||
| 63 | +cdef val=0 rng=43948 val=0 rng=43948 | ||
| 64 | +dq rng=43948 val=180 rng=43948 | ||
| 65 | +mode val=0 rng=44880 val=0 rng=44880 | ||
| 66 | +angle_y val=0 rng=44880 val=0 rng=44880 | ||
| 67 | +uv_mode val=0 rng=63764 val=0 rng=63764 | ||
| 68 | +angle_uv val=0 rng=63764 val=0 rng=63764 | ||
| 69 | +``` | ||
| 70 | + | ||
| 71 | +Every decoded value and every `rng` after every read matches exactly. This | ||
| 72 | +is a real per-symbol proof, not inspection -- it **overturns r5's own | ||
| 73 | +framing** ("block2 ... wrong from its very first pixel" was read as "desync | ||
| 74 | +at block2's first symbol"; it is not). The mode-info prefix | ||
| 75 | +(`read_intra_mode_rect`, `decode.rs:2572`) is entropy-correct for block2. | ||
| 76 | +The desync -- confirmed still real by the full oracle trace only ever | ||
| 77 | +visiting `mi_col ∈ {0, 16, 24, 32}` at row 0 and `{0, 16, 32}` at row 16 | ||
| 78 | +(three `NONE` 64x64 blocks plus the one `VERT` pair, seven blocks total), | ||
| 79 | +while our own trace's next `EC_ISTEP` entry after block2 is | ||
| 80 | +`mi_row=16 mi_col=40` -- a rect64 block **that does not exist in the real | ||
| 81 | +partition tree at all** (oracle's `mi_col=32` row-1 block is a single | ||
| 82 | +directional `NONE` block, mode=5, never split) -- must originate somewhere | ||
| 83 | +between `angle_uv` returning and the end of `decode_block_rect64`'s own | ||
| 84 | +symbol reads, i.e. **strictly after** the mode-info prefix this round | ||
| 85 | +laddered clean. | ||
| 86 | + | ||
| 87 | +## Narrowed suspect for next round | ||
| 88 | + | ||
| 89 | +`decode_block_rect64` (decode.rs:3081), after the now-proven-correct prefix, | ||
| 90 | +reads in order: `tx_select`-gated depth symbol (refuses if split; gate's | ||
| 91 | +`--enable-tx-size-search=0` should force `tx_select=false` so this is a | ||
| 92 | +no-op here, unverified this round but low suspicion given r2's precedent fix | ||
| 93 | +comment at decode.rs:2781-2787), then three coefficient reads -- | ||
| 94 | +`read_coeffs` with `TxbSet::Luma64`/`scan32` for the 32x32 luma corner, then | ||
| 95 | +`read_coeffs_rect` with `TxbSet::ChromaRect32x16` for U then V -- each keyed | ||
| 96 | +off `Neighbours::around_rect(at, bw, bh)` (decode.rs:2094) for | ||
| 97 | +`skip_ctx`/`dc_sign_ctx`. **`around_rect` is the sharpest unaudited | ||
| 98 | +suspect**: r5's inspection pass covered `record_rect` (the WRITE side after | ||
| 99 | +block1 decodes) and `fill_skip_grid_rect`/`skip_txfm_ctx` (a different | ||
| 100 | +context path), but never looked at `around_rect` (the READ side block2 | ||
| 101 | +itself calls, gathering over block1's freshly-written span) -- and per | ||
| 102 | +[[context-read-from-one-cell]], a gather that reads the wrong span or wrong | ||
| 103 | +cell for a just-written neighbour is exactly the class of bug that produces | ||
| 104 | +a wrong CDF selection, which changes both the decoded coefficient VALUES | ||
| 105 | +and the number of bits consumed, matching everything observed (wrong pixels | ||
| 106 | +in block2 from coefficient reconstruction AND a real downstream desync). | ||
| 107 | +Next round should range-ladder the coefficient reads themselves (rung 3, | ||
| 108 | +`EC_TRACE_COEFF`, already built by a sibling lane and reusable as-is) at | ||
| 109 | +block2's luma/chroma planes, comparing against `around_rect`'s computed | ||
| 110 | +`skip_ctx`/`dc_sign_ctx` by hand first -- cheaper than a full range-ladder | ||
| 111 | +since there are only 3 reads to check, and the mode-info ladder built this | ||
| 112 | +round proves the harness/methodology works end to end. | ||
| 113 | + | ||
| 114 | +## Hard rules followed | ||
| 115 | + | ||
| 116 | +Worked only in this worktree; `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-sbpart` | ||
| 117 | +every build; foreground `nice -n 19 cargo ... -j4`; `EC_AV1_REQUIRE_AOMENC=1` | ||
| 118 | +on the aomenc-driven run; aomenc recipe unchanged (`--threads=1 --row-mt=0 | ||
| 119 | +--sb-size=64 --enable-tx-size-search=0`, inherited from the existing gate, | ||
| 120 | +not re-typed); oracle rung is env-gated (`EC_TRACE_MODE_STEP`), silent when | ||
| 121 | +unset, added to `scripts/instrument-aom-oracle.sh` not left as a standalone | ||
| 122 | +patch; no other worktree touched; no push, no merge into main. | ||
| 123 | + | ||
| 124 | +## Next round, in order | ||
| 125 | + | ||
| 126 | +1. Range-ladder the three coefficient reads in `decode_block_rect64` for | ||
| 127 | + block2 (luma corner via `TxbSet::Luma64`, then U/V via | ||
| 128 | + `TxbSet::ChromaRect32x16`) against oracle rung 3 (`EC_TRACE_COEFF`, | ||
| 129 | + already built, no new rung needed). | ||
| 130 | +2. Hand-check `around_rect` (decode.rs:2094) against libaom's real | ||
| 131 | + neighbour-gather for skip/dc-sign context on a rect strip's right-hand | ||
| 132 | + block -- compare its span math to `record_rect`'s write span for block1, | ||
| 133 | + which r5 already confirmed correct. | ||
| 134 | +3. Fix, then re-run the full `n_attempts=40` gate and confirm | ||
| 135 | + `sb_rect_hits() > 0` stays a hard pass, not just a compile check. | ||