Skip to content

[upstream #1792] kernelx: commit a mapping call's sparse pages once per run, not per page - #343

Closed
ufoptg wants to merge 3 commits into
mainfrom
upstream-pr/1792
Closed

ufoptg wants to merge 3 commits into
mainfrom
upstream-pr/1792

Conversation

@ufoptg

@ufoptg ufoptg commented Nov 25, 2026

Copy link
Copy Markdown
Owner

A MapTitlePhysicalPages call told sparse about every 64 KiB page it mapped in a sparse window on its own: one UpdateTileMappings and one fence Signal per page, about 0.5 ms a page on NVIDIA. In Series S mode (device_type = "lockhart") the retail title maps about 3.6 GB in one call at boot. Its main thread stayed in that call for 24 s, and the title's stall check ended it with the null write at +0x2215c35 at 34 s, before the first frame. map_pages now gathers neighbouring sparse pages into runs and commits each run with one sparse::committed call. A run is committed early whenever the same call is about to decommit one of its pages: a page moving away from an address still in the run, or homes being given back. Part of #232.

What is in it

  • crates/xcl/src/hle/kernelx.rs: SparseRun (add / holds / flush) used by map_pages, flushed before move_away / move_home_away can decommit a page in the run, on both error returns and at the end of the call. GIVE_BACK_PAGES names the existing 4096. Unit test sparse_pages_are_committed_once_per_run.

Tested

Regression run
main (4178e88):

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: NVIDIA GeForce RTX 2060
title: 9cc6a39e
seconds: 120
exit: 0x0
frames shown: 2725 (PresentX 2725)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14755 MB

this PR (f03d411):

xcl-smoke v1
commit: f03d411812577ca4334f241df3298467a89d55d8
gpu: NVIDIA GeForce RTX 2060
title: 9cc6a39e
seconds: 120
exit: 0x0
frames shown: 2859 (PresentX 2859)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14747 MB

Both runs loaded DXC 1.6 from the Windows SDK: the DXC 1.9 folder is on D:, which the default D: console mount hides on main (xcl-dev#833).

Not tested

AI use

  • Claude Code with Claude Opus 5.5: found the cause from the thread dump, wrote the change, the test and this description. I reviewed the diff and ran the tests and the title on my machine.

Mirror of xcl-dev#1792 (auto-synced, do not edit).

ufoptg pushed a commit that referenced this pull request Nov 27, 2026
gpu_sparse_vram_descriptors_buffers_and_xmem left SOFFSET unset on its
three S_LOAD_DWORD* instructions. The field is then 0, which is s0, so
every load added s0: the low half of arg_table's address. That is 0 only
while arg_table is the first allocation in the coherent window. After an
earlier uma.alloc (placed_title_textures_share_vram_and_preserve_pixels
takes 16 MiB there) the descriptor loads read s0 bytes past the heap and
out_buf stayed 0: "submit 1 lane 0 mismatch", left 0, right 1077.

They now pass SOFFSET = 125 (no register), as the other SMEM tests do.

Part of #343

Assisted-by: Claude Code (Claude Fable 5.2)
@ufoptg ufoptg closed this in 0fb9f4a Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants