Skip to content

Retail title reaches its title screen and menus: GPU title memory in large pages, to_zero pruned once - #203

Open
Sr-0w wants to merge 1 commit into
xcl-dev:mainfrom
Sr-0w:gta6-title-memory
Open

Sr-0w wants to merge 1 commit into
xcl-dev:mainfrom
Sr-0w:gta6-title-memory

Conversation

@Sr-0w

@Sr-0w Sr-0w commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Retail title on screen

With this PR together with #163, #170, #164, #168, #169/#192 and #187, plus compute pipelines built at their first use (#162), the retail title shows its title screen and the Navigation menu, reacts to the pad (Y on the keyboard's E), and ran for more than 5 minutes without a crash on an RX 7800 XT:

Title screen Navigation menu
title menu

Still wrong, and visible above: full-screen quads draw only one triangle (the diagonal), and part of the text is missing. More on that in a follow-up.

The fixes in this PR

1. GPU title memory in large pages. The retail title allocates its index and vertex data with VirtualAlloc(MEM_LARGE_PAGES | MEM_RESERVE | MEM_COMMIT, protection 0x22004), in blocks of 1.2 GB, 0.6 GB and 0.6 GB. These carry neither MEM_GRAPHICS nor MEM_64K_PAGES, so they got plain process memory. The GPU then faulted on the index buffers there: a driver timeout (0x887a0006) about 50 s in. Radeon GPU Detective showed a page fault during a DrawIndexed, at an address with no resource, inside that VirtualAlloc.

Large-page allocations with protection bit 0x20000 now get a sparse window, like MEM_64K_PAGES ones. They are placed from the highest window down, so that the title's physical pages (6.3 GB in one piece) keep the lower windows. Without #187 (page homes out of GPU space), everything does not fit: AllocateTitlePhysicalPages(99776): no room in UMA, then the title's assertion.

2. sparse::decommit_tiles walked all of to_zero at every decommit that unmapped a tile. That list grows until the next ExecuteCommandLists. While the retail title maps gigabytes of physical pages during loading, this took seconds per page: rendering froze, and the title's watchdog ended the game (mov [0], 0 at +0x2215c35). The list is now pruned once, where the runs are taken. The unit test is adapted accordingly.

Testing

  • cargo test --release -p xcl --lib: 535 passed, and 1 failed, gpu_wave64_ps_whole_wave_reductions, which already fails on main on this machine.
  • Retail title, RX 7800 XT, driver 26.11.2: before, a GPU timeout at ~50 s. After, the title screen and menus, running for 5+ minutes.

🤖 Generated with Claude Code

@Kalmarv

Kalmarv commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Great result. The two problems still visible in your screenshots each have an open PR you could try on the same stack:

AI-assisted (Claude Code).

@WarmMilkCodes

Copy link
Copy Markdown
Contributor

FYI on the one test failure: gpu_wave64_ps_whole_wave_reductions failing on main on an RX 7800 XT is a known AMD issue, fixed by #155. RDNA2 and RDNA3 report 32–64 lanes, but the driver runs wave64 pixel shaders in 32-lane waves, so v_readlane 32 wraps to lane 0 (the test sums twice: 928 vs 464). #155 gives VS / PS the upper_lanes 32-lane form whenever the GPU can run 32-lane waves. It has been confirmed on an RX 6600 XT and on two RX 7800 XTs (one at 32.0.32015.7029, one at 32.0.32029.2010), with no change on an RTX 4080 Super. It's on top of current main.

Not claiming it's related to the missing text, but with #155 that test should pass on your 7800 XT too, which takes it out of the picture when you narrow that down.

@Kalmarv

Kalmarv commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Two findings on a merge with main 6da33fa, neither blocking the menus:

  • Alignment: a tagged 2 MiB graphics allocation now gets 64 KiB alignment (address mod 2 MiB = 0x10000 when the first 64 KiB of window 2 is taken); kernelx.rs:196 passes 64 KiB where the existing graphics path asks for 2 MiB.
  • Stale clear on reuse (sparse.rs:191): after a full unmap and a new pool tile at the same VA, the old 4 KiB clear is kept. Redundant work only; reused tiles are fully cleared anyway.

The tagged allocation itself works: it lands in sparse window 2 and both GPU dispatches read the expected words, where main reads 0 instead of 1077.

Tested

The tagged allocation reached sparse window 2 and returned the expected 64 words in each of two GPU dispatches, including after replacing the input descriptor. I found a 2 MiB alignment regression and a stale clear on VA reuse.

Synthetic probe Main 6da33fa Main + #203 123538b Main + #203 + #187 390ef71
2 MiB, allocation flags 0x20003000, protection 0x22004 Coherent window 3 Sparse window 2 Sparse window 2
Same request with MEM_GRAPHICS, first 64 KiB of window 2 occupied Aligned Address mod 2 MiB = 0x10000 Same
2 GiB tagged VA reservation, 6 GiB mapping target, then 6 GiB physical home Succeeded Succeeded Succeeded
Old 4 KiB clear after full unmap and replacement at same VA Discarded Retained Retained

At PR-head crates/xcl/src/hle/kernelx.rs:196, the new branch passes 64 KiB alignment even when the existing graphics path would request 2 MiB. The fallback also aligns to 64 KiB. On all current-main builds, protection 0x2404 and the ordinary-page control went to coherent window 3. The 64 KiB page control went to sparse window 1.

At crates/xcl/src/hle/d3d12x/sparse.rs:191, decommitting one page, decommitting the rest of its tile, then installing a different pool tile at the same VA before pruning retained the old page clear. This demonstrates redundant work. Reused pool tiles already receive a full clear.

RTX 5070 Ti, 610.74, Windows x64. cargo test -p xcl --lib --no-run -j 2, then serial kernelx, sparse and tagged-dispatch tests. All three builds returned 27 passed, 3 failed, 1 ignored. On main, submit 1 read 0 instead of 1077 at lane 0 and two probes expected sparse placement. On both merges, the dispatch passed and the three failures were the two alignment checks and the stale clear. Direct head 7cbd008 also passed both dispatches. Against the original 956a476 control the tagged allocation was outside UMA, and the 6 GiB home required #187. On 6da33fa that capacity check succeeds without #187. The updated sparse unit test calls a helper absent on 956a476, so I used its original unit test and the same remap probe on the control. The local #187 stack uses 8c0346d's CPU-home implementation and preserves main's coherent-allocation branch.

Not tested

Retail boot, frame output, or pre-device timing. With the D3D12 debug layer enabled, the original baseline, PR and stack all hit CreateReservedResource(E_OUTOFMEMORY) before GPU readback. The reported readbacks used native D3D12 with the layer off.

AI use — Codex, GPT-6.2 Astra.

@mrp1no

mrp1no commented Nov 23, 2026 •

Copy link
Copy Markdown

NVIDIA + Intel result: with this PR and #187, GTA VI goes through its whole first-boot flow on an RTX 3060.

Setup:

These are frames the title presented, written by XCL_FRAME_DUMP at a quarter of each side (960x540):

Account prompt Intro movie (green: zero YUV planes)
account movie
Navigation experience Brightness
navigation brightness
Legal notices
legal

A 420 s timed run presented 1,554 frames. The menus ran at 4–7 fps.

  1. Account prompt. A (Enter) picks PLAYER1.

  2. The intro movie plays, but every frame is solid green. That colour is exactly BT.601 YUV (0, 0, 0) → RGB (0, 136, 0), so the Bink planes the title registers (BinkGetFrameBuffersInfo / BinkRegisterFrameBuffers, decoded on the CPU and drawn by its PS_Bink* shaders) reach the GPU as zeros. I'm looking into it.

  3. The first-boot screens, with their text readable:

    • navigation experience (minimap);
    • brightness calibration;
    • legal notices;
    • Rockstar's privacy policy and terms of service, where text size could be adjusted too.
  4. After confirming those, a black screen while it loads:

    • up to 337 MB in 2 s through DirectStorage;
    • local video memory 8.8 → 13.7 GB, past the card's 12 GB;
    • process commit 19 → 28.4 GB.

    It was still loading when the timed run ended.

Without this PR on the same machine, the title's hang watchdog ends the game at ~32 s. At that point XCL's thread dump shows a thread in XMemMapPhysicalPagesScatter → sparse::decommit_tiles, walking to_zero, so this PR's second fix is what gets an Intel + NVIDIA machine past that point too.

No game files attached; the screenshots are XCL frame dumps. AI-assisted (Claude Code).

@shelbykb2

Copy link
Copy Markdown
Contributor

RDNA2 test report: AMD Radeon RX 6800 (16 GB), driver 32.0.21045.29003, Windows 11, release build, XCL_NETWORK=0, a newer retail game.

Report written with Claude Code, from our own runs.

@simnJS

simnJS commented Nov 23, 2026

Copy link
Copy Markdown

Tested on Linux (Wine, NVIDIA): as is the title does not start; merged on current main it runs, same picture as main.

Tested commits: 7cbd008 (head of #203; its base 956a476 is 126 commits behind main 9ab7d76) and a local merge of main + #203, e7c27cc (no conflict). Compared with main at 9ab7d76, same machine, same protocol.

Tested

Not tested

  • Windows, AMD (including RDNA4). The test suite and scripts/smoke.ps1 were not run.
  • Anything past the first menus; the press time of A was not recorded.

AI use

  • Written with an AI coding agent from real runs (it built and launched each version; a person pressed A), then checked by the author.

@grahamster2 grahamster2 changed the title GTA VI reaches its title screen and menus: GPU title memory in large pages, to_zero pruned once Retail title reaches its title screen and menus: GPU title memory in large pages, to_zero pruned once Nov 24, 2026
@GreemSC

GreemSC commented Nov 24, 2026

Copy link
Copy Markdown

Test report (Linux, RDNA3): the to_zero part shortens the freeze after the intro from 6.1 s to 4.5 s. No crash, and the title screen is unchanged.

Setup

freeze title screen at 30 fps from p99 after 15 s crashes
base 6191 / 6058 ms ~20 s 39.3 / 39.5 ms 0 / 0
base + #203 4432 / 4612 ms ~18 s 35.4 / 38.7 ms 0 / 0

The long frames right after the freeze are there on both sides (base: 1023 and 390 ms; with #203: one of 368 ms). The game's memory (RAM + swap) peaked at 5.0–5.4 GB on both sides.

Why it helps, measured on the base

  • 28 thread dumps (XCL_THREAD_DUMP_AT, every 0.25 s through the freeze) put the title's thread in MapTitlePhysicalPages → move_away for most of it.
  • A temporary counter in decommit_tiles showed that to_zero stays at ~10 770 entries for the whole load, because nothing submits to empty it. It was walked end to end about 9 300 times a second: 441 M mapped lookups in 4.4 s.
  • This PR prunes it once where the runs are taken, which is what its comment says.
  • A narrower local variant gave 5.1 s: on each decommit, drop only the entries of the tiles it just unmapped. This PR does better.

What is left of the freeze (dumps with this PR)

  • ~2 s of page moves: tile mappings through vkd3d-proton, VirtualFree under Wine, and the page copies.
  • ~0.5 s of the title's own work.
  • ~1.3 s in which the presenting thread waits in WaitFrameEventX while no CPU thread is busy.

Not tested: the suite (no Windows here), the large-page half of the PR on its own (it changed nothing visible in these runs: no GPU fault, same video memory), world loading (this setup stops at #505), other GPUs.

AI use: Claude Code (Claude Opus 5.5) ran the runs and the dumps, added the temporary counter (not in any PR), and wrote this report.

…zero pruned once

GTA VI allocates its index and vertex data with VirtualAlloc(MEM_LARGE_PAGES | commit,
protection 0x22004) – 1.2 GB, 0.6 GB, 0.6 GB – not MEM_GRAPHICS, not MEM_64K_PAGES. It got
plain process memory; the GPU faulted on the index buffers there (Radeon GPU Detective: page
fault in a DrawIndexed, driver timeout ~50 s in). Large-page allocations with protection bit
0x20000 now get a sparse window like MEM_64K_PAGES ones, from the highest window down so the
title's physical pages (6.3 GB in one piece) keep the lower ones. (Without
xcl-dev#187's page homes out of GPU space they do not all fit.)

sparse::decommit_tiles pruned `to_zero` – which grows until the next ExecuteCommandLists – at
every decommit that unmapped a tile. While GTA VI maps gigabytes of physical pages during
loading this walked the whole list per page and its watchdog ended the game. It is now pruned
once, where the runs are taken.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Sr-0w
Sr-0w force-pushed the gta6-title-memory branch from 7cbd008 to 4075447 Compare November 25, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants