mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:25:52 +01:00
[PR #1901] perf(console_texture): stack-buffered runs, hoisted shifts, and fixed-width detile/tile dispatch (RT-CONSOLE-TEX-FAST-RUNS) #1912
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1912
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1901
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:perf/rt-console-tex-fast-runs📝 Commits (1)
7c06770perf(console_texture): stack-buffered runs, hoisted shifts, and fixed-width detile/tile dispatch (RT-CONSOLE-TEX-FAST-RUNS)📊 Changes
3 files changed (+443 additions, -33 deletions)
View changed files
📝
runtime/CMakeLists.txt(+3 -0)📝
runtime/src/console_texture_layout.h(+179 -33)➕
runtime/test/console_texture_layout_test.cpp(+261 -0)📄 Description
Item ID:
RT-CONSOLE-TEX-FAST-RUNS(claimed in #1608).Summary
Optimizes
leonida::console_texture::Layout::detile()andtile()(runtime/src/console_texture_layout.h) while preserving bit-exact output and every existing validation/error path:kStackRuns = 128):std::vector<Run>only for wider surfaces.bw_log2,bw_mask,bh_log2,bh_mask,align_log2,pitch_blocks, tail offsets, andpattern_[2][inner]once per subresource/slice instead of recomputingstd::countr_zero(alignment)and integer division inside the per-row loop.1, 2, 4, 8, 16, 32, 64, 128, 256bytes) acrossruns[0 .. body_count - 1]— peeling off an optional shorter final tail run for non-power-of-two widths like1920x1080— and dispatches once per subresource sostd::memcpylowers to fixed-width loads/stores instead of runtime-length calls.row_pitch == bytes && m.pitch == m.width) in a singlestd::memcpy.A/B Benchmark (
-O2, macOS Apple Silicon, 20-iteration average)detile)main2048x2048 RGBA8 64KB_S1814.9 us(9.24 GB/s)970.7 us(17.28 GB/s)2048x2048 RGBA8 64KB_D1695.8 us(9.89 GB/s)728.1 us(23.04 GB/s)2048x2048 BC7 64KB_S424.2 us(9.89 GB/s)164.3 us(25.53 GB/s)1920x1080 RGBA8 64KB_S831.6 us(9.97 GB/s)467.7 us(17.74 GB/s)Verification
console_texture_layout(runtime/test/console_texture_layout_test.cpp):Layout::offset()andtile -> detileround trips across all 7 addressable swizzle modes (kLinear,256B_S/D,4KB_S/D,64KB_S/D), all element sizes (1..16),block=1andblock=4(BC), 1D/2D/3D, mip tails, odd/prime extents (tail runs), wide textures (>128runs heap fallback), tight & padded row/depth pitches, and all error paths (invalid,too_small,unsupported,SIZE_MAXoverflow).-std=c++20 -Wall -Wextra -Werror): ASan+UBSan PASS, TSan PASS,-O2× 3 PASS.python3 -I scripts/check_no_game_data.pyon all 3 touched files andpython3 -I tests/test_text_write_line_endings.pypassed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.