Title textures: a PC copy per placement, never shared or let go – video memory grows past the card while a retail game streams its world (0x887a0007) #248
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#248
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?
@gw1337x on GitHub · 2026-11-23 21:49 UTC · original
What happens
The retail title (retail, Series build) on
maind4f17ca+ a retry equivalent to #244, RX 7800 XT 16 GB, 31.6 GB RAM. After the menus and the first movie the game starts streaming its world. From then on video memory grows by ~0.35 GB/s until the driver resets the device:at 106 s and 116 s in two runs; a third, ended at 100 s, had reached 23.8 GB. The menus were walked with
XCL_PRESS_A_AT=14,17,21, no other input.Measured
A local counter on the activity memory line (
XCL_ACTIVITY=1): the texturestitle_textureskeeps in step, the sum of their sizes, and the title memory they cover (overlapping ranges counted once):The target pages (3.2 GB), arenas and sparse pools stay flat over the same time; the growth is the kept textures.
Cause
The title streams by placing new textures in memory it used before (as the console allows: a placed resource over another's memory aliases it). Each
CreatePlacedResourceXtexture that is kept in step gets its own committed PC texture (device_x.rs, thetitle_textures::registerarm), and the older ones at the same addresses stay – the title releases almost none of them (11 in 90 s). So video memory holds the sum of every texture ever placed (12.7 GB at 90 s) while the title only uses the 4.0 GB it covers.Suggestion
Render targets already avoid this: since
38b05b7they are reserved resources on 64 KiB pages of video memory, one per page of the title's address, shared by every target there (vram.rs,Pages). Kept-in-step textures on the same pages would cost the memory the title covers instead of the sum, and match the console: a texture placed over another one overwrites its memory. The upload path (title_textures::upload_all) would copy into the reserved texture as it does into the committed one.I have not tried this; the numbers above are from a counting patch only (happy to share it).
Not this issue
@Kalmarv on GitHub · 2026-11-23 22:06 UTC · original
A synthetic repro and a plan, before I write it.
Repro on main (
9ab7d76, RTX 5070 Ti, driver 610.74). A new check in the test title places 16 RGBA8 2048×2048 textures (16 MiB each) one after another over the same 17 MiB of title memory with CreatePlacedResourceX, keeps the older objects, and reads each new one back. The contents are right every time, and local video memory (QueryVideoMemoryInfo) grows by 268,435,456 bytes = 16 × 16 MiB. By the rule intitle_textures::refresh_once, each placement also uploads every older texture on the written pages again: 1 + 2 + … + 16 = 136 uploads (read from the code, not counted in the run).XCL does not keep them alive.
TEXTURESholds raw pointers, an upload holds a reference only while its batch runs, andreal::res_releaseat refcount 0 callsvram::forgetandtitle_textures::forget. In the same check the growth is back to 0 bytes once the 16 objects are released. So what grows in the retail game is textures the title has not released yet when it reuses their memory; on the console they cost nothing, because they alias.Plan (about 300 lines in
device_x.rs,vram.rs,title_textures.rs; the arenas of #225 are not touched):vram.rsPagestiles of its title pages (38b05b7), so textures over the same memory share video memory. The others (unaligned address, or a texture the tiled-resources tier cannot make) stay committed as today.Two questions:
va & 0xFFFFover the CreatePlacedResourceX calls.) That decides whether step 1 covers the growth.Pagesis your design. Do you want kept-in-step textures on it, or would you rather do this your own way? I will hold the PR if so.🤖 Claude Fable 5.2
@gw1337x on GitHub · 2026-11-23 22:11 UTC · original
@Kalmarv thanks – the repro matches what we see.
Aligned share. In a run with your steps 1–2 applied locally (kept-in-step textures at 64 KiB-aligned addresses as reserved textures on
Pages, older overlapped ones no longer uploaded), about 10 000 of the ~42 500 kept-in-step placements in the first ~110 s went on the pages – roughly a quarter by count. I did not measure the byte share. Most of the title's streamed textures are packed at 4 KiB, so steps 1–2 alone leave most of them committed. In that run video memory still reached 26.6 GB on a 16 GB card.Step 3 is what keeps it flat here. A second local change on top:
UpdateTileMappingswithD3D12_TILE_RANGE_FLAG_NULLon thePagesqueue, then the fence) and gives them back to the pools. The title keeps the object; it reads zeros from then on.main9ab7d76+ #244, RX 7800 XT 16 GB, GTA VI, menus walked withXCL_PRESS_A_AT=14,17,21. Both runs were stopped by an external kill-switch at 28 GB of process commit:main+ #244No device removal and no crash in the second run.
Not solved by this:
The two commits are local (about 130 lines in
vram.rs,title_textures.rs,device_x.rs). Happy to share the diff if it helps your PR.@iliassgm on GitHub · 2026-11-23 22:11 UTC · original
Taking a look at this. Plan:
CreatePlacedResourceX) onvram::Pagesreserved resources (sharing 64 KiB pages for every page boundary strictly inside[va, va + console_bytes)and sharing any extra/sub-page tiles by(va, tile)so repeated placements at the same address do not leak), falling back to committed resources when reserved creation is unsupported.title_textures::upload_all(andprobe_gpu_content) against tile mappings viavram::before_executeon the upload queue, and retire superseded overlapping entries intitle_texturesso dead older placements do not re-upload over or corrupt shared VRAM tiles.scripts/smoke.ps1.@iliassgm on GitHub · 2026-11-23 22:28 UTC · original
Draft PR is up at #288 (
876557cfce22). All 654 workspace tests pass on RTX 3060 12 GB, including a GPU test showing 512 unreleased 1 MiB placements over a 16 MiB window staying bounded at 16 MiB (+0 Bafter fill) with bit-exact readback across RGBA8/BC7 mips, cubemaps, 3D volumes, and 4 KiB-aligned neighbours.@gw1337x — since I don't have a retail game folder here for
scripts/smoke.ps1, if you have a chance to test #288 against your retail streaming repro, I'd love to see theXCL_ACTIVITY=1VRAM curve and add thexcl-smokeblocks!@Kalmarv on GitHub · 2026-11-23 22:45 UTC · original
The three PRs for this, run against one check on one machine. Facts per PR, no preference; I stopped building my own when #269 opened.
What ran. Each head merged onto
main9ab7d76locally (no conflicts): #269 at8111cf9, #288 at 876557c, #292 atbf8e16c(stacked on #269). Debug builds, MSVC toolchain, RTX 5070 Ti, driver 610.74, Ryzen 9 9950X, Windows 11 26200. The test title throughxcl run, ase2e.rsruns it, with one more check in it (the one from my note above, grown): CreatePlacedResourceX of RGBA8 2048×2048 textures (16 MiB each) in XMemAlloc graphics memory, every texture read back through the GPU. The same test-title binary for all four.mainvram/title_texturestests on this GPUreal.rs)Why the rows come out that way (from the diffs):
main's because each write still uploads every older texture on its pages.XCL_ACTIVITYline. Its description says it was not built or run on Windows; here it builds, and its tests and the 50 checks pass.The 4 KiB-packed textures (three quarters of the placements by gw1337x's count): committed in #269 and #292, on pages in #288. Row 2 is the only measurement of that here, with one texture size.
A fourth approach we tried locally, not a PR. 64 KiB-aligned textures on pages, and for older textures a count instead of removal: a texture is not uploaded while a later one on its pages lives, and is read from the memory again when that one is released. It is the only build here with rows 1, 5 and 6 all right (row 1: 67 108 864; row 2: 268 435 456, unaligned textures stay committed; 51 s and 52 s). About 80 lines; I can send it as a patch on top of whichever PR goes in.
Not tested
vram/title_texturestests only).🤖 Claude Fable 5.2
@ExMoha on GitHub · 2026-11-23 22:55 UTC · original
Regression data point for #248 (RX 9070 16 GB, AMD Ryzen 7 7800X3D 8-Core Processor, 31.2 GB RAM, Windows 11). Written with Claude Code (Claude Sonnet 5.5); the runs and numbers are from my machine.
Setup:
main9ab7d76, thenmain+ #244 + #269 (8111cf9), then those + #292 (bf8e16c), each applied as plain diffs, same settings:XCL_NETWORK=0 XCL_DSTORAGE_BCPACK_FILL=1 XCL_ACTIVITY=1 XCL_PRESS_A_AT=14,17,21, one run each. An external kill-switch stopped each run at 90-94% system RAM.Process commit / local video memory from xcl's own memory lines, compared at the same line number (the lines carry no timestamps, so alignment is approximate):
0 submits, 0 drawsper activity line) with a dark screen; that is not memory and looks like the failed DirectStorage / BCPack loads.Tests on main + #244 + #269 + #292 together:
cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 658 passed, 0 failed, 40 ignored; no SKIPPED GPU tests.Not tested: each PR alone; the
xcl-smokeblocks (the stack is uncommitted, so no valid per-PR block); runs longer than the kill-switch allowed.@iliassgm on GitHub · 2026-11-23 23:02 UTC · original
Thanks @Kalmarv for the side-by-side matrix and @gw1337x for the 4 KiB-packed retail data!
Updated #288 (
ad799324d6e6) to address both findings:shadowedmap (still tracking transitions/states, never scanned byrefresh_once) and promoted back to active (newest first) when a covering placement is released — keeping rows 1–5 + the ~3× upload speedup while fixing row 6.< 64 KiBreclamation (for @gw1337x's retail churn without breaking exact aliases): when a texture is superseded by a different range ((ova, oend) != (va, end)— or a GPU-owned target), its tiles are unmapped (D3D12_TILE_RANGE_FLAG_NULL) and unsharedextra_pages/ tail pages go straight tocooling(and are transparently remapped viaremap_if_unmappedif the newer placement is ever released). Exact same-range aliases stay mapped and share all tiles (row 4 stays right/right).Verified locally on RTX 3060 12 GB (
cargo test --workspace -- --test-threads=4: 654 passed, 0 failed, 40 ignored; release build clean), including GPU readback tests for rows 4, 5, 6, different-range unmap/remap, and immediateextra_pagesreclamation.@emirduran707 on GitHub · 2026-11-23 23:38 UTC · original
A baseline on current
main(after #244 / #252 / #283), RDNA4, for the next round of these PRs: all three (#269, #288, #292) conflict withmainsince #252 / #283 went in.Setup:
maindb1ddb2, release; RX 9060 XT 16 GB (driver 32.0.31044.16), Ryzen 5 5600, 32 GB RAM (commit limit 38 GB), Windows 11 Pro 26300. Same title, warm caches,XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_FRAME_DUMP=60, A pressed by hand on the first menu. A kill-switch stops the run when the xcl processes' private bytes pass 28 GB.What it reaches: the intro movie plays with its picture (3.7–5.6 fps on this card while it plays), then the loading screen with its artwork. No crash, no device removal before the kill-switch.
While the world streams in (from the
XCL_ACTIVITYmemory line; process commit / local video memory):Stopped at 232 s (28.3 GB). So on
mainit still grows by ~1.6 GB of video memory and ~3.2 GB of commit per 10 s, as in the9ab7d76runs above.Not done: the PR heads (they need a rebase first); past 232 s.
AI-assisted: Claude Code (Claude Opus 5.5) read the run's log and wrote this comment from my run.
@grahamster2 on GitHub · 2026-11-23 23:03 UTC · original · edited 2026-11-24 00:18 UTC
Retail streaming runs of the three #248 PRs and
main, on a 10 GB NVIDIA card. #288 asked for a retail VRAM curve; none of the PRs had a run on NVIDIA yet.Setup
main9ab7d76, #2698111cf9, #288876557c, #292bf8e16c(#292 contains #269's commit).XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_RUN_SECONDS=180 XCL_PRESS_A_AT=30,40,50,60,70,80,95,110. With this timing, every run below started streaming the world at ~48 s. One moremainrun stayed in the menus (an earlier screen differed before the first press) and is left out.Two runs per head
0x8007000e+0x13936, 128 s0x80000003at+0x193e00f(rax0x8007000e), 138 s+0x61bbd6, 120 s+0x35a47bc, 141 s+0x2926872, 145 s+0x13936, 95 s("–": the run had ended.)
What the numbers show
main: local video memory goes past the card (19.8 GiB on 10 GB). ThenCreatePlacedResourceXfails with0x8007000e, texture uploads fail, and the title stops 1–10 s later, in both runs.With any of the three PRs: no
0x8007000ein any run. Growth from 60 s to 120 s:main: 10.1–10.4 GiB.Video memory still grows while the world streams with all three.
4 of the 6 PR runs still end in an access violation (write) in the title, between 95 and 145 s, at four different addresses. None of them follows a failed allocation in the log.
+0x13936is also one of the twomainendings here, and with+0x35a47bcit is in MaurycyBartczak's earliermainruns (#156).No device removal in any run.
No new warning kinds compared with
main's runs. The only new lines are DirectStorage failures for other files, because these runs got further into streaming. The refused BCPack counts depend on how far streaming got.Correctness not checked: the frames during loading are a dark loading fade, and I can't look at them. Wrong or zeroed textures from shared or retired pages would not show up in any of these counters.
Smoke, 60 s, no input (
scripts/smoke.ps1; itsgpu:line comes from #281, since without it the script names this machine's iGPU)main
9ab7d76#269
8111cf9#288 876557c
#292
bf8e16cClaude Code (Claude Opus 5.5) ran the tests and wrote this report. Crash addresses and XCL's counters only; no game files attached.
@notdxbi on GitHub · 2026-11-24 01:03 UTC · original
A data point from Linux / Wine, RTX 5060 8 GB (NVIDIA 595.112.07, 31 GB RAM),
maina6f5f7a+ #494/#495/#496, Series X profile,XCL_ACTIVITY=1, A pressed at the account prompt. On this card the growth ends the run, so it is the stop here.From the
memory:line while the title streams its world (Wine reports 0 for the process commit):NV_ERR_NO_MEMORYfor system memory. The run ends inmsvcrtmemcpy fromread_committed(write fault), which looks like what #454 handles.I'm looking at why target pages aren't given back (where GPU-owned targets placed over the same title memory again get new pages). I'll post here if I find something concrete.
@MicaelHernandes on GitHub · 2026-11-24 01:34 UTC · original
Retail streaming on a 12 GB AMD card: frames stop once local video memory passes the card's size, with or without #490 / #435 / #501 / #522 / #483
A data point for #248 on current
main, where the memory growth while the world streams is still there. The PRs that speed up the streaming path move the stall earlier or later, but in every run it begins when local video memory reaches the card's 12 GB.Setup
device_type = "anaconda",XCL_ACTIVITY=1 XCL_TRACE_FAULTS=1, one A press on the first menu, runs up to 320 s.main7ebf1b8+ #4511f282c7main508a0c7+ #4511f282c7+ #4907695539+ #435a94e151c73b0c8+ #522638c039+ #4833462d40All merges were clean.
Frames and memory (cumulative presents from the activity lines; process commit / local video memory from the memory lines)
+0x23cf683, with+0x4e4ba89,+0x2215c35and+0x2215ecaon the stack.used()totals (#522), the bounded search (#483) and the sparse-window write check (#501) all in, it stalls at the same video memory and the same time as B.Also seen
device_type = "lockhart"(A's build,console_type_rawleft at 6), the title stayed on a black screen at a steady 30 fps for over 3 minutes, at 19.3 GB commit / 7.5 GB local video memory, with no DirectStorage traffic. It started loading again after an A press, and 8 s later stopped on0x80000003at+0xb18de7. I don't know whether that comes from the Series S memory budget or from the mismatch withconsole_type_raw.main.I can rerun any of these with other settings or diagnostics.
AI use: Claude Code (Claude Opus 5.5) ran the builds and the runs and drafted this comment; the numbers come from the logs of these runs on my machine.
@notdxbi on GitHub · 2026-11-24 01:40 UTC · original
Follow-up to my numbers above, same setup (Linux/Wine, RTX 5060 8 GB),
main7ebf1b8+ #454 + #494–#496. These are experiments, not PRs.Where the targets come from: a counter on the
XCL_ACTIVITYline shows 62 000 live targets at 170 s, growing ~300/s, none released. Most are made byreal::resource_at: the console's views of memory (#70/#71) have no object, so XCL makes a placed resource per (va, desc) and keeps it inMADEfor good. Each one holds its pages.Two things I tried:
kernelx::unmap_away, remapped on the next map there). Correct, but it barely matters: 422 targets in a whole run. The title rarely unmaps under its targets.XCL_TARGET_PAGES_MB). Past it, the oldest view-made targets have their tiles unmapped (TILE_RANGE_FLAG_NULL, after a GPU wait on the title queues) but keep their object, so a stale descriptor reads zeros instead of faulting. ~40 000 were given back, with no GPU faults. Target pages still reached 5.2–5.6 GB with a budget of 3 GB or 1.5 GB. What's left is mostly the title's own placed resources (CreatePlacedResourceX), which it also never releases while streaming.So on an 8 GB card the total is still too much: local VRAM full at ~6.6 GB, 7–8 GB non-local, plus the title's memory. System RAM runs out at ~135–150 s, and the run ends with a write fault in
memcpyinto a title page whose commit failed.My reading: a bound has to cover the title's placed targets too. One way is to unmap tiles of targets not used recently (by last bind / last time a descriptor naming them was copied) rather than by creation order. Happy to test anyone's approach on this card; the experiment's diff is available if useful.
@RD-sample on GitHub · 2026-11-24 02:47 UTC · original
Additional data point on
9ce2070, RTX 3060 Ti 8 GB, GTA VI Xbox Series package 1.0.2.1. With XCL_TEXTURE_SKIP_UNCHANGED=0, XCL presented 3,600 frames before the window froze. At 162.5 s, D3D12 reported 0x887A0007 (DEVICE_RESET). The run recorded 414 rejected BCPack requests. I did not measure VRAM growth during this run, so I can confirm the reset code but not its cause. With the default texture setting, a separate run ended in a read access violation during texture refresh after 3,000 frames. Is there a specific fix after9ce2070worth testing for this case?