Repository navigation
Description
What happens
With #258 (d50a51c) the RX 6700 XT runs ProjectScarlett without the #191 preload and gets through the page-remap batch, but every run then ends on the story loading screen: VRAM fills, GTT climbs, and the kernel refuses a submit (radv/amdgpu: Not enough memory for command submission, device lost) or the title's watchdog fires on stalled label waits. The run reports are on #258. @DrArroway measured about 28.5 GiB of VRAM + GTT on a 16 GB / 64 GB machine once the world streams, against about 27.5 GiB available on a 12 GB / 32 GB one.
The console has 16 GB in total, so most of that is how the provider holds data, not what the title needs. This issue is a breakdown of where it goes, from one run.
Setup
RX 6700 XT (1002:73df, 12 GB), 32 GB RAM, Mesa RADV 26.3.1, Linux 7.3.6, GE-Proton11-14, ProjectScarlett 1.0.2.1 offline, 3840x2160, shaders prepared, no LD_PRELOAD. Build: #258 at d50a51c plus one local diagnostic commit that counts the provider's live native objects by category and logs them every 5 s (TUXBOX_TRACE_GPU_MEMORY=1). The counters go down when the native object is released. Sizes are approximate (GetResourceAllocationInfo for textures). The commit is on my fork as local/mem-accounting; it is a measuring aid, not something I am proposing to merge as it is.
Result
Native device memory the provider holds, MiB (live objects in parentheses). The page-remap batch is at about 90 s.
| time | native copies of guest textures | render heaps | staging | total counted | CPU-side texture snapshots (host RAM, upper bound) | imported guest pages (not new memory) |
|---|---|---|---|---|---|---|
| 62 s | 1,416 (1,151) | 3,022 | 0 | 4,562 | 1,313 | 1,112 |
| 77 s | 2,382 (16,253) | 3,022 | 0 | 5,529 | 1,360 | 1,139 |
| 107 s | 5,971 (17,585) | 3,000 | 0 | 9,094 | 5,048 | 1,446 |
| 153 s | 7,581 (22,677) | 3,000 | 0 | 10,705 | 6,467 | 1,687 |
| 199 s | 9,184 (27,566) | 3,000 | 0 | 12,308 | 7,895 | 1,975 |
| 234 s (last) | 9,222 (28,190) | 3,000 | 1,659 | 14,009 | 7,895 | 2,607 |
Driver counters for the game process at the last sample (/proc/<pid>/fdinfo): amd-requested-vram 13,425 MiB, amd-requested-gtt 7,626 MiB, drm-memory-vram 9,809 MiB, drm-memory-gtt 11,241 MiB. Card totals: VRAM 12,271 of 12,272 MiB used, GTT 11,335 of 15,913 MiB. This run ended with the label-wait stall and the watchdog at 269 s; the two before it on d50a51c ended the same way or with the submit refused when GTT reached its total.
So:
- Two thirds of the native memory is copies of guest textures: 9.2 GB in 28,190 native images at the end, growing from 1.4 GB before the title starts streaming. Committed render targets are 64 MiB, and nothing is on default, upload or readback heaps of the provider's own.
- Each of those textures also has a CPU-side snapshot, up to 7.9 GB of host RAM, on top of the guest pages the title wrote them to. That is the same texel data three times: guest pages, host snapshot, native image.
- Render heaps are a flat 3.0 GB from the menu on.
- Imported guest memory is small (2.6 GB of guest pages pinned, no new memory), which matches the hold numbers on xmem: back physical pages with private memory and export backing holds #258.
Where the copies come from (reading the code, not measured further)
runtime/d3d12/src/device/placement.rs: a CPU-visible texture placed at a guest address gets a committed native image on a DEFAULT heap, andContents::previouskeeps an exact per-mip copy of what was uploaded so later writes to the guest pages can be detected.runtime/d3d12/src/device/heap.rs(RenderHeaps::acquire): images placed at guest addresses get device heaps while the guest range stays committed.
Buffers are imported in place now (#218, #253, #258). Textures are not, and on Vulkan they probably cannot be in general (console tiling and layouts differ from what a host image can alias), so I am not suggesting that. Cheaper things might be possible: dropping the CPU snapshot where a write-watch or a hash would do, releasing native images the title has stopped referencing, or creating the native image on first use rather than at placement.
What I am asking
Whether someone who knows the placement code sees which of these is realistic. I can run any candidate on this card, where the limit is hit two minutes after the picker, and report the same table.
Not established
- One run with the accounting; the totals and the shape matched the driver counters of four earlier runs, but the per-category numbers have not been repeated.
- What the 1.66 GB of staging in the last sample is (four objects that appear in the final 20 s).
- About 3 GB of
amd-requested-gttat the end that the provider-side counters do not explain; vkd3d-proton's own allocations are not counted. - Whether the native images that stay alive are still referenced by the title.
Activity
brcly commentedon Nov 27, 2026
Yeah, this seems to be one of the last blockers to getting in the game.
I can look into a solution and I emplore others to do so as well.
Realistically, the way we have to handle this is to keep certain resources out of RAM + VRAM and only load when ready to display.
I'll try and dig and see what I can find.
NickStallman commentedon Nov 27, 2026
Some numbers from the NVIDIA side that may help separate the two endings. They come from an RTX 5090 (32 GB), 3840x2160 output, with a local probe build on e76ff6a + #235:
We get the same stall with plenty of memory free. The story intro runs at one frame per 12–18 s, and the label waits are force-released after 5 s, which is the ProjectScarlett: 30 s main-thread watchdog (exe+0x23CF683) at the story intro from cross-queue label-wait deadlocks #215 picture. So the watchdog endings on your card are probably ProjectScarlett: 30 s main-thread watchdog (exe+0x23CF683) at the story intro from cross-queue label-wait deadlocks #215 itself, with running out of memory making it worse rather than causing it.
Publication is what makes it big. Any batch with a whole-heap descriptor range counts every UAV-viewed placed texture as written. Over 354 s of the world phase that gave:
Each job allocates a readback buffer of that size, which may be what your staging figure is catching. The per-mip CPU snapshots in your table are the copies each submit compares against: 250 GiB read and compared in that phase.
Narrowing the write set to the textures a pipeline can actually store to would cut the readback allocations and the per-job traffic. It wouldn't reduce the number of native images or the size of the snapshots held. I'm working on that narrowing, building on the findings in ProjectScarlett: 30 s main-thread watchdog (exe+0x23CF683) at the story intro from cross-queue label-wait deadlocks #215.
JeffreyBytes commentedon Nov 27, 2026
Follow-up with the question I left open: are the native texture copies in use? On this card, almost none of them are, and almost none have ever had anything uploaded into them.
I extended the local trace (same branch on my fork, now two commits) to stamp each native copy of a guest texture when a submission uses it, when a view is created over it, and when the provider uploads guest bytes into it. One no-preload run of #258
d50a51cplus the trace, RX 6700 XT, 3840x2160; this one ended withNot enough memory for command submissionat 186 s.What I read from it:
never_titledin the trace: 23,357 of the 25,756 come from address-only SRVs), long before anything draws with it, if anything ever does. Creating the native image at the first upload instead would have kept about 7.6 GB of VRAM free here. That is the "load when ready to display" direction, and this says how much it is worth on this path.released=0), so the provider is not parking anything itself; the title, or a descriptor slot, still names them. Nothing evicts a copy today.So on a 12 GB card the two things worth doing look like: do not allocate the native image until the first upload (about 7.6 GB here), and bound the publication readback (about 10 GB at the peak here). Both would have to hold before this card can get past the loading screen.
Limits: one run. "Used" is counted per submission and over-counts when a whole descriptor heap is bound, so the never-used numbers are lower bounds; the never-uploaded column does not have that problem. Descriptor copies and
Mapare not counted as uses.I can run either change on this card when there is a branch, with the same table.
JeffreyBytes commentedon Nov 27, 2026
I'm trying a prototype of the first of those (allocating the native image at first upload instead of at placement or view creation) on this card. I'll post what it does to the table either way; say so if you already have this in hand and I'll test yours instead.