Repository navigation
Conversation
Every upload of a title texture kept in step with its memory detiles each level on the CPU (title_textures::refresh -> subresources -> Chain::detile_level). That computed offset_z for every element: about a dozen divisions and remainders by the block size and table lengths, six table lookups and a bounds-checked copy of a runtime-sized element. A title that writes a texture every frame pays it every frame: GTA VI's intro video writes 3840x2160 R8 linear planes, and each one took ~255 ms to detile (~32 MB/s), so the render thread spent ~2 s of every 2 s in it and the video ran at ~1 fps. offset_z(x, y, z) splits into a part x gives (block column and in-block bits, one table per level) and a part y and z give (once per row); the two never overlap, so an element costs a lookup and an XOR. The copy is monomorphized by element size, and a row whose columns follow each other (linear layouts) is one copy. Levels in the mip tail and 3D textures go the same way. Measured on an RX 5700 XT / Ryzen 5 2600 (release, local timer around subresources): 3840x2160 R8 linear 255 -> 5 ms, 1280x720 4-byte SW_256B_D 5 mips 40 -> 4 ms; GTA VI frames in 75 s 379 -> 1442, the video at 40-60 presents per 2 s instead of 2. The same idea was measured in the profiling comment on xcl-dev#283 (RX 7800 XT, 8 -> 60 presents per 2 s during the video); xcl-dev#334 did the linear case and was closed by its author. Assisted-by: Claude Code (Claude Opus 5.5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014iLwwhKe7L6XShVmjgRRDr
|
Tested 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, Pass: 677 passed, 0 failed, 41 ignored. SKIPPED: only the 2 Run and written with Claude Code (Claude Opus 5.5). |
|
Test report for #458 at 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 Tests: Title runs:
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 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. |
|
Test report for Setup:
Unit tests under Wine: Not this PR: both runs end in a GPU page fault ( Not tested: Windows, the whole workspace suite, NVIDIA. Measured and written with Claude Code (Claude Opus 5.5). |
|
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. |
|
Tested
AI disclosure: Codex ran the diagnostics and prepared this report. |
Every 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 onmain2b4bb43 on 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