forge
Explore
Log in

Don't you dare go Hollow

Lane-sbpart r10 charter -- fix the truncated-corner reconstruction

Browse files at this commit

2a9daf1be4d3871889604e716ce692f9678013efAhmet Kaan GümüşParent: 6ba4dab
  • docs
    • lane-sbpart r10 charter -- fix the truncated-corner reconstruction
    • landing red on the lane is allowed
Show full message
docs(av1): lane-sbpart r10 charter -- fix the truncated-corner reconstruction; landing red on the lane is allowed
lanes/sbpart-r10.charter.mdadded+59 -0
@@ -0,0 +1,59 @@
1+# lane-sbpart r10 — the truncated-corner reconstruction defect
2+
3+At d9a2f81. Read `lanes/sbpart-r9.report.md` — it carries the ranking table, the
4+repro, and the shape of the work it had to throw away.
5+
6+## First, a correction to how I have been chartering this lane
7+r9 implemented the part32 AB arms (HORZ_A/HORZ_B/VERT_A/VERT_B), got them
8+compiling and geometrically correct, then **reverted them with `git stash drop`**
9+because the gate went red — and the gate went red for a reason that had nothing
10+to do with its code. That was my fault, not r9's: my charters kept saying "a
11+branch that lifts a refusal without a gate does not merge to main", and it read
12+as "do not land red". To be explicit:
13+
14+**Landing red ON THIS BRANCH is fine and expected. Only MERGING red is
15+forbidden, and I do the merges.** Commit compiling work even when a gate fails,
16+with the failure named in the commit message. Never `git stash drop` or
17+`git checkout` away a day's work to keep a branch tidy — three rounds across
18+this project have now destroyed real work that way.
19+
20+r9's AB arms mirrored the already-merged inter lane-partab arms and composed
21+`decode_block` (proven 16x16 square leg) with `decode_block_rect` (proven
22+32x16/16x32 strip leg). If you can reconstruct that from the report cheaply, do;
23+if not, it is not this round's job.
24+
25+## The job
26+r9's real finding: `decode_block_rect64` (`decode.rs:3409-3505`) has a
27+**pre-existing real-residual reconstruction bug for TX_32X64/TX_64X32
28+truncated corners**. It was invisible because a later refusal in the same frame
29+always short-circuited the pixel comparison; lifting the part32-AB refusal let
30+the decode run far enough to reach it.
31+
32+That makes it row 1 of the ranking table's blocker: it gates both the part32-AB
33+item and any future SB-level AB / HORZ_4 / VERT_4 work, since all of them pass
34+through the same corner-truncation path. It is the biggest single item in the
35+lane (13 of 25 refusal hits sit behind it).
36+
37+Repro from r9: seed 42, superblock 1, VERT split, `mi_col` 16 and 24 —
38+strip 1 (flat, all-zero residual) diverges mid-block; strip 2 (real nonzero
39+residual) produces a wrong-shaped curve versus both ffmpeg and the oracle. Use
40+`EC_AV1_GATE_DUMP` plus the oracle's `EC_TRACE_MODE`/`EC_TRACE_COEFF` rungs
41+(rung 11 is yours and live) to range-ladder it.
42+
43+Note the shape of the evidence: the symbols were already proven right for this
44+path in r8, and a flat strip diverging means the defect is in **reconstruction
45+geometry** — the corner embed, the stride, or which sub-rectangle of the
46+transform output is written — rather than in the coefficients. Check what
47+libaom actually writes for a truncated 32x64 corner before adjusting ours.
48+
49+## Budget discipline
50+75 turns, no reset on resume. At about turn 55, stop starting new work: commit
51+what you have — red gate included, named as such — and write your report.
52+
53+Hard rules: `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-sbpart`; foreground
54+`nice -n 19 cargo ... -j4`; every `cargo test` a timeout >= 600000 ms;
55+`EC_AV1_REQUIRE_AOMENC=1`; aomenc `--threads=1 --row-mt=0 --sb-size=64` and this
56+gate needs `--enable-tx-size-search=0`. The oracle is SHARED — env-gated rungs
57+only. Sibling worktrees have live agents — never build in or edit them. Never
58+push, never merge into main. End with `lanes/sbpart-r10.report.md`, VERDICT on
59+line 1.
lanes/sbpart-r9.report.mdadded+132 -0
@@ -0,0 +1,132 @@
1+# lane-sbpart r9 report
2+
3+VERDICT: BLOCKED -- ranking delivered, fix attempted and reverted (pre-existing
4+defect discovered, not landed), working tree clean at d9a2f81 (no regression)
5+
6+## Deliverable 1: the 25 refusals, ranked by firing count (40 attempts, seeds 42-81)
7+
8+Gate: `a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_decodes_pixel_exact`
9+(`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib
10+a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_decodes_pixel_exact
11+-- --nocapture --test-threads=1`), baseline result unchanged from r8: **15/40
12+pixel-exact, 25 named refusals, 0 mismatches, sb_rect_hits=36**.
13+
14+| count | refusal | site |
15+|---|---|---|
16+| 13 | "a superblock-level partition type other than NONE or SPLIT (this decoder's intra tile path codes only those two at 64x64)" | `decode.rs:6756` -- SB-level (64x64) AB/HORZ_4/VERT_4 (`partition_w64` values 4-9), intra path only codes NONE/SPLIT/HORZ/VERT |
17+| 6 | "a partition below 16x16 other than a clean split (this decoder codes only the square arms below 16x16)" | `decode.rs:6479` |
18+| 3 | "a 32x32 partition type this decoder does not code (value=4)" | `decode.rs:6681` -- PARTITION_HORZ_A at 32x32 |
19+| 1 | "a 32x32 partition type this decoder does not code (value=6)" | `decode.rs:6681` -- PARTITION_VERT_A at 32x32 |
20+| 1 | "a HORZ/VERT intra strip in a screen-content frame (palette syntax is consumed for square blocks only)" | `decode.rs:2857` |
21+| 1 | "a Golomb tail longer than this decoder reads" | `decode.rs:1229` |
22+
23+The charter's two named targets map onto this table as: the 32x32 `part32` AB
24+values are rows 3+4 above (4/25, values 4 and 6 only -- HORZ_B/VERT_B/HORZ_4/
25+VERT_4 never fired this run); "a superblock-level HORZ/VERT strip with a split
26+transform" (`decode.rs:3409`, tx_depth != 0 under `--enable-tx-size-search=0`)
27+fired **zero** times in this gate's 40 attempts -- the recipe's own flag makes
28+`tx_select` false for every attempt, so `depth` is always forced to 0 and that
29+branch is dead in this gate (still worth keeping as a refusal; a different
30+recipe with tx-size-search on would reach it, but this gate never proves or
31+disproves it). The dominant refusal by far (13/25, 52%) is row 1: AB/HORZ_4/
32+VERT_4 at the SB (64x64) level -- a bigger feature (four more partition types
33+at 64x64, all needing rect prediction plus rect residual, since HORZ_4/VERT_4
34+have no square-only decomposition) than either of the charter's two named
35+items. Order for a follow-on round: (1) row 1 once row-3/4's foundational
36+AB-geometry code exists and is proven (the 64x64 arms are the same four
37+shapes at double scale, reusing decode_block/decode_block_rect the same way);
38+(2) row 2 (a genuinely different capability -- HORZ_B/VERT_B *below* 16x16);
39+(3) rows 5/6 (1 hit each, lowest priority).
40+
41+## Attempted: the 32x32 part32 AB values (rows 3+4)
42+
43+Implemented `PARTITION_HORZ_A`/`PARTITION_HORZ_B`/`PARTITION_VERT_A`/
44+`PARTITION_VERT_B` arms in the part32 `match` (`decode.rs`, right before the
45+`_ =>` refusal at line ~6679), mirroring the already-merged, opus-verified
46+inter arms at the same partition values (`decode.rs:12062` `PARTITION_HORZ_A`
47+etc., lane-partab) but calling the intra primitives already proven pixel-exact
48+at this size: `decode_block` (16x16 squares, the same call `part16 ==
49+PARTITION_NONE` already makes) for the two square legs, `decode_block_rect`
50+(32x16/16x32, the same call the sibling `PARTITION_HORZ`/`PARTITION_VERT` part32
51+arms already make) for the strip leg. `PARTAB_HITS` (existing counter) reused
52+to prove firing.
53+
54+Compiled clean. Gate run: **first attempt (seed 42) failed** --
55+`assert_eq!` on luma at frame 0, first mismatch at `px=91 py=0`
56+(`mi_row=0 mi_col=22`) -- inside the *first strip* (`decode_block_rect64`'s own
57+`PARTITION_VERT` arm for superblock 1, `mi_col=16`, `32x64`, **not** inside my
58+new AB code at all: this superblock's own `partition_w64` value was VERT, no
59+`part32` symbol was ever read for it).
60+
61+## Root cause found (not this round's target, not fixed)
62+
63+Range-ladder against the instrumented oracle
64+(`~/.cache/aom-oracle/build/aomdec`, `EC_TRACE_MODE=1 EC_TRACE_COEFF=1` on the
65+dumped mismatching stream, `EC_AV1_GATE_DUMP`) shows superblock 1's own
66+`PARTITION_VERT` split (two `decode_block_rect64` calls, `bw=32 bh=64`,
67+`mi_col=16` and `mi_col=24`) already diverges from ffmpeg's ground truth at
68+`mi_col=16`'s block, well before any AB code executes:
69+
70+- oracle: strip 1 (`mi_col=16`) is a real all-zero-residual (`eob` implicit
71+ 0) `DC_PRED` block -- flat 81 for its whole 32-wide span (px 64-95).
72+ ffmpeg's own decode matches this exactly.
73+- ours: strip 1 starts diverging from flat 81 at **px 91**, i.e. still inside
74+ its own bounds, 5 columns before strip 2 even begins at px 96 -- ours is not
75+ flat where the bitstream encodes a flat, all-zero-residual block.
76+- strip 2 (`mi_col=24`) has a real, small (`eob=6`, max level ~2) nonzero
77+ residual per the oracle trace; ffmpeg's decode is a smooth monotonic ramp
78+ 81->116 with its visible onset around local column 15 of the strip. Ours
79+ produces a completely different curve (dip to 67, rise, a second dip) over
80+ roughly the same span -- not a shift, not a sign flip, a different shape
81+ entirely.
82+
83+This is a **pre-existing defect in `decode_block_rect64`'s truncated-corner
84+reconstruction for a real (nonzero) TX_32X64 residual**, unrelated to my
85+diff -- superblock 1's own decode does not depend on anything later in the
86+frame, and `PARTAB_HITS` never incremented before this mismatch. It was
87+invisible before this round because in every one of the 25 refusal seeds, an
88+`unsupported(...)` fired *somewhere later* in the same frame's decode
89+(originally, in this exact seed 42, a `part32` value=4 refusal further into
90+the tile), and the gate's `Err(...) => { ... continue; }` arm skips the
91+frame comparison entirely on a named refusal -- so the mismatch this round's
92+fix exposed by letting the decode run further was always there, just never
93+reached. Class: **a removed refusal can uncover an unrelated defect that the
94+refusal was accidentally also shielding** (adjacent to, but distinct from,
95+[[refusal-lifted-without-a-gate]] -- this one *was* gated and *did* prove the
96+new capability's own geometry correct; the newly-visible defect is a sibling
97+function's, not the lifted refusal's own).
98+
99+## Decision: reverted, not landed
100+
101+Given the gate cannot go green until `decode_block_rect64`'s real-residual
102+truncated-corner reconstruction is fixed (a different, deeper defect than
103+either of this round's two named targets, and not something to hand-wave past
104+with a new refusal string wrapping *working, previously-merged* code), I
105+reverted the AB-partition decode arms (`git stash` + `git stash drop`) rather
106+than land a change that turns 25 clean refusals into red assertions. Working
107+tree is clean at `d9a2f81`, identical to the merge point -- **no commit this
108+round, no regression**.
109+
110+## Not attempted
111+
112+- SB-level AB/HORZ_4/VERT_4 (row 1, 13/25 hits) -- the biggest single item,
113+ correctly identified as next by the ranking, not started (budget went to
114+ the charter's own two named targets first, per instruction).
115+- The `decode_block_rect64` real-residual defect above -- found this round,
116+ not fixed; it blocks BOTH the part32 AB item (my attempt) and, by the same
117+ code path, any future SB-level AB/HORZ_4/VERT_4 work, since those would also
118+ produce 64x64-corner truncated blocks with real residuals through the same
119+ function. **This is now the actual highest-priority item for r10**, ahead of
120+ the ranking table above -- fixing it may also silently raise the 15/40 match
121+ rate on the *already-passing* HORZ/VERT cases that happen to have been
122+ lucky (all-zero or small enough residual to not show the bug).
123+
124+## Hard rules followed
125+
126+Worked only in this worktree; `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-sbpart`
127+every build; `nice -n 19 cargo ... -j4`; `EC_AV1_REQUIRE_AOMENC=1` on every
128+gate run; aomenc recipe unchanged (`--threads=1 --row-mt=0 --sb-size=64
129+--enable-tx-size-search=0`, inherited from the gate); read-only use of the
130+shared `~/.cache/aom-oracle` (already instrumented, no rebuild needed this
131+round); no other worktree touched; no push, no merge into main; nothing
132+committed (reverted before landing).