Commits
Commits on
70849e07ad7e30da44cd8a7f390dc93bfb49542eFiltered to crates/ec-av1/examples/alloc_probe.rsClear filter2026-09-05
perf(av1): remove four per-block allocation sites from the parse pathAhmet Kaan Gümüş · d4c852e
perf(av1): remove four per-block allocation sites from the parse path
lane-alloc. A tracking global allocator (new `alloc_probe` example: size
histogram plus a sampled backtrace per 512 allocations, with line numbers)
ranked the decoder's allocation sites on the 4K segment -- 83.6 M
allocations over 272 frames. Four of the top sites are removed here:
* `find_samples` built a `String` per warp block (`format!("{mi_row},
{mi_col}")` plus the env snapshot's own `String` clone) to compare against
an unset debug flag; the OBMC blend did the same for `EC_MCB`. Both now
sit behind the per-call-site `env_flag!` load.
* `Edges::build` allocated four vectors per intra prediction (collect,
grow, then a second buffer to prepend the corner); it builds each edge
once, corner first. `directional`'s two working buffers were a copy of
those same vectors, so it takes the `Edges` by value instead.
* `obmc_neighbour_pred` allocated its prediction buffer per neighbour per
plane; the caller now keeps one buffer per plane for the whole block.
* The MV stacks and the OBMC neighbour lists are capped (8 entries /
`max_neighbors`), so they reserve once rather than growing and memcpying
up to four times.
seg4k at one thread: 601.657 -> 599.329 G instructions:u (-0.39%, perf stat
-r 3). Reverting only the reserve step measured 600.014 G, so it stays
despite raising the raw allocation COUNT (an empty stack now allocates):
the saved reallocation memcpys outweigh the extra tcache hits.
Byte-exact: sha6t hashes equal the reference for all four streams at
threads 1, 4 and 16 (the last with FILTER_THREADS=4 RECON_THREADS=2).