forge
Explore
Log in

Don't you dare go Hollow

Two-stage publication on by default

Browse files at this commit

30b0391cfe4f27b5574b64afa537cc8dee06480aAhmet Kaan GümüşParent: 9137abf
  • perf
    • two-stage publication on by default
Show full message
perf(av1): two-stage publication on by default

With the sub-8x8 group predictions deferred, no parse thread reads a
reference pixel at all (instrumented: zero `ref_planes` calls on the
decode threads over both gate segments at 16 threads / 4 filter / 2
recon), so a consumer frame parses its WHOLE tile over its producer's
filter tail instead of the 4.2% that made this flag a wash before.

4K critical chain, interleaved pairs at (16,4,2): off 14450 / 10594 /
14407 ms vs on 12790 / 9207 / 12463 ms -- 11-14% shorter, three pairs
out of three, with wall agreeing (15.74/11.35/15.69 s vs
13.93/10.76/13.92 s). The same interleaving on the pre-lane-sub8group
binary moves 3-7%, so most of the margin is the deferral.

`EC_AV1_TWO_STAGE=0` restores the old publication point. Byte-exact:
the four gate streams at 1, 4, 16(4,2) and 16(3,1) threads with the new
default and at 16(4,2) with the flag forced off, plus six film cuts
base vs new at 16(4,2).
crates/ec-av1/src/stream.rsmodified+11 -12
@@ -1006,18 +1006,17 @@ 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 is OFF by default: it is byte-exact1009+ // lane-twostage publishes a frame's meta at its tile
1010- // and the chain shows the producer tail overlapped,1010+ // boundary instead of after its filters, so a consumer
1011- // but it does not move the wall (the consumer parses1011+ // parses over its producer's filter tail. It is ON by
1012- // only 4.2% of its tile before its first reference1012+ // default since lane-sub8group: with every reference
1013- // pixel read, which is shorter than the tail it1013+ // pixel read deferred to the recon workers, the
1014- // hides). `EC_AV1_TWO_STAGE=1` publishes a frame's1014+ // consumer parses its WHOLE tile before it needs a
1015- // meta at its tile boundary instead of after its1015+ // pixel, and the 4K critical chain shortens by 11-14%
1016- // filters; it pays only once the 8x8-leaf, OBMC and1016+ // in three interleaved pairs (14450/10594/14407 ms off
1017- // sub-8x8-piece predictions are deferred to the recon1017+ // vs 12790/9207/12463 ms on) where it moved 3-7%
1018- // workers as well.1018+ // before. `EC_AV1_TWO_STAGE=0` turns it back off.
1019- crate::envflags::var("EC_AV1_TWO_STAGE")1019+ (crate::envflags::var("EC_AV1_TWO_STAGE").as_deref() != Ok("0"))
1020- .is_ok_and(|v| v == "1")
1021 .then_some(&stage1 as &dyn Fn(_, _, _, _)),1020 .then_some(&stage1 as &dyn Fn(_, _, _, _)),
1022 )?;1021 )?;
1023 // Publish before grain synthesis: every frame waiting on1022 // Publish before grain synthesis: every frame waiting on