Title textures: detile levels a row at a time, not element by element #458
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!458
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/458/head"
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?
@dns54 on GitHub · 2026-11-24 00:32 UTC · original
dns54:perf/row-detile→main· +148 −20 · 1 files · 1 commits · closed without mergingEvery upload of a title texture kept in step with its memory detiles each level on the CPU (
title_textures::refresh→subresources→Chain::detile_level), anddetile_levelcomputedoffset_zfor every element: about a dozen divisions and remainders, six table lookups and a bounds-checked copy of a runtime-sized element. The retail title's intro video rewrites 3840×2160 R8 linear planes every frame; each took ~255 ms to detile, so the render thread spent ~2 s of every 2 s there and the video ran at ~1 fps (found withXCL_THREAD_DUMP_AT: the render thread was inLayout::offset_zin every dump).offset_z(x, y, z)now splits into what x gives (block column + in-block bits, a table per level) and what y and z give (once per row); the two cannot overlap, so an element is a lookup and an XOR. The copy is monomorphized by element size, and a row whose columns follow each other (linear) is one copy. Mip-tail levels and 3D textures take the same path. All callers ofdetile_level/detile_volumeget it (title_textures,gpu/texture.rs,hle/xg.rs); the tile direction andoffset_zare unchanged.The same bottleneck was measured in the profiling comment on #283 (RX 7800 XT); #334 did the linear case and was closed by its author. This is a separate implementation that also covers tiled, tail and 3D levels.
What is in it
Title textures: detile levels a row at a time, not element by element–crates/xcl/src/gpu/tiling.rs(Layout::columns/row/copy_row,Chain::detile_level/detile_volume), and a test that compares both with the element-by-element address (element_at,element_at_z) for every 2D mode including linear, every element size, 3 pipe configurations, with and without a base swizzle, a source cut short, two array slices, every level (tail included), and the 3D modes.Tested
cargo test --workspace -- --test-threads=4: 627 passed, 4 failed, 21 ignored. The 4 failures fail onmain2b4bb43on this card too (the change stashed):gpu_nonfused_mad_and_mac_prevent_fma_contraction,placed_title_textures_share_vram_and_preserve_pixels,transitions_apply_when_their_list_is_submitted,d32s8_targets_take_their_own_size_of_video_memorySKIPPED:gpu_geometry_mode_es_gs_strip,gpu_mesh_mode_two_passes(no mesh shaders)cargo test -p xcl --lib tiling: 12 passedsubresources(not in the PR): 3840×2160 R8 linear 255 → 5 ms; 1280×720 4-byte SW_256B_D, 5 mips 40 → 4 ms; 75 s run 379 → 1442 framesRegression run
Not tested
AI use
🤖 Generated with Claude Code
@PHeitor1 on GitHub · 2026-11-24 00:44 UTC · original
Tested
a173fe0merged ontomain2997c9a.RTX 5060 Ti 8 GB (Blackwell, 32-lane waves), NVIDIA 621.24, Ryzen 5 5600X, Windows 11 Pro 26300 (native, Graphics Tools + XGameRuntime installed, so the debug-layer tests run), rustc 1.100.0 MSVC, debug,
cargo test --workspace --no-fail-fast -- --test-threads=4, noXCL_SAMPLE_*.Pass: 677 passed, 0 failed, 41 ignored. SKIPPED: only the 2
no wave64tests (gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware). Build clean.Run and written with Claude Code (Claude Opus 5.5).
@Chrysana on GitHub · 2026-11-24 01:07 UTC · original · edited 2026-11-24 01:11 UTC
Test report for #458 at
a173fe0on AMD RDNA4 (the "Not tested" item), with the retail title reaching the intro video.Setup: AMD Radeon RX 9070 XT 16 GB, driver 32.0.32015.2008, Ryzen 7 9800X3D, 31 GB RAM, Windows 11 25H2 build 26200.9974, rustc 1.100.0
x86_64-pc-windows-msvc, DXC 1.9.2602.17. Retail title 1.0.2.1. Debug build for the tests, release build for the runs.Tests:
cargo test --workspace --no-fail-fast -- --test-threads=4ata173fe0: 679 passed, 0 failed, 41 ignored. The 4 failures listed for the RX 5700 XT don't occur here.SKIPPED: the two debug-layer tests (the D3D12 debug layer isn't installed here).Title runs:
scripts/smoke.ps1 -Game <folder> -Seconds 60withXCL_PRESS_A_AT=14,17,21, two rounds each, interleaved with main, #451 and #440, same saved state. Every run reaches the Bink intro.a6f5f7aa173fe0(base2b4bb43)a6f5f7a(local merge66d0ca5, not pushed)The drop at ~38 s happens on the PR's own base and goes away when it's merged onto current main. So it comes from one of the 15 commits
maingained since2b4bb43, not from this change. A rebase onto main should be enough. Peak commit was 15868 / 15747 MB at the head and 15920 MB merged onto main (main: 15824 / 15815 MB). No device removal or crash in any run.Regression run (round 1). The PR's block is from its head, whose base is older than this main:
main:
PR:
Not tested: which of the 15 commits makes the difference; audio/video sync; gameplay past the video.
AI use: Claude Code with Claude Opus 5.5 built the commits, made the local merge, ran the tests and the title runs, and wrote this report. The runs were made on my machine.
@xstraok on GitHub · 2026-11-24 01:19 UTC · original
Test report for
a173fe0, on Linux (Wine), RDNA4: the stretch of slow frames after the first menus is gone.Setup:
maina6f5f7a+ #257 (Linux kit, merged locally), release,x86_64-pc-windows-gnu; with and without this PR's diff. RX 9060 XT (RADV, Mesa 26.2.6), Ryzen 5 7600, 32 GB, Arch Linux, kernel 7.2.15, Proton Experimental 11.0 Wine, vkd3d-proton v3.1 + #257's patch. GTA VI 1.0.2.1,XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_COHERENT_MB=512, A pressed by hand at the first prompt (settings already saved, so the title goes straight to its loading screen).a173fe0Unit tests under Wine:
cargo test --release --target x86_64-pc-windows-gnu -p xcl --lib tiling: 12 passed, 0 failed, 0 ignored.Not this PR: both runs end in a GPU page fault (
SQC (data), permission fault) and0x887a0005about 65–75 s after world loading starts; the same happens without the PR, it only gets there sooner.Not tested: Windows, the whole workspace suite, NVIDIA.
Measured and written with Claude Code (Claude Opus 5.5).
@dns54 on GitHub · 2026-11-24 02:00 UTC · original
Closing: superseded by #451 (merged), which detiles 2D levels a row at a time and copies linear rows whole, the same change as this PR's first commit. The in-place read from this branch's second commit will come as its own PR, rebased onto main, once it is re-measured there.
@crosettiremi on GitHub · 2026-11-24 02:37 UTC · original
Tested
a173fe0on an RX 7900 XT (driver 32.0.32029.2010), Ryzen 5 5600X, Windows 11 build 26100 and Rust 1.100.0. The release build used DXC from Windows SDK 10.0.26100.0. I applied the PR to a locala6f5f7a-based stack containing #150, #208, #273, #473, the sparse scan change from #203, #486 and #508, along with local startup and test-input fixes.cargo test --locked --workspace -- --test-threads=4passed 690 tests with 41 ignored, includingrow_detile_matches_the_element_address.0xc0000005in aVCRUNTIME140.dllread called bytitle_textures::refresh. There were 1,847 presents, zero failed pipelines and zero device removals. Dumps at 95 and 145 seconds also showed the title thread constructing coordinate tables inLayout::from_bits, the path addressed by #435.AI disclosure: Codex ran the diagnostics and prepared this report.
Pull request closed