forge
Explore
Log in

Don't you dare go Hollow

Two-stage reference promises default OFF -- byte-exact, but the overlap is too short to pay

Browse files at this commit

4231093b8dff91a428c87850f85002b5721fbe3aAhmet Kaan GümüşParent: 386b506
  • perf
    • two-stage reference promises default OFF -- byte-exact, but the overlap is too short to pay
Show full message
perf(av1): two-stage reference promises default OFF -- byte-exact, but the overlap is too short to pay

Measured, not assumed. An inter tile parses 4.2% of its own length before its
first `ref_planes` call (seg4k, 272 frames, 16/4/2, instrumented first-touch
timer) because the 8x8-leaf, OBMC and sub-8x8-piece predictions build INLINE
on the parse thread -- only the 16x16-and-bigger blocks go to a recon worker.
So a consumer overlaps ~3 ms of its parse plus its 1.2 ms setup with a
producer tail of ~7 ms per chain frame. The chain report shows exactly that:
the segments now sum to 108% of the chain instead of 101% (the tail IS
overlapped), while the chain itself is unchanged (5621.7 ms vs 5547.2 ms) and
the wall does not move (seg4k at (16,4,2): base 5143/5337/5350 ms vs
5244/5738 ms; at (6,1,1): base 10498/10635/11232 vs 10128/10309/11747).

The machinery stays -- it is byte-exact on all four gate configs and the six
film cuts, and it is the half of the lever that is hard to build. It pays
once the 8x8-leaf/OBMC/sub-8x8 predictions are deferred to the recon workers
too; until then `EC_AV1_TWO_STAGE=1` enables it and the default publishes a
frame's meta after its filters, as before.
crates/ec-av1/src/stream.rsmodified+12 -6
@@ -1006,13 +1006,19 @@ pub fn decode_stream_with_threads(
1006 decode_idx,1006 decode_idx,
1007 shown_idx,1007 shown_idx,
1008 dump.as_deref(),1008 dump.as_deref(),
1009- // lane-twostage kill switch: `EC_AV1_TWO_STAGE=0`1009+ // lane-twostage is OFF by default: it is byte-exact
1010- // publishes a frame's meta where it always was1010+ // and the chain shows the producer tail overlapped,
1011- // (after its filters), for bisecting a mismatch.1011+ // but it does not move the wall (the consumer parses
1012+ // only 4.2% of its tile before its first reference
1013+ // pixel read, which is shorter than the tail it
1014+ // hides). `EC_AV1_TWO_STAGE=1` publishes a frame's
1015+ // meta at its tile boundary instead of after its
1016+ // filters; it pays only once the 8x8-leaf, OBMC and
1017+ // sub-8x8-piece predictions are deferred to the recon
1018+ // workers as well.
1012 crate::envflags::var("EC_AV1_TWO_STAGE")1019 crate::envflags::var("EC_AV1_TWO_STAGE")
1013- .is_ok_and(|v| v == "0")1020+ .is_ok_and(|v| v == "1")
1014- .then_some(())1021+ .then_some(&stage1 as &dyn Fn(_, _, _, _)),
1015- .map_or(Some(&stage1 as &dyn Fn(_, _, _, _)), |()| None),
1016 )?;1022 )?;
1017 // Publish before grain synthesis: every frame waiting on1023 // Publish before grain synthesis: every frame waiting on
1018 // this slot can start the moment the clean picture exists1024 // this slot can start the moment the clean picture exists