Detile title textures faster: copy contiguous runs on the CPU, detile on the GPU #1511
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#1511
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?
@oishigeso on GitHub · 2026-11-24 17:09 UTC · original
Problem. A retail title creates thousands of tiled textures during loading, and XCL detiles each one on the CPU (
tiling::detile_level), element by element, on the thread that uploads them. On the console pipe config an RGBA8 2048×2048 texture takes ~22 ms.Plan, two PRs:
detile_levelcopies contiguous runs at once (16 B in the swizzled modes) instead of one element at a time: 22 ms → 10 ms for that texture, ~10 % for BC. Small, CPU only.cs_6_0program writes each subresource's rows into the uploader's scratch buffer at itsGetCopyableFootprintsplace, and the copies into the texture read from there. Same formula asLayout::offset_z. The CPU path stays forXCL_GPU_DETILE=0, no DXC or pipeline, a texture the plan cannot take, and frame tracing. A test reads 78 textures (every 2D mode × element size, mips, slices, cut-short bytes, 3D) back byte-identical against the CPU path.Earlier detile work: #451 and #602 (merged) sped up other parts; #474 (closed). I found no open PR doing either of these. Does this fit, or would you rather take only the first? The PRs are open as drafts (PRLIST).
Written with Claude Code (Claude Opus 5.5).
@humsterbumster on GitHub · 2026-11-26 14:26 UTC · original
A detile of a title texture read unmapped console memory and ended a run, with the fault inside the copy rather than at a bounds check.
addr2lineon the same build (mainb49be18plus local changes, x86_64-pc-windows-gnu, release with debuginfo) resolves it toso the source of the copy - the title's own memory - was not mapped, and the address is page-aligned (
0x769000000,r15=0x1000), i.e. it faulted on the first page. The read reachesdetile_levelthroughtitle_bytes, which borrows the title's memory whengpu::shader::readable(at, len)holds and otherwise copies page by page withread_committed. Both have a shortcut that skips a per-region walk:shader::readablefirst asksresident_and_readable, which usesK32QueryWorkingSetExfor up to 16 pages and checks the working set rather than the commit state;read_committedfirst asksUma::in_committed_window(p, len), which isis_committed(p) && window_of(p + len - 1) == window_of(p)- both ends in one committed window, not every page between them committed.Environment: Arch kernel 7.3.5, Wine 11, vkd3d-proton 3.2.0
ec20719, RTX 5090,XCL_DEVICE_TYPE=lockhart XCL_TEXTURE_LEVEL_PAGES=1, 1080p, retail title 1.0.2.1. It happened at 148 s, on the start screen (60 presents, 660 draws a frame), right aftera texture at 0xb87a07000 lies in a GPU view of the title's CPU memory: kept in step with 0x787a07000 (512 so far); a run of the same binary and environment went on to 12 minutes of world loading without it and then lost the device, which is #1452. One occurrence, so I am not claiming a definite defect of the level pages - but ifin_committed_windowis what letsread_committedskipVirtualQuery, a texel range of a level-mapped texture is exactly the case where "both ends in one window" and "every page committed" differ.