Merge lane/av1muchunk422: 12 attempts, 0 entries on the side>64 walks
Browse files at this commit1 changed file +187 -0
- lanes/av1muchunk422.report.md +187 -0
lanes/av1muchunk422.report.mdadded+187 -0
| @@ -0,0 +1,187 @@ | |||
| 1 | +# lane-av1muchunk422 — a witness hunt for the two `side > 64` mu-chunk walks | ||
| 2 | + | ||
| 3 | +Base: `main` @ `6e58730b`. Branch: `lane/av1muchunk422`. | ||
| 4 | + | ||
| 5 | +**Verdict: `12 attempts, 0 entries`.** No 4:2:2 stream reached site 2 | ||
| 6 | +(compound) or site 8 (intra-in-inter). Nothing is pinned, no gate was added, | ||
| 7 | +and `decode.rs` is **unchanged** in this commit — the probes were temporary and | ||
| 8 | +reverted (`git status` clean apart from this report). | ||
| 9 | + | ||
| 10 | +## The two sites | ||
| 11 | + | ||
| 12 | +Both live inside `decode_inter_block` (`crates/ec-av1/src/decode.rs:42122`) at | ||
| 13 | +this base. Line numbers are this base, and the walks themselves are as | ||
| 14 | +`lanes/av1muchroma.report.md` named them — I did not touch them. | ||
| 15 | + | ||
| 16 | +| site | allocation site | enclosing guard | arm | | ||
| 17 | +|---|---|---|---| | ||
| 18 | +| **2** — compound `side>64` mu-chunk | `decode.rs:43954` (`chroma_side * chroma_side`) | `if side > 64` at `decode.rs:43767`, inside the vartx leaf loop of the `if is_compound` branch (`decode.rs:42541`) | compound inter | | ||
| 19 | +| **8** — intra-in-inter `side>64` vartx | `decode.rs:46761` (`chroma_side * chroma_side`) | `if side > 64` at `decode.rs:46563`, in the intra-in-inter section | intra-in-inter inter block | | ||
| 20 | + | ||
| 21 | +The twin **site 5** (single-ref `side>64` mu-chunk) is the same walk in the | ||
| 22 | +`else` branch at `decode.rs:44239`, allocation at `45747`, guard at `45580`. | ||
| 23 | + | ||
| 24 | +### The instrument | ||
| 25 | + | ||
| 26 | +There is no committed counter that names these two walks. `CHROMA_SPLIT_TX_HITS` | ||
| 27 | +fires at all 17 mu-chunk unit sites, so it cannot distinguish site 2 from site 5 | ||
| 28 | +— which is exactly why the prior lane had to write a throwaway probe. | ||
| 29 | + | ||
| 30 | +So I did the same, with an env-gated `eprintln` behind `EC_MUCHUNK422` at | ||
| 31 | +five places (two site probes, three guard probes): | ||
| 32 | + | ||
| 33 | +``` | ||
| 34 | +MUCHUNK422 site=2 arm=compound side={side} ss=({ss_x},{ss_y}) cs={chroma_side} | ||
| 35 | +MUCHUNK422 site=8 arm=intra_in_inter side={side} ss=... cs=... | ||
| 36 | +MUCHUNK422 guard=compound side={side} ss=... nleaves=... | ||
| 37 | +MUCHUNK422 guard=singleref ... | ||
| 38 | +MUCHUNK422 guard=intra_in_inter ... | ||
| 39 | +``` | ||
| 40 | + | ||
| 41 | +The three **guard** probes are what make the zero readable. A site probe that | ||
| 42 | +stays 0 alone cannot say whether the walk was skipped because the arm never ran | ||
| 43 | +at a 128 root or because the inner unit loop never ran; the guard probe sits on | ||
| 44 | +the `side > 64` test itself and separates the two. | ||
| 45 | + | ||
| 46 | +Instrument run via `cargo run -p ec-av1 --example decode_probe` (the existing | ||
| 47 | +"where does a real stream stop" example). All five probes were compiled into | ||
| 48 | +the binary — verified with `strings` on the built artifact before any decode, | ||
| 49 | +so no zero below is a missing-string zero. | ||
| 50 | + | ||
| 51 | +## Non-vacuity: the probes DO fire | ||
| 52 | + | ||
| 53 | +A zero from an unverified instrument is worthless, so the positive controls come | ||
| 54 | +first. Replaying every committed `.obu` in `crates/ec-av1/fixtures` through the | ||
| 55 | +probe binary: | ||
| 56 | + | ||
| 57 | +| fixture | site=2 | site=8 | guard=singleref | guard=compound | guard=intra_in_inter | | ||
| 58 | +|---|---|---|---|---|---| | ||
| 59 | +| `gm_small_side_witness.obu` | **272** | 0 | 140 | **136** | 0 | | ||
| 60 | +| `444_intra_in_inter_128root_mu_chroma.obu` | 0 | **32** | 0 | 0 | **4** | | ||
| 61 | +| `422_sb128_3f.obu` | 0 | 0 | **13** | 0 | 0 | | ||
| 62 | +| `reelc_sb128_inter_witness.obu` | **628** | 0 | 196 | **314** | 0 | | ||
| 63 | +| `W_intrabc.obu` | 0 | 0 | 2048 | **896** | **1792** | | ||
| 64 | +| `X_intrabc_tiled.obu` | 0 | 0 | 2048 | **1792** | 0 | | ||
| 65 | +| `Y_intrabc_10b.obu` | 0 | 0 | 3712 | **3584** | 896 | | ||
| 66 | + | ||
| 67 | +Both target sites and both target arms are live instruments. Site 2's own | ||
| 68 | +report row (2700 hits at 4:2:0) and site 8's (96 at 4:4:4) are consistent with | ||
| 69 | +`gm_small_side_witness` and `444_intra_in_inter_128root_mu_chroma` respectively; | ||
| 70 | +`422_sb128_3f` reproduces the report's site-5 control (`side=128 ss=(1,0) | ||
| 71 | +nleaves=13`, its single `guard=singleref` line). | ||
| 72 | + | ||
| 73 | +One process note, because it nearly produced a fake zero: my first probe edit | ||
| 74 | +went to the **primary checkout**, not the worktree, so the first decode pass | ||
| 75 | +reported `site2=0 site8=0` for all 12 streams — from a binary that contained no | ||
| 76 | +site probe at all. Caught by `strings` on the artifact, primary reverted | ||
| 77 | +(`git checkout -- decode.rs`), probes re-applied inside the worktree, and the | ||
| 78 | +whole decode pass redone. Every number below is from the second, verified pass. | ||
| 79 | + | ||
| 80 | +## The 12 recipes | ||
| 81 | + | ||
| 82 | +Source is `C422` y4m from ffmpeg (`-pix_fmt yuv422p -f yuv4mpegpipe`), three | ||
| 83 | +variants over 384x256 so a 128x128 SB root exists in every superblock column: | ||
| 84 | + | ||
| 85 | +| source | generator | | ||
| 86 | +|---|---| | ||
| 87 | +| `src_384x256_8f.y4m` | `testsrc2=size=384x256:rate=1:duration=8` | | ||
| 88 | +| `src_384x256_noisy_8f.y4m` | `testsrc2=...,noise=alls=24:allf=t` — var-tx pressure | | ||
| 89 | +| `src_384x256_120f.y4m` | `testsrc2=size=384x256:rate=30:duration=4` — real motion | | ||
| 90 | + | ||
| 91 | +Every encode: `aomenc --codec=av1 --profile=2 --input-chroma-subsampling-x=1 | ||
| 92 | +--input-chroma-subsampling-y=0 --obu`, each under `timeout 180`. All 12 encoded | ||
| 93 | +`rc=0`, none timed out. Driver: `run422.sh` (kept out of the commit with `att/`). | ||
| 94 | + | ||
| 95 | +| # | name | recipe beyond the base | out B | site2 | site8 | guard=compound | guard=intra_in_inter | | ||
| 96 | +|---|---|---|---|---|---|---|---| | ||
| 97 | +| 1 | `a1_compound_altref` | `--limit=6 --lag-in-frames=16 --auto-alt-ref=1 --cq-level=18 --cpu-used=0 --sb-size=128` | 16855 | 0 | 0 | 0 | 0 | | ||
| 98 | +| 2 | `a2_compound_gm` | + `--enable-global-motion=1 --enable-warped-motion=1 --lag-in-frames=25` | 16855 | 0 | 0 | 0 | 0 | | ||
| 99 | +| 3 | `a3_compound_masked` | + `--enable-masked-comp=1 --enable-dist-wtd-comp=1 --enable-onesided-comp=1` | 16855 | 0 | 0 | 0 | 0 | | ||
| 100 | +| 4 | `a4_compound_noisy` | gm+warp+masked over the **noisy** source | 327113 | 0 | 0 | 0 | 0 | | ||
| 101 | +| 5 | `a5_compound_slowest` | `--passes=2 --cpu-used=0` + gm/warp/masked/dist-wtd/1to4/rect/ab | 232769 | 0 | 0 | 0 | 0 | | ||
| 102 | +| 6 | `a6_compound_highq` | `--cq-level=0` + gm/warp/masked/dist-wtd/onesided/rect-tx/tx64 | 1209632 | 0 | 0 | 0 | 0 | | ||
| 103 | +| 7 | `b1_iis` | `--enable-interintra-comp=1 --enable-interintra-wedge=1 --enable-smooth-interintra=1` | 16855 | 0 | 0 | 0 | 0 | | ||
| 104 | +| 8 | `b2_iis_noisy` | the same iis trio over the **noisy** source, lag 25 | 327113 | 0 | 0 | 0 | 0 | | ||
| 105 | +| 9 | `b3_iis_both` | iis trio + masked + gm + warp, `--cq-level=10` | 433607 | 0 | 0 | 0 | 0 | | ||
| 106 | +| 10 | `b4_iis_highq` | iis trio, `--cq-level=0`, `--cpu-used=0` | 898199 | 0 | 0 | 0 | 0 | | ||
| 107 | +| 11 | `b5_iis_compound_iis` | iis trio + masked + gm + warp + rect-tx + 1to4, cq 10 | 577010 | 0 | 0 | 0 | 0 | | ||
| 108 | +| 12 | `b6_iis_realtime_but_slow` | iis trio, `--cpu-used=2` | 22383 | 0 | 0 | 0 | 0 | | ||
| 109 | + | ||
| 110 | +All 12 decoded clean: `OK: N frames decoded, 384x256`, zero refusal/panic hits, | ||
| 111 | +every one genuinely 4:2:2 (`cfl_ac: 422=<non-zero>`, `420sq=0`). | ||
| 112 | + | ||
| 113 | +sha256 (first 16 hex): `acc04d638f01ec4a` (1,2,3,7 — byte-identical, see | ||
| 114 | +below), `d5b448a7dca0d246` (4,8), `87baa3d815ab2528` (5), `af19d053ef9c66bd` | ||
| 115 | +(6), `3490b9ab9a42c9af` (9), `14b847d6ba6d37ec` (10), `226758998d8fda08` (11), | ||
| 116 | +`723f55daf5a24487` (12). | ||
| 117 | + | ||
| 118 | +## Why the zero happened — measured, not guessed | ||
| 119 | + | ||
| 120 | +The guard probes give the cause, and it is not what the recipes were aiming at. | ||
| 121 | + | ||
| 122 | +**No 4:2:2 stream I produced ever coded a 128x128 inter block at all.** | ||
| 123 | +`decode_probe`'s `part128` census reads `none=0` on every one of the 12, while | ||
| 124 | +the committed 4:2:2 and 4:4:4 controls that DO reach these walks read: | ||
| 125 | + | ||
| 126 | +``` | ||
| 127 | +12 attempts (all): part128: split=54 none=0 | ||
| 128 | +422_sb128_3f.obu: part128: split=1 none=2 <- reaches site 5 | ||
| 129 | +444_intra_in_inter_128...obu: part128: split=3 none=3 <- reaches site 8 | ||
| 130 | +``` | ||
| 131 | + | ||
| 132 | +`part128: none=0` means aomenc always chose to **split** its 128 superblocks, so | ||
| 133 | +no 128-root inter block exists and `side > 64` is never true in the compound or | ||
| 134 | +intra-in-inter arm. The site is not unreachable; the *encoder* never emitted the | ||
| 135 | +shape. | ||
| 136 | + | ||
| 137 | +Second, subtler: recipes 1, 2, 3 and 7 produced **byte-identical streams** | ||
| 138 | +(`acc04d638f01ec4a`, 16855 B). `--enable-global-motion=1`, | ||
| 139 | +`--enable-warped-motion=1`, `--enable-masked-comp=1`, | ||
| 140 | +`--enable-dist-wtd-comp=1`, `--enable-onesided-comp=1` and the whole iis trio | ||
| 141 | +changed nothing on the `rate=1` source — that source is 8 near-identical | ||
| 142 | +stills, so every inter frame is a trivial skip and the mode search has no | ||
| 143 | +reason to pick anything. Recipe 12 (`--cpu-used=2`) is likewise a different, | ||
| 144 | +near-degenerate stream. So of 12 attempts, **8 distinct bitstreams** were | ||
| 145 | +actually exercised; four were duplicates that bought no coverage. That is on my | ||
| 146 | +recipe design, and it is the clearest thing to fix with another attempt budget. | ||
| 147 | + | ||
| 148 | +## Disposition | ||
| 149 | + | ||
| 150 | +**`12 attempts, 0 entries`.** No witness, no pin, no gate, `decode.rs` | ||
| 151 | +untouched. | ||
| 152 | + | ||
| 153 | +What a next lane with budget should change, since these are the two measured | ||
| 154 | +blockers and neither is a decode-side question: | ||
| 155 | + | ||
| 156 | +1. **Force a 128 inter ROOT, not a split.** `part128: none=0` everywhere. | ||
| 157 | + The committed controls that reach these walks are small frames | ||
| 158 | + (`128x128`, `128x256`) where a 128 SB is the whole frame. A 384x256 frame | ||
| 159 | + gives the encoder room to split, and it always does. Try 128x128 and | ||
| 160 | + 128x256 sources, or content flat enough at cq-level 0 that `NONE` wins the | ||
| 161 | + RD comparison. | ||
| 162 | +2. **Do not reuse the `rate=1` source for the mode flags.** Four of the twelve | ||
| 163 | + were byte-identical. A source with real frame-to-frame motion is a | ||
| 164 | + precondition for compound and interintra to be selected at all; the | ||
| 165 | + `rate=30` variant is the one to keep, and `src_384x256_120f` needs the | ||
| 166 | + higher `--lag-in-frames` recipes applied to it directly rather than a | ||
| 167 | + cq-level/rate-1 variant. | ||
| 168 | + | ||
| 169 | +Both are encoder-recipe facts. Nothing here says the walks are wrong, and per | ||
| 170 | +the standing rule no fix is warranted for an unwitnessed case. | ||
| 171 | + | ||
| 172 | +## Reproduction | ||
| 173 | + | ||
| 174 | +```text | ||
| 175 | +git worktree add ~/.cache/wt/av1muchunk422 -b lane/av1muchunk422 6e58730b | ||
| 176 | +cd ~/.cache/wt/av1muchunk422 | ||
| 177 | +# temporary EC_MUCHUNK422 probes at decode.rs 43767/43946/45580/46563/46746 | ||
| 178 | +CARGO_TARGET_DIR=~/.cache/muchunk422-target cargo build -p ec-av1 --example decode_probe | ||
| 179 | +strings ~/.cache/muchunk422-target/debug/examples/decode_probe | grep 'MUCHUNK422' # 5 probes | ||
| 180 | +bash run422.sh # 12 encodes, timeout 180 each, then decode_probe per stream | ||
| 181 | +``` | ||
| 182 | + | ||
| 183 | +The probes are reverted in this commit, so a fresh checkout reproduces the | ||
| 184 | +encodes but not the counters; re-add the five `eprintln` sites before rerunning | ||
| 185 | +the decode pass. `aomenc` was `~/.cache/aom-oracle/build/aomenc`; ffmpeg is | ||
| 186 | +8.1.3 and, notably, its y4m muxer is spelled `yuv4mpegpipe` (`-f y4m` fails | ||
| 187 | +with "Requested output format 'y4m' is not known"). | ||