forge
Explore
Log in

Don't you dare go Hollow

R1 handoff -- real-vs-desync verdict, arms, root cause, gate numbers

Browse files at this commit

199b50b21eb73ae1d9673739854728235069c008Ahmet Kaan GümüşParent: b412012
  • docs
    • r1 handoff -- real-vs-desync verdict, arms, root cause, gate numbers
Show full message
docs(sbab): r1 handoff -- real-vs-desync verdict, arms, root cause, gate numbers
lanes/sbab-r1.handoff.mdadded+112 -0
@@ -0,0 +1,112 @@
1+# lane-sbab r1 handoff — superblock-level inter AB partitions
2+
3+Branch `lane-sbab`, tip `038d1f8` (rebased onto main `cc323d0`).
4+Worktree `/home/user/Documents/Code/Rust/edith_codecs-sbab`.
5+
6+## 1. Real, not our own desync
7+
8+`EC_TRACE=1 aomdec` on `~/.cache/sbab-tmp/s_8_3_y_45.obu` (256x192, 8-bit, cq45,
9+Y-structured source, sp=3) prints, in decode-order frame 4 (an INTER frame; the
10+stream has 12 SB partition reads per frame, entries 49..60 are frame 4):
11+
12+```
13+EC_PART_VAL mi_row=16 mi_col=32 bsize=12 value=4 # PARTITION_HORZ_A at 64x64
14+EC_PART_VAL mi_row=32 mi_col=32 bsize=12 value=5 # PARTITION_HORZ_B at 64x64
15+```
16+
17+bsize=12 is BLOCK_64X64 and values 4/5 are HORZ_A/HORZ_B, so the refusal
18+"an inter SB-level AB partition" named a real stream shape. VERDICT: REAL.
19+
20+## 2. What is implemented
21+
22+`crates/ec-av1/src/decode.rs:21494`, in `decode_inter_frame_tile_with_cdfs`'s
23+64-level partition switch: the four arms in libaom `decode_partition` order
24+(`decodeframe.c`) —
25+HORZ_A = TL 32x32, TR 32x32, bottom 64x32 strip;
26+HORZ_B = top 64x32 strip, BL 32x32, BR 32x32;
27+VERT_A = TL 32x32, BL 32x32, right 32x64 strip;
28+VERT_B = left 32x64 strip, TR 32x32, BR 32x32.
29+The squares reuse the `PARTITION_NONE`-under-SPLIT `decode_inter_block` call
30+verbatim (Luma32/Luma32Inter/Chroma16, TX32/TX16, size group 3, side `BLOCK`);
31+the strips reuse `inter_piece!` (side `SB`, true footprint via `write_w`/
32+`write_h`), which lane-r14's `superblock_level_rect_partition` gate proves.
33+`Reach::vert_ab_partition` is armed for the two VERT arms only (visit order
34+TL,BL,TR,BR changes `has_tr`/`has_bl`). Per-arm counter
35+`SB_AB_INTER_HITS` / `sb_ab_inter_hits_by_arm()` (decode.rs:2222), printed by
36+`examples/decode_probe` as `inter_ab64:`.
37+
38+## 3. The defect the gate found (root cause, shared path)
39+
40+`decode.rs:19128` — `decode_inter_block`'s var-tx branch called
41+`record_split_luma_rect_mi(at, side, side, ...)` with the comment "a var-tx
42+block is always square, so write_w == write_h == side". That premise died when
43+the SB-level rect strips landed (lane-inter4): a 64x32 / 32x64 strip keeps
44+`side = SB` for syntax but is not square, so it stamped `above_side_mi = 64`
45+where libaom's `update_partition_context` writes
46+`partition_context_lookup[BLOCK_32X64]`. The superblock BELOW then computed
47+partition ctx 2 where aomdec reads 3, wrong CDF row, desync at the next symbol.
48+Fixed by passing `write_w, write_h`. Ladder evidence, frame 4 of the stream
49+above, `EC_AV1_TRACE=1` ours vs `EC_TRACE=1` aomdec (aomdec ctx prints as
50+`4*bsl+ctx` = 12+ctx):
51+
52+| mi | oracle ctx | ours before | ours after | oracle pre_rng | ours after |
53+|-----------|-----------|-------------|------------|----------------|------------|
54+| (16,48) | 3 | 2 | 3 | 49168 | 49168 |
55+| (32,0) | 0 | 0 | 0 | 53403 | 53403 (was 60557) |
56+| (32,32) | 2 | 0 | 2 | 42672 | 42672 (was 32906) |
57+
58+After the fix all 72 partition reads of the stream match the oracle in ctx,
59+value and range.
60+
61+Note this is a SHARED-path fix: it changes every var-tx inter block whose
62+footprint is not square, i.e. the SB-level HORZ/VERT/HORZ_4/VERT_4 strips too.
63+Sibling coverage is the full suite run (below), not this gate alone.
64+
65+## 4. Gate
66+
67+`a_real_aomenc_inter_sequence_with_superblock_level_ab_partitions_decodes_pixel_exact`
68+(`crates/ec-av1/src/stream.rs:8375`). 256x192, 6 frames, 20 attempts per bit
69+depth (cq 18/26/34/45/55 x two source orientations x motion step 3/8), aomenc
70+`--sb-size=64 --enable-rect-partitions=1 --enable-ab-partitions=1
71+--enable-1to4-partitions=0 --min-partition-size=32 --max-partition-size=64
72+--kf-max-dist=9999 --cpu-used=0 --threads=1 --row-mt=0`, every decode-order
73+frame compared Y/U/V vs ffmpeg, `oos_mismatch` asserted 0, all four arms
74+asserted to have fired on a pixel-exact attempt.
75+
76+```
77+(8-bit): 0 named refusals, 12 pixel-exact attempts carrying a 64-level inter AB
78+ partition, per-arm HORZ_A/HORZ_B/VERT_A/VERT_B=[6, 5, 4, 2],
79+ 8 attempts carried none (0 of them mismatched)
80+(10-bit): 0 named refusals, 4 pixel-exact attempts, per-arm=[2, 1, 3, 2],
81+ 16 attempts carried none (0 of them mismatched)
82+test result: ok. 1 passed; 0 failed; 418 filtered out; finished in 92.12s
83+```
84+
85+## 5. Refusal state
86+
87+Removed from `refusal_inventory.rs`: `"an inter SB-level AB partition
88+(HORZ_A/HORZ_B/VERT_A/VERT_B; ...)"`, with a comment naming the gate that
89+replaced it. No arm stayed unreachable — all four fired live at both depths, so
90+nothing is left refused by name here. `gate_coverage.rs` needs no change
91+(`enable-ab-partitions` was already covered).
92+
93+## 6. Open residue
94+
95+- deferred(below-8x8 inter leaf desync): a `--tile-columns=1` twin of the 20
96+ attempts PANICS in `mc::from_switchable_symbol` (`mc.rs:203`, a 4th symbol
97+ out of a 3-symbol alphabet) on 8-bit attempt 27 — the exact signature
98+ lane-inter16ab r1 recorded for its own tiled arm. Not this lane's shape; the
99+ tiled axis is excluded with that reason in the gate source rather than
100+ SKIPped. Unblocked by whoever lands the sub-8 inter leaf.
101+- The 64-level 1:4 pair (HORZ_4/VERT_4 at 64) is unrelated and already decoded;
102+ `--enable-1to4-partitions=0` here only keeps the sweep narrow.
103+
104+## 7. Exact next step
105+
106+1. Read `$HOME/.cache/sbab-suite-r1.log` (`systemd-run --user` unit
107+ `sbab-suite-r1`, armed at commit `038d1f8`): confirm N passed / 0 failed.
108+ The var-tx extent fix is repo-wide, so a red sibling there is this lane's to
109+ own, not another lane's.
110+2. If green, merge `lane-sbab` into main and delete the worktree.
111+3. Optional follow-up, not started: film check with the 0.4 s extracts — this
112+ lane never ran one.