Commits
Commits on
c604fcdcd083c48212bb3e8f56c48edf7b5f502a2026-09-05
Merge branch 'lane-pipefilt2' (69fbe27b): loop restoration pipelined as a second filter-pool worker one CDEF band behind (RU row ready when CDEF band (v_end-1)/64 is done); byte-exact on 16 gate hashes + 6 film cuts; -3% wall at one frame thread, flat at sixteenAhmet Kaan Gümüş · c604fcdBrowse files
perf(av1): run the pipelined loop restoration as its own workerAhmet Kaan Gümüş · eca8ad9
perf(av1): run the pipelined loop restoration as its own worker Serialised as a fourth step inside pipe_run's band loop, LR measured ~1% slower than the whole-frame form (which at least spread its RU rows over the filter pool). A second batch task, chained one CDEF band behind the first through its own PipeSync, keeps it off the deblock/CDEF critical path instead.
perf(av1): loop restoration joins the per-superblock-row filter pipelineAhmet Kaan Gümüş · 013daf3
perf(av1): loop restoration joins the per-superblock-row filter pipeline Restoration-unit row r writes out rows v_start..v_end, reads post-CDEF rows only inside that span and the post-deblock snapshot at most two rows past v_end, so it is ready as soon as CDEF band (v_end-1)/64 is done -- the same pipeline iteration, right after that band's CDEF. The snapshot condition ((v_end+1)/64 <= k-2) is implied, the two row indices being at most one band apart. apply_loop_restoration_plane grows an RU-row range; the whole-frame form is unchanged and stays for the fallback path (superres, key frames, EC_AV1_PIPE_FILTERS=0). Byte-exact on the 16 gate hashes.
Merge branch 'lane-pipefilt' (7cdd977a): deblock and CDEF pipelined per superblock row behind the wavefront (iteration k: deblock-V(k), deblock-H(k-1), snapshot(k-2), CDEF(k-3)), released at each SB row from per-row wavefront completion; whole-frame path kept for superres/segmentation/delta_lf/multi-column/key frames and EC_AV1_PIPE_FILTERS=0; byte-exact on 16 gate hashes + 6 film cuts; wall -2.3% at the composed settingAhmet Kaan Gümüş · 551e13eBrowse files
Merge branch 'lane-migrid' (088359d4): mode-info cell mvs stored as i16 pairs (spec MV width), cell 24 -> 16 bytes with the Option niche kept; a separate packed storage type measured worse and was dropped; byte-exactAhmet Kaan Gümüş · 351fda0Browse files
perf(av1): memoise the deblocker's level LUT per plane and passAhmet Kaan Gümüş · 4dff42a
perf(av1): memoise the deblocker's level LUT per plane and pass `EdgeCtx::new` builds `lf_level` over the whole (base level, ref frame) domain -- 960 calls -- and the row pipeline builds an `EdgeCtx` per superblock-row band instead of per frame, which turned ~20 builds a frame into ~680 and cost +1.0% instructions:u on seg4k. The table is a pure function of the frame's LoopFilterParams, the plane, the pass and segment 0's own SEG_LVL_ALT_LF_* datum (the only thing `lf_level` reads out of the FrameCtx at segment_id = 0), so it is memoised per thread under exactly that key. seg4k at 16/(4,2): instructions:u 407.33 G -> 403.27 G, i.e. back to the pre-pipeline 403.30 G.
test(av1): the clamp gate's candidate is far outside the frame but inside the spec's MV widthAhmet Kaan Gümüş · 3ec98b7
test(av1): the clamp gate's candidate is far outside the frame but inside the spec's MV width lane-migrid: the fixture stored 100000 in a motion vector, which the spec (and libaom's own int16_t `MV`) cannot represent; 30000 is still far past this 16x16-px frame's clamp window, so the expected clamped value is unchanged.
Merge branch 'lane-picalloc' (a7153af4): new frame planes allocated uninitialised instead of zero-filled; EC_AV1_PLANE_SENTINEL=1 fills 0xDEAD and hashes identically on every gate stream and film cut, proving every sample is written before read; -2% task-clock single-threadAhmet Kaan Gümüş · 5e5cc09Browse files
perf(av1): the frame's plane buffers are no longer zero-filled at the frame headAhmet Kaan Gümüş · f982308
perf(av1): the frame's plane buffers are no longer zero-filled at the frame head The new frame's three plane buffers (25 MB at 4K) were allocated with `vec![0u16; n]` at the very top of both frame decoders, serially on the frame thread, before any tile work: 3.2% of frame-thread cycles spent in memset on a surface the tile walk overwrites sample-for-sample. `fresh_plane` hands out the same capacity uninitialised instead. The proof that no unwritten sample reaches the output is `EC_AV1_PLANE_SENTINEL=1`, which fills with 0xDEAD (above any legal clamped sample): the four gate streams and the six film cuts hash identically with the zero fill, with the sentinel fill and uninitialised, at 1, 4 and (16,4,2) threads.
perf(av1): the mi grid's cell is 16 bytes -- MiInfo motion vectors ride as i16Ahmet Kaan Gümüş · 3c15699
perf(av1): the mi grid's cell is 16 bytes -- MiInfo motion vectors ride as i16 `MiInfo` is written per 4x4 cell for every coded block and read by every MV stack scan, so the cell's size is that scan's memory traffic. Both motion vectors now ride as `i16` pairs, which is libaom's own `MV` (`int16_t row, col`) and the spec's MV range, taking the cell (and `Option<MiInfo>`, whose niche still lives in `is_inter`) from 24 bytes to 16 and the grid's index arithmetic from a multiply to a shift. `mv32`/`mv16` widen/narrow at the handful of producer/consumer sites; `mv16` debug-asserts the range. `MiGrid::get`/`get_frame` return the cell by value now (16 bytes, one move) instead of by reference. Measured on the 4K segment, interleaved ABAB: instructions:u -0.03% at 1 thread and -0.09% at (16,4,2), task-clock:u lower in 3/3 threaded pairs (-1.6%/-9.4%/-3.2%, box loaded, so the sign is the claim, not the size). All 12 gate hashes unchanged at 1/4/16 threads.
perf(av1): run the loop filters per superblock row, pipelined behind reconstructionAhmet Kaan Gümüş · 7fd0e67
perf(av1): run the loop filters per superblock row, pipelined behind reconstruction
The frame's filters used to run only once the whole tile was parsed and
reconstructed: the tile loop ended, the wavefront drained, and then
apply_deblock / plane_snapshot / apply_cdef walked the whole picture on the
frame thread. With ~2.5 frames in flight the wall tracks that frame thread's
own latency, and the whole-frame filter stage is ~19% of it. dav1d and libaom
instead run the filters a few superblock rows behind reconstruction, so the
filter work overlaps the parse.
DEPENDENCY SHAPE (a band = 64 luma rows = one superblock row; derived from
this decoder's own whole-frame order: all vertical deblock edges, then all
horizontal ones, then CDEF, then superres, then loop restoration):
* intra prediction of band r+1 reads the UNFILTERED bottom rows of band r,
so no filter may touch band r until band r+1 is fully reconstructed:
V(r) waits for ready >= r+2.
* the horizontal edge at y = r*64 reads and writes 6-7 rows either side of
the band boundary, so H(r-1)'s last edge reaches into band r, which the
whole-frame order has already vertical-filtered. Running V(r) before
H(r-1) reproduces that exactly.
* band j's own bottom rows are still rewritten by H(j+1)'s first edge, so
j's post-deblock snapshot may only be taken after H(j+1).
* CDEF(j) reads the post-deblock picture 2-3 rows across its 64x64
boundaries, i.e. bands j-1..j+1, so it runs after snap(j+1).
Iteration k therefore runs V(k), H(k-1), snap(k-2), CDEF(k-3), on the filter
pool, released by the frame thread at every superblock row start from the
wavefront's own per-row completion (WaveQueue now tracks the last column
parsed and the last job pushed per row, so a row that recorded no write still
counts as complete). Rows still pending at the end of the tile loop are
drained there; loop restoration, the superres upscale, motion field and grain
stay in the frame thread's tail, and LR reads the snapshot the pipeline built
band by band (whole rows when CDEF is on, else only the four rows per stripe
boundary plane_snapshot copied).
Kept whole-frame, and counted (EC_AV1_WAVE_STATS prints pipe=<pipelined>/<frames>):
superres frames (a whole-plane resample between CDEF and LR), segmentation
(the deblocker reads seg_ids while the parse thread is still filling it),
delta_lf, more than one tile COLUMN, every pixel-dump/stage-skip debug flag,
and the (1,1) thread setting -- where the filters would move to a worker
thread for nothing and the crate's thread_local gate counters would miss them.
EC_AV1_PIPE_FILTERS=0 forces the whole-frame path. Key frames keep it too:
only the inter tile decoder is wired.
Byte-exact: the 12-hash gate at 4 and at 16/(4,2) reproduces every reference
hash; seg4k reports pipe=272/272.Merge branch 'lane-grainfix' (407d32a2): film grain add_noise_to_block returns early on an empty region -- a chroma height of 16k+1 with overlap sliced one row past the plane; independent spec 7.18.3.4/5 stripe oracle test at ragged sizes; gate streams unchangedAhmet Kaan Gümüş · a360df6Browse files
Merge branch 'lane-publish' (495bee05): the four skip/pu-edge mode-info maps packed into one cell (one row fill instead of four), neighbour gathering in one pass for all three planes; byte-exact, -0.6% instructionsAhmet Kaan Gümüş · 545e09fBrowse files
Merge branch 'lane-blockscratch' (f579f8e1): inter-block level grids as a Grid enum pointing at the static zero residual when nothing was coded, chroma unit collectors filled lazily, var-tx leaf list borrowed instead of cloned; byte-exact, -0.6% instructionsAhmet Kaan Gümüş · 8393c45Browse files
Merge branch 'lane-msac2' (f8f56624): two-symbol fast path in the arithmetic decoder, literals read through it, general CDF walk stops one candidate early and counts the probability floor down; pinned by a lockstep test against the spec-literal walk; byte-exact, -0.15% instructionsAhmet Kaan Gümüş · 2a3546aBrowse files
fix(av1): film grain panicked on a zero-row overlap block at the ragged tailAhmet Kaan Gümüş · 6b9fb3c
fix(av1): film grain panicked on a zero-row overlap block at the ragged tail A picture whose chroma plane height is 16k+1 (luma height 32k+2) makes the last block row's `half_h` zero under `overlap_flag` -- the single tail row IS the overlap row, already written by the line-buffer call -- and the block's row base `py0 * y_stride` then addresses one row past the plane, so slicing it panicked with "range start index out of range". Spec 7.18.3.5 runs the block's noise loops `for i in 0..h`, so a block with no rows (or no columns, the 16k+1-wide twin) writes nothing: return before any slice is formed. The new gate builds the noise image from an independent transcription of 7.18.3.4/7.18.3.5 (per-stripe horizontal overlap, stripe-to-image vertical overlap) and compares 64x66, 66x64, 64x98 and a 48x100 control sample for sample; it panics without the fix. The 12 decode hashes are unchanged.
perf(av1): one packed cell for the four skip/pu-edge mi maps, one pass for around_miAhmet Kaan Gümüş · dcb88a2
perf(av1): one packed cell for the four skip/pu-edge mi maps, one pass for around_mi Block publication walked the same mi rectangle once per map. `skip`, its written-instrument bit, and the covering block's origin and dims are written by `fill_skip_grid_rect` and by nothing else, so they become one 8-byte `BlkCell` and one fill per row instead of four -- the deblocker's `pu_edge` also reads origin and dims off one cache line now. `around_mi`/`around_mi_rect` gathered the neighbour coded/DC-sign state one plane at a time, so the three planes of a cell (one `[Neighbour; 3]`) were loaded three times; one pass over the cells accumulates all three. Byte-exact: 12/12 gate hashes at 1, 4 and 16 threads. seg4k instructions:u 405.019 -> 402.414 G at 1 thread (-0.64%) and 408.299 -> 405.731 G at (16,4,2) (-0.63%); task-clock at (16,4,2) 41.08 -> 40.78/41.03 s interleaved.
perf(av1): a plane that codes nothing names the shared zero grid instead of allocating oneAhmet Kaan Gümüş · 833833b
perf(av1): a plane that codes nothing names the shared zero grid instead of allocating one `decode_inter_block` built its three block-level coefficient-level grids as fresh `Vec`s (up to 64 KB for a 128x128 luma block) even when the plane coded nothing at all -- a skipped block, a strip that is not the chroma reference, luma under a var-tx split whose leaves already wrote their own contexts. The three bindings become a `Grid` enum that derefs to `[i32]`: `Grid::Zero(n)` points at the existing `ZERO_RESIDUAL` static, so those blocks allocate and memset nothing, and the block-tail neighbour writes are byte-identical. Two more per-block allocations go with it: the mu-chunk chroma collectors (`u_units`/`v_units`) were allocated and zeroed by every var-tx block although only a block above 64 px on either side ever writes into them -- they are now filled in by the first unit that does; and the leaf loop's `vartx_leaves` list is borrowed instead of cloned per block. The skipped luma/chroma units of the intra var-tx path take the same zero grid. Byte-exact: all 12 gate hashes (4 streams x 1/4/16 threads, the 16-thread arm with 4 filter and 2 recon threads) equal the reference. instructions:u on the 4K segment 405.018 -> 402.630 G at 1 thread (-0.59%) and 408.381 -> 405.961 G at (16,4,2) (-0.59%). Measured and reverted: pooling the six compound-prediction intermediates per thread was flat (-0.04% / +0.05%), and moving the sub-8x8 4x4 prediction buffers to the stack was flat both ways -- those paths are cold on this stream.
perf(av1): the arithmetic reader takes its two-symbol shape straightAhmet Kaan Gümüş · 864a703
perf(av1): the arithmetic reader takes its two-symbol shape straight Most symbols the tile reader reads are two-symbol: every flag, and every bit of a literal, which coded its bit through the general alphabet walk against a fixed equiprobable CDF. That walk set up a loop, tested two candidates and multiplied out the `EC_MIN_PROB` floor to read one boundary. `symbol_fixed` now computes that single boundary directly for a two-symbol alphabet and `literal` reads its bits through the same path, where the range multiply is a shift. The general walk keeps its loop but stops one candidate early: the last boundary is always `CDF_TOP`, whose interval end is zero, so the last candidate needs no test and its arithmetic is the fall-through. The `EC_MIN_PROB` floor counts down instead of being multiplied per candidate. The renormalisation tail all three paths share is one inlined helper. Byte-exact: the four gate streams hash identically at 1, 4 and (16,4,2) threads. A new lockstep test decodes 20k mixed symbols and literals twice -- once through the fast paths, once through the spec-literal 8.2.6 walk kept in the test -- and compares the symbol, the adapted CDF and the coder's (range, value) after every read. instructions:u at one thread: 1080p 131.684 -> 131.442 G (-0.18%), 4K 405.018 -> 404.483 G (-0.13%). Cycles were not usable as a verdict this session (box load ~15-35, base repeated to +-14% on cycles while instructions repeated to 0.0002%).
Merge branch 'lane-grain2' (9a81110c): film grain no longer clones the clean picture on the frame thread; each band copies its rows one block row ahead of the noise into an uninitialised destination (ragged tails covered, pinned by test); byte-exact incl. a 4K film cut, task-clock -1..-4% at the composed settingAhmet Kaan Gümüş · f89b1a2Browse files
perf(av1): film grain writes its output once, from the bandsAhmet Kaan Gümüş · 8db0d01
perf(av1): film grain writes its output once, from the bands apply_grain cloned the whole clean picture on the frame thread and then wrote the noise over the copy -- a serial 25 MB memmove per 4K frame ahead of the parallel block-row walk. The grain bands already own a partition of the picture's rows, so each band now copies its own rows out of the clean source one block row AHEAD of the noise it adds to them: the copy runs on the filter pool, the rows the kernels read back are still in the core's cache, and the destination is allocated uninitialised instead of cloned or zeroed. Byte-exact: 12/12 gate hashes at 1, 4 and 16 threads, plus a real film-cut decode at (16,4,2) hashing identical to the base binary. seg4k at (16,4,2), 4 interleaved rounds: task-clock 48.50/47.07/46.62/45.34 s base -> 46.44/45.12/45.74/44.76 s, -1.3..-4.2% every round; instructions 408.385 -> 408.404 G (flat); page-faults flat. At 1 thread task-clock 36.98 -> 32.41 s.
Merge branch 'lane-blockmem' (43f29bb0): skipped blocks describe themselves through the static zero residual instead of allocating zero grids, the all-zero marker skips the coefficient arena copy, recon op list keeps its capacity across superblocks, prediction buffers refilled in place; byte-exact, -1.6% instructions at the composed settingAhmet Kaan Gümüş · cb9db45Browse files
perf(av1): the wavefront's op list and prediction buffers are reused per blockAhmet Kaan Gümüş · e1f00c9
perf(av1): the wavefront's op list and prediction buffers are reused per block `wave_submit` took the recorded op list and left a zero-capacity `Vec` behind, so every superblock regrew it -- and memmoved every op already recorded -- from nothing; it is now replaced sized for the next superblock, exactly as the two arenas beside it already were. A deferred prediction build returned three fresh `Vec<u16>` per block and dropped the previous three; the build now refills the buffers the worker already holds (`refill`, which still allocates zeroed when the buffer has to grow, since `calloc` beats an element-wise resize). Byte-exact 12/12 at 1/4/16 threads. seg4k instructions:u at (16,4,2) 409.809 -> 408.259 G (-0.38%); at 1 thread 404.579 -> 405.005 G (+0.11%, the inline path has no previous buffer to reuse and pays the plumbing) -- kept for the threaded config the 4K target names.
perf(av1): skipped blocks stop allocating and copying their zero coefficient gridsAhmet Kaan Gümüş · bccf2c8
perf(av1): skipped blocks stop allocating and copying their zero coefficient grids A skipped block handed every consumer a freshly heap-allocated all-zero level grid -- up to 64 KB per block, three of them for the neighbour record and one per plane for the recorded write. Those buffers are read-only at every consumer, so they are now the existing static `ZERO_RESIDUAL` slice: `Neighbours::record*` takes `&[&[i32]; 3]` instead of owning Vecs, and the 53 `&vec![0i32; n]` argument temporaries index the static instead. `Residual::done` recognises that slice by pointer and records the all-zero marker `Done(0, 0)` (the one `Residual::coeffs` already produces), so a skipped block no longer copies its zeros into the coefficient arena either. Byte-exact 12/12 at 1/4/16 threads. seg4k instructions:u 414.794 -> 409.809 G at (16,4,2) (-1.2%), 406.145 -> 404.579 G at 1 thread (-0.39%); page-faults 1.034 -> 1.014 M at (16,4,2).
Merge branch 'lane-coef2' (ff2e57f5): padded coefficient level buffers (stride side+4) make neighbour context reads unconditional, rectangular reader on a stack frame with shift/mask; geometry test covers every transform size; byte-exact, -0.5% instructionsAhmet Kaan Gümüş · afb2b38Browse files
Merge branch 'lane-mvstack2' (ca82eb33): mv stacks on an inline small-vector (no heap per block), MiGrid published per block by row fills, MiInfo 32 -> 24 bytes with a slot-1 sentinel (Option niche kept, pinned by test); byte-exact, -0.5% instructions and -1.4% task-clock at the composed setting. Conflict with lane-mf resolved: banded motion-field build keeps the sentinel slot-1 readAhmet Kaan Gümüş · a63d087Browse files
perf(av1): padded coefficient level buffers, stack-allocated rect levelsAhmet Kaan Gümüş · 3fdf4ac
perf(av1): padded coefficient level buffers, stack-allocated rect levels read_coeffs / read_coeffs_rect pad their level buffer the way libaom's own does (TX_PAD_HOR/TX_PAD_VER): a fixed stride of side + 4 columns and four spare rows, all zero and never written, so the five neighbour reads base_ctx/br_ctx make per coefficient index the buffer unconditionally instead of running the row >= side || col >= side edge test. The rect reader's per-unit heap vec![0; w * h] becomes a stack frame sized to the padded unit, and its pos / w, pos % w a shift and a mask. Byte-exact: 12/12 gate hashes at 1/4/16 threads. instructions:u on the 4K segment -0.53% at one thread (412.376 -> 410.195 G) and -0.51% at (16,4,2) (422.503 -> 420.353 G).
perf(av1): 24-byte mi grid cellAhmet Kaan Gümüş · 5ba1d08
perf(av1): 24-byte mi grid cell `MiInfo` is one cell per 4x4 unit of the frame and `find_mv_stack` walks it for every inter block, so the cell's size is that scan's memory traffic. The second reference slot carried two `Option` tag words (`ref_frame1`, `mv1`); slot 1 only ever holds a real reference, so `NO_REF1` (-1) tags it absent and `mv1` becomes a plain pair -- 32 -> 24 bytes, `is_inter` still giving `Option<MiInfo>` a niche so the grid cell costs no extra word. An interintra neighbour (slot 1 = INTRA_FRAME, no second MV) was excluded by its `mv1` being `None` and is now excluded by `ref_frame1 > 0`, the same condition libaom's own ref-diff scan uses. Byte-exact: all 12 gate hashes (4 streams x 1/4/16 threads) unchanged. instructions:u on the 4K segment 410.629 -> 410.478 G at 1 thread, 419.746 -> 419.481 G at (16,4,2); task-clock at (16,4,2) 42.41 -> 41.81 s against the lane base.
Merge branch 'lane-mf' (72fe2c59): motion field build hoists the per-ref side test to a per-frame table and runs in row bands over the filter pool; byte-exact, -0.55% instructions at the composed settingAhmet Kaan Gümüş · 413bfc9Browse files
perf(av1): the saved motion field builds off the frame thread, one other-side table per frameAhmet Kaan Gümüş · 259f3b7
perf(av1): the saved motion field builds off the frame thread, one other-side table per frame `build_motion_field` (libaom `av1_copy_frame_mvs`) was a serial whole-frame 4x4-unit pass on the frame thread that re-evaluated the `other_side` order-hint comparison for every reference slot of every inter unit. Two changes, both output-identical: * the per-reference `other_side` answer is a `[bool; 8]` computed once per frame instead of two `get_relative_dist` calls per inter unit; * the pass is split into cell-row bands over the filter pool with the existing `par::bands`/`Shared`/`run_bands` pattern. An 8x8 motion-field cell lives entirely in one cell row, so a band owns `cells[r0 * cols..r1 * cols]` and no two bands ever touch the same cell -- the write order inside a band is unchanged, so the "last qualifying slot wins" and "clear-then-maybe-write" semantics are preserved exactly. The field is consumed only by LATER frames, never by this frame's entropy decode; it is published as part of `SlotValue` at `SlotPromise::fulfil`, so it cannot be deferred past the fulfil without splitting that publication. seg4k, 4dc14f52 -> here: instructions:u 412.358 -> 410.565 G at 1 thread (-0.44%, the hoist alone -- bands collapse to 1 at FILTER_THREADS=1) and 421.45 -> 419.13 G at (16,4,2) (-0.55%). All 12 gate hashes unchanged at 1, 4 and 16 threads.
perf(av1): heap-free MV stack and row-fill mi publicationAhmet Kaan Gümüş · fc982db
perf(av1): heap-free MV stack and row-fill mi publication The MV stack was two heap allocations per inter block (`entries` plus `drl_ctx`); both lists are bounded by a spec constant, so they move into a fixed-capacity inline `SmallVec` that derefs to the same slice API. Mode-info publication stamped its block footprint cell by cell through `MiGrid::set`; rows are contiguous, so `MiGrid::fill_rect` fills each row with one `slice::fill` of the `Copy` cell instead. Byte-exact: all four gate streams hash unchanged at 1 thread. instructions:u on the 4K segment 412.376 -> 410.629 G at 1 thread, 421.419 -> 419.746 G at (16,4,2).
Merge branch 'lane-recoparse' (9cdc32d8): recorded reconstruction ops index per-superblock coefficient/prediction arenas moved into the wavefront job (no Vec per transform unit, no cross-thread free), empty inter residual reconstructs as a prediction copy; byte-exact, -1.3% instructions at the composed setting on the 4K segmentAhmet Kaan Gümüş · 5b55d04Browse files
Merge branch 'lane-intra' (9611873e): intra prediction one loop per mode instead of a 13-arm match per sample, directional walk hoisted per zone, edge buffers on the stack; byte-exact, -2.9% instructions on the 4K segment, -2.1% on 1080pAhmet Kaan Gümüş · 84ddd14Browse files
Merge branch 'lane-tpl' (9c6fbbf1): temporal mv probe hoisted per block (parity derivation collapses to one shifted index, pinned by a spec-enumerating test), compound stack reads the cell once; four per-block gate counters thread-local instead of process-global atomics; byte-exact, -0.2% instructions on the 4K segmentAhmet Kaan Gümüş · dc919eaBrowse files
perf(av1): hoist the temporal-MV probe out of the per-sample loop, thread-local the mvstack gate countersAhmet Kaan Gümüş · e08e4e4
perf(av1): hoist the temporal-MV probe out of the per-sample loop, thread-local the mvstack gate counters `add_tpl_ref_mv` re-derived the parity, the field bounds and the row base on every one of the (up to 19) 8x8 probes a query block makes. Those are per-BLOCK quantities: `row8 = mi_row + blk_row + (mi_row even)` means the cell index is `(mi_row + 1 - (mi_row & 1) + blk_row) >> 1`, and an arithmetic shift keeps the spec's `row8 < 0` rejection exact. `TplProbe` holds the two bases plus the cell slice, so a probe is an add, a shift and a bounds check; the compound stack reads the cell ONCE and projects it to both sides instead of walking the field twice. `EC_TRACE_TPL`'s per-sample dump is unchanged: the flag is read once per block and the traced path still goes through `add_tpl_ref_mv` itself. The four mvstack firing counters (`TMV_HITS` per inter block, `STACK_FULL_DROPS` per candidate insertion, `COMP_GM_FILL_HITS`, `TILE_REACH_CLIPS`) were process-global atomics: one shared cache line bumped by 16 frame threads on the parse critical path. They are now thread-local `Cell`s, the form every other gate counter in the crate already uses; the gates that read them decode on their own thread. -0.21% instructions on the 4K segment at 1 thread (443.29 vs 444.24 G); the counter step is flat there and inside the box's noise at 16 threads. Byte-exact: all 12 gate hashes unchanged at 1/4/16 threads.
Merge branch 'lane-mc2' (c0a73b93): MC kernels take (src_stride, rows) and set up taps + dispatch once per block, whole-pel-horizontal predictions run the vertical pass straight off the reference with taps x16 (exact, pinned by test), interior test hoisted out of the row loop; byte-exact, -2.8% instructions on the 4K segmentAhmet Kaan Gümüş · 26ac3e0Browse files
perf(av1): an all-zero inter residual reconstructs as a prediction copyAhmet Kaan Gümüş · c5b674a
perf(av1): an all-zero inter residual reconstructs as a prediction copy `reconstruct_mc_rect` expanded the empty all-zero marker into a `side * h` slice of the 64 KB `ZERO_RESIDUAL` static and added those zeros sample by sample -- for 60% of the units. The zero case now runs the same clamp without the residual operand (identical arithmetic at `r == 0`; the prediction->plane copy the charter names is kept). instructions:u on the 4K segment: 453.00 G -> 450.45 G at (16, 4, 2) threads, 444.33 G -> 441.90 G at one thread.
perf(av1): intra edges on the stackAhmet Kaan Gümüş · ee5b8d8
perf(av1): intra edges on the stack An edge is at most bw + bh + 1 = 129 samples, so Edges holds two arrays instead of two heap buffers, and the edge filter's working copy is a stack array too: two allocations gone per predicted block, on a stream whose intra blocks are mostly 4x4 to 16x16. Byte-exact on all four gate streams; -0.07% instructions on the 4K segment, -0.08% on the 1080p one (malloc latency does not show on instructions:u).
perf(av1): recorded reconstruction ops index per-superblock arenas instead of owning a Vec eachAhmet Kaan Gümüş · ba6ddd4
perf(av1): recorded reconstruction ops index per-superblock arenas instead of owning a Vec each A recorded transform unit copied its coefficient grid (`grid.to_vec()`) and a recorded motion-compensated write copied its prediction window into a fresh `Vec`, both on the parse thread, both freed on a recon worker: ~7.1 M malloc/free pairs across the 4K segment, with `_int_malloc` on the frame thread and `_int_free_chunk` on the workers. The tile now carries two arenas (`FrameCtx::coeff_arena`, `pred_arena`); a record is an `(offset, len)` into them. They are handed over WITH the ops at both drain points -- `wave_submit` moves them into the job (`ReconJob`), so one buffer per superblock reaches the worker instead of one per unit, and `flush_recon` swaps them through spares -- which keeps every offset relative to the live arena and every write byte-identical. instructions:u on the 4K segment at (16 frame, 4 filter, 2 recon) threads: 456.25 G -> 453.00 G (-0.72%); wall on this box is load-dominated and does not resolve it.
perf(av1): directional intra hoists the zone, the derivative and the blend out of the pixel loopAhmet Kaan Gümüş · e7ac08e
perf(av1): directional intra hoists the zone, the derivative and the blend out of the pixel loop The z1/z2/z3 walk decided its zone, looked the derivative up in a 27-arm match and called the edge blend through a `&dyn Fn` once per sample. Three loops, one per zone, with the derivative and the base constants per block and z1's shift per row; the blend indexes the edge slice directly. Byte-exact on all four gate streams. -0.25% instructions on the 4K segment, -0.47% on the 1080p one (cumulative -2.84% / -1.97%).
perf(av1): intra non-directional prediction loops once per mode, not per pixelAhmet Kaan Gümüş · 29faade
perf(av1): intra non-directional prediction loops once per mode, not per pixel The seven non-directional modes shared one pixel loop with a 13-arm `match mode` inside it, so every sample re-ran the dispatch and DC_PRED re-averaged both edges per sample. One loop per mode instead, with the per-row terms (smooth weights, the bottom-left/top-right anchors, the left column sample) hoisted out of the column loop. Byte-exact: all four gate streams hash to their references at 1 thread. -2.59% instructions on the 4K segment, -1.51% on the 1080p one.
Merge branch 'lane-deblock2' (8587f4c7): deblock kernel monomorphised on edge length with a mask early-out, EdgeCtx replaces seven per-pass args, filter level tabulated per band over (base level, ref frame); byte-exact, -0.74% instructions on the 4K segmentAhmet Kaan Gümüş · 6d124e3Browse files
perf(av1): the compound vertical pass runs the whole block per callAhmet Kaan Gümüş · f2203de
perf(av1): the compound vertical pass runs the whole block per call vpass_row takes the block's row count too, and the compound kernel accumulates straight into its i32 destination and rounds it in one sweep, dropping the per-row accumulator round trip along with the per-row tap setup. Byte-exact: all four gate streams hash to their references.
perf(av1): the vertical pass sets its taps up once per block, not once per rowAhmet Kaan Gümüş · 3702d63
perf(av1): the vertical pass sets its taps up once per block, not once per row vpass_row_u16 and its AVX2/SSE4.1 kernels take the block's row count, so the tap pairs, the rounding vector and the clamp vector are built once per predict call. Byte-exact: all four gate streams hash to their references.
perf(av1): the horizontal pass sets its taps up once per block, not once per rowAhmet Kaan Gümüş · e27ea46
perf(av1): the horizontal pass sets its taps up once per block, not once per row hpass_avx2/hpass_sse2 take the block's row count and source stride, so the tap broadcast, the rounding vector and the SIMD dispatch happen once per predict call instead of once for each of the block_h+7 rows. Byte-exact: all four gate streams hash to their references.
Merge branch 'lane-cdef' (29dfc7d8): CDEF direction search row-at-a-time with an AVX2 partials twin, i16 gather window tapped in place by the filter kernel; byte-exact, -1.1% instructions on the 4K segmentAhmet Kaan Gümüş · d35cd3aBrowse files
perf(av1): MC hoists the interior row test and fuses whole-pel-horizontal blocks onto the referenceAhmet Kaan Gümüş · 37ae497
perf(av1): MC hoists the interior row test and fuses whole-pel-horizontal blocks onto the reference The unscaled horizontal pass tested the vertical clamp, the interior window, the slice bounds, the tap narrowing and the SIMD level once per row; when the whole footprint is inside the reference -- the common case -- every one of those has the same answer for all rows, so the test is hoisted and the loop is a walk of the stride. A whole-pel horizontal position makes the horizontal pass the identity tap, whose intermediate is exactly `s << 4`, so the vertical pass is the same 8-tap sum taken straight off the reference rows with the taps scaled by 16. Both the single and the compound kernel now take that path for interior blocks, which drops the intermediate entirely; the vertical kernels gained a source-stride parameter to read it. Byte-exact: all four gate streams hash to their references.
perf(av1): deblock kernel per length, level table per plane passAhmet Kaan Gümüş · b247733
perf(av1): deblock kernel per length, level table per plane pass The AVX2 edge kernel is monomorphised on the edge length, so each of the four lengths holds only its own taps live and every wide row is clamped straight into the tile instead of into a shared twelve-entry result array the register allocator spilled (35% -> 18% of the kernel's samples on stack moves). An all-empty filter mask now returns without any write-back at all, which also drops a vertical edge's second transpose. edge_params' seven per-plane-pass arguments -- half of them passed on the stack into the inline(never) body -- collapse into one EdgeCtx built once per band, carrying libaom's av1_loop_filter_frame_init idea in level form: get_filter_level for every (base level, ref frame) pair, tabulated once instead of re-derived per 4-pixel edge group. Byte-exact: all four gate streams hash identically at 1, 4 and 16 threads.
Merge branch 'lane-tx2' (c084630a): explicit AVX2 Lane impl for the inverse-DCT column pass (exact i64 products, full-range equivalence test; target_feature on the leaf methods), all-zero transform units carry an empty residual marker instead of allocating and cloning zero grids; byte-exact, -4.0% instructions on the 4K segmentAhmet Kaan Gümüş · 140e662Browse files
perf(av1): CDEF direction search row-at-a-time, i16 filter windowsAhmet Kaan Gümüş · 8402ace
perf(av1): CDEF direction search row-at-a-time, i16 filter windows `cdef_find_dir`'s 64-sample accumulation was 57% of `cdef_band` (22.6% of the function on decode.rs:15560 alone): 512 scalar read-modify-writes on i64 partials. Each of libaom `cdef_find_dir_c`'s eight index forms is, once the row is fixed, "add the row / its reverse / its pairwise sums / its total into consecutive slots", so the loop is rewritten row at a time over i32 partials (exact: a partial is at most eight samples in -128..127) and gains an AVX2 twin, `cdef_find_dir_partials_avx2`, for eight lanes instead of the four the scalar form auto-vectorises to. `cdef_gather` now writes the window as i16, which is what the AVX2 tap kernel wanted anyway: it taps the caller's 256-entry scratch in place instead of copying and narrowing 144 entries per block. Byte-exact: all four gate streams unchanged. seg4k instructions:u 504.77 -> 499.27 G (-1.09%); cdef_band 3.02% -> 1.78% of cycles. New gate `cdef_find_dir_matches_the_per_sample_reference` pins both forms against a literal transcription of `cdef_find_dir_c`, sentinel rows included.