forge
Explore
Log in

Don't you dare go Hollow

Merge 8d311870 (wavefront) — suite green: wavefront 628/0

Browse files at this commit

d1bba6cf4a7904364f7d08693b1579d8e230fb3cAhmet Kaan GümüşParent: a708fe5ddf43e8
crates/ec-av1/src/decode.rsmodified+16 -1
@@ -2991,10 +2991,18 @@ pub(crate) struct WaveState {
2991 q: std::sync::Mutex<WaveQueue>,2991 q: std::sync::Mutex<WaveQueue>,
2992 cv: std::sync::Condvar,2992 cv: std::sync::Condvar,
2993 planes: ReconPlanes,2993 planes: ReconPlanes,
2994- /// The two [`FrameCtx`] fields reconstruction reads (`sample_max` is2994+ /// The [`FrameCtx`] fields reconstruction reads (`sample_max` is
2995 /// `bit_depth`'s; everything else a `reconstruct*` needs is in the op).2995 /// `bit_depth`'s; everything else a `reconstruct*` needs is in the op).
2996 bit_depth: u8,2996 bit_depth: u8,
2997 enable_edge_filter: bool,2997 enable_edge_filter: bool,
2998+ /// lane-av1wavefront: the sequence's chroma subsampling. The replay-side
2999+ /// readers -- the deferred chroma builds' `mv_to_q4(.., ss_x(fctx))`
3000+ /// positions and `exec_intra`'s CfL AC signal -- must see the FRAME's
3001+ /// pair, not [`FrameCtx::new`]'s 4:2:0 default: on a 4:4:4 stream the
3002+ /// default halved every worker's chroma reference position and lost the
3003+ /// chroma planes (the 444_sb128rect witness, U 17504 / V 3 at PREFILT on
3004+ /// frame 1) while every 4:2:0 gate stream stayed accidentally exact.
3005+ subsampling: (u8, u8),
2998 last_col: usize,3006 last_col: usize,
2999 }3007 }
3000 3008
@@ -3147,6 +3155,9 @@ fn wave_worker(st: &WaveState, idx: usize) {
3147 let fctx = FrameCtx::new();3155 let fctx = FrameCtx::new();
3148 fctx.bit_depth.set(st.bit_depth);3156 fctx.bit_depth.set(st.bit_depth);
3149 fctx.enable_edge_filter.set(st.enable_edge_filter);3157 fctx.enable_edge_filter.set(st.enable_edge_filter);
3158+ let (sx, sy) = st.subsampling;
3159+ fctx.subsampling_x.set(sx);
3160+ fctx.subsampling_y.set(sy);
3150 let stats = wave_stats();3161 let stats = wave_stats();
3151 let slot = idx.min(WS_SLOTS - 1);3162 let slot = idx.min(WS_SLOTS - 1);
3152 loop {3163 loop {
@@ -3243,6 +3254,10 @@ impl<'a> WaveGuard<'a> {
3243 ),3254 ),
3244 bit_depth: fctx.bit_depth.with(std::cell::Cell::get),3255 bit_depth: fctx.bit_depth.with(std::cell::Cell::get),
3245 enable_edge_filter: fctx.enable_edge_filter.with(std::cell::Cell::get),3256 enable_edge_filter: fctx.enable_edge_filter.with(std::cell::Cell::get),
3257+ subsampling: (
3258+ fctx.subsampling_x.with(std::cell::Cell::get),
3259+ fctx.subsampling_y.with(std::cell::Cell::get),
3260+ ),
3246 last_col: cols - 1,3261 last_col: cols - 1,
3247 });3262 });
3248 let batch = crate::par::Batch::new("ec-av1-recon");3263 let batch = crate::par::Batch::new("ec-av1-recon");
crates/ec-av1/src/stream.rsmodified+7 -0
@@ -10287,6 +10287,13 @@ pub(crate) mod tests {
10287 "reelb_arf_witness.obu",10287 "reelb_arf_witness.obu",
10288 "palette_screen_witness.obu",10288 "palette_screen_witness.obu",
10289 "palette_screen_witness_10bit.obu",10289 "palette_screen_witness_10bit.obu",
10290+ // lane-av1wavefront: the 4:4:4 inter witness. The wavefront's
10291+ // replay-side chroma (`mv_to_q4(.., ss_x(fctx))` in the deferred
10292+ // builds, `exec_intra`'s CfL AC) used to read the worker's fresh
10293+ // `FrameCtx` 4:2:0 DEFAULT instead of the frame's subsampling --
10294+ // invisible on the three 4:2:0 streams above, chroma-only loss on
10295+ // this one (f1 U 17504 / V 3, f2 U 25472 / V 1472 at PREFILT).
10296+ "444_sb128rect_lr_witness.obu",
10290 ] {10297 ] {
10291 let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))10298 let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
10292 .join("fixtures")10299 .join("fixtures")
lanes/av1wavefront.report.mdadded+66 -0
@@ -0,0 +1,66 @@
1+# lane-av1wavefront — defect B fixed: the wavefront replay read frame state off a default-seeded `FrameCtx`; 4:4:4 chroma lost, 4:2:0 accidentally exact
2+
3+## Outcome
4+
5+1. DEFECT B (lanes/av1lrflush.report.md) reproduced and fixed at the source.
6+ `EC_AV1_RECON_THREADS>1` diverged from serial at PREFILT, chroma-only, on
7+ `444_sb128rect_lr_witness.obu` (sha256 `27825e14…61e80`, verified): f1 U
8+ 17504 samples (first (0,1)) / V 3 (first (67,29)), f2 U 25472 (first (0,0))
9+ / V 1472 (first (2,128)), Y byte-exact, f0 exact — the report's own numbers,
10+ re-measured off `EC_AV1_PREFILT_DUMP` runs at recon=2/filter=1 vs
11+ recon=1/filter=1.
12+2. ROOT CAUSE — not a stride/plane-index bug in the write records, and not a
13+ lost op: [`wave_worker`] seeds each recon worker with a FRESH
14+ [`FrameCtx`] (`FrameCtx::new()`), carrying only `bit_depth` and
15+ `enable_edge_filter`. Every replay-side read of the frame's chroma
16+ subsampling therefore saw the CONSTRUCTOR DEFAULT `subsampling = (1, 1)`
17+ (4:2:0) regardless of the sequence. On a 4:4:4 stream the deferred chroma
18+ prediction builds read `ss_x(fctx)` at CLOSURE-RUN time —
19+ `mv_to_q4(px, mv.1, ss_x(fctx))` in the sub-8x8 group's `build_c` (and the
20+ same shape in the 4x4-piece and leaf-8 chroma builds) — so every worker
21+ fetched its chroma reference at HALF the true position: the prediction was
22+ wrong, the recorded op replayed faithfully at the wrong content. `exec_intra`'s
23+ CfL AC read (`cfl_ac_ss(.., ss_x(fctx), ss_y(fctx))`) is the same class one
24+ reader over. Serial is exact because there the closure runs at push time on
25+ the parse thread's real context. Every earlier wavefront gate stream is
26+ 4:2:0, where the default happens to BE the frame's pair — the defect was
27+ invisible to the whole existing recon-threads gate set.
28+3. FIX: `WaveState` carries `subsampling: (u8, u8)`; `WaveGuard::install`
29+ copies it from the tile's `FrameCtx` next to `bit_depth`;
30+ `wave_worker` seeds it into the worker context. All replay-side ss readers
31+ (the three `build_c` closure shapes and `exec_intra`'s CfL) are fixed by
32+ the one field; no recorded op changed shape, no push-site read moved.
33+4. Verified:
34+ - recon=2/filter=1 and recon=4/filter=1 now byte-identical to serial on
35+ all three frames of the fixture (`dump_yuv` output compare; the example
36+ binary rebuilt from this tree).
37+ - Serial byte-identical pre/post fix (same compare against the pre-fix
38+ binary's serial run) — the inline path never constructs a `WaveState`.
39+ - Gate: `444_sb128rect_lr_witness.obu` added to
40+ `a_real_stream_reconstructs_identically_with_one_and_four_recon_threads`
41+ (the 1-vs-4 recon-threads byte-exact gate, per-frame Y/U/V asserts).
42+ Mutation-verified: commenting the worker's `subsampling_x/y.set` seed
43+ makes the gate FAIL exactly on the new fixture ("frame 1 U differs at 4
44+ recon threads") while the three 4:2:0 fixtures still pass — the gate is
45+ non-vacuous and discriminates the class. Fix restored, gate green.
46+ - `cargo check -p ec-av1`: 0 warnings.
47+5. CLASS SWEEP (replay-side `FrameCtx` reads on a worker): enumerated every
48+ fctx read reachable from `exec_op` → `exec_intra`/`exec_mc`/PredBuild
49+ closures: `sample_max` (bit_depth — carried), `enable_edge_filter`
50+ (carried), `subsampling` (this fix), and nothing else —
51+ `reconstruct_mc_rect` reads only `sample_max`; `mc::predict`'s
52+ `interp_filter` read is not in any replay path (the deferred builds pass
53+ the explicitly parsed kernels to `predict_maybe_scaled`; the two
54+ `mc::predict` callers are `#[cfg(test)]` gate code). Parse-side ss reads
55+ run on the parse thread's real context and were never wrong.
56+
57+## Not touched
58+
59+- Entropy band stamping / `read_coeffs_rect` / `decode_rect4_16_strip`
60+ (Agent044's defect A territory) — nothing here lands in entropy code.
61+- Osman4's LR pipeline (proven clean; recon=1/filter=4 stays exact).
62+- The 4:2:0 group-tail chroma SKIP arm (reserved to its owning lane).
63+
64+## State
65+
66+Committed on lane-av1-wavefront. No push.