d3d12: since 106120ca, a full piece cache re-imports the same GPU page cluster windows until RADV loses the device (RX 6700 XT) #666
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?
Imported from brcly/TuxBox. Originally posted by JeffreyBytes on 2026-12-03T01:03:25Z.
On main
106120ca, ProjectScarlett loses the device on my RX 6700 XT (1002:73df, RADV / Mesa 26.3.1, GE-Proton11-15,section-import=substituted) 170-210 s after launch, right after the setup screens. The memory ledger's adapter system memory goes from about 1.5 GiB to 18-27 GiB against a 15.9 GiB budget in under a minute, then:The game exits with code 3. The kernel log is clean, with no GPU fault or reset.
a789a4e4, one commit earlier, stays flat at 1.1-1.5 GiB.TUXBOX_XMEM_PRIVATE_VIEWS=0also stays flat, but that takes the queue page mappings back to being refused, so it doesn't isolate anything.The memory is real. I sampled the game's
/proc/<pid>/fdinfofrom outside, anddrm-memory-gtttracks the ledger (15.9 GiB at the crash).I think the cause is the
piecescache inPagePools(device/heap/pages.rs). It's aPageCachewithLIMIT4096, andget_or_opendoesn't index a new key while all 4096 entries are live. That bound is on purpose:failed_imports_are_not_cached_and_live_entries_are_boundedtests it. Since106120cathis host takes the private-backing path, sogpu_tilefills that cache with single 64 KiB "GPU page mapping" pieces that GpuTiles keep alive. Once there are more than 4096, a new "GPU page cluster" window fromshared_windowis opened but never indexed. Every later page in that window opens another import of the whole window, which is 64 KiB-4 MiB each, and each import is its own userptr BO charged in full to GTT.I measured this with a local trace build. It counts live native heaps by source through a private-data marker on each heap, and logs every new window
shared_windowpicks:In another run, at the crash, the live cluster heaps alone were 17.8 GiB (4,910 heaps), which is more than all the title's pages (7.1 GiB). The single-page imports were 288 MiB.
As a check, I changed
get_or_opento always index a new live import. Cluster opens then matched the windows (1,259 opens, 1,269 windows), adapter system memory peaked around 4.5 GiB, and there was no device loss. That run went 432 s and then ended with exit code 5 on the title's watchdog (exe+0x23CF683, #215), which I've seen on older builds too, so I don't think it's related. That change was only a test, since it drops the bound the cache is meant to keep.I also read the host side (vkd3d-proton
OpenExistingHeapFromAddress1, RADVbo_from_ptr, amdgpu userptr) to rule out a per-import overhead. Each import charges its own size and gives it back on free, so the growth is the duplicate imports and not a driver cost.I haven't tried NVIDIA. I'd guess it doesn't take this path because it imports sections. Someone else saw the same crash on another AMD card, but I don't have their numbers.
Things I haven't figured out yet: why live single-page pieces reach about 12k at once (they do get released, and each one is a BO on every submit), and whether 12k is expected.
I'm working on a fix. My plan is to give the cluster windows their own lookup outside the bounded cache (there are only about 1.3k per run), with a test that fills the cache with 4096 live pages and then expects one import, not two, for two pages of a new window.
Imported from brcly/TuxBox. Originally posted by brcly on 2026-12-03T01:06:32Z.
Yeah this issue seems to only affect AMD atm.
Open a PR when ready and I'll have a look and make sure it doesn't affect nvidia, which is suffering a different issue related to raytracing atm.