diff options
| author | bobcatchris <83428450+bobcatchris@users.noreply.github.com> | 2026-11-29 20:54:32 -0600 |
|---|---|---|
| committer | bobcatchris <83428450+bobcatchris@users.noreply.github.com> | 2026-11-30 05:18:16 -0600 |
| commit | 782c93512fd34fb65bf34755a571ee86d858f230 (patch) | |
| tree | 125e849f87664f7bb3ca84814bdc1aa12978b321 /runtime/src/thread_stacks.cpp | |
| parent | d367675c705c758f731ae9eb603839a4ebb2283c (diff) | |
leonida-formats: add branchless AVX2 model lookup for BCPack rANS lanes (D3D12-FORMATS-BCPACK-FAST-LANES)
DirectStorage texture streaming runs BCPack decompression on the frame's
streaming critical path (d3d12/docs/findings.md). Previously, every
decoded rANS symbol performed four separate 2-D table lookups (freq,
start, 256-entry bucket window, recip), a while-loop bucket scan, an
if b == 0 branch, and a Result<(), Error> check even though Lane::step
is infallible.
Pack per-model decode parameters into a 64-byte-aligned Model struct
with pre-adjusted b == 0 entries (eliminating the if b == 0 branch),
add a runtime-detected AVX2 single-register vpcmpgtd + movemask +
count_ones bucket lookup (dispatched once per lanes() call), and remove
the unused Result wrapper from Lane::step.
Verified exhaustively across all 3 x 128 x 65,536 = 25,165,824
(table, model, slot) pairs against the reference scan and across all 6
BC lane layouts.
Measured --release bcpack_throughput (Ryzen 7 7800X3D, 16,384 blocks x 40):
- BC1: 86.3 -> 94.7 MB out/s (92.7 -> 84.4 ns/block, +9.7%)
- BC4: 83.0 -> 93.8 MB out/s (96.4 -> 85.3 ns/block, +13.0%)
- BC7: 49.7 -> 53.3 MB out/s (322.0 -> 300.3 ns/block, +7.2%)
AI-assisted: Antigravity (Gemini 4 Neon)
Diffstat (limited to 'runtime/src/thread_stacks.cpp')
0 files changed, 0 insertions, 0 deletions