d3d12: keep replaced views for the records a title copied #393
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/393"
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 MathiewMay on 2026-11-28T09:58:07Z.
Stacked on #391. The first commit is #391's; this PR adds the second, "d3d12: keep replaced views for the records a title copied". I'll rebase it once #391 is merged.
Summary
On console a descriptor copy holds the descriptor's bytes, so a title can reuse a CPU heap slot as soon as it has copied from it. ProjectScarlett writes a descriptor into a CPU heap of 3,128 slots, copies its 32 bytes into its shader-visible heap, and writes the next descriptor into the same slot. Here the copied bytes are a record naming the slot and the version written there. Once the slot was written again, the record named a view that no longer existed. A root table could not resolve it, and neither could the index map's refresh from #391, which counts it stale and leaves the slot's old view.
descriptor_paging/history.rs(new): before the API replaces views in a heap of such records, the views about to be replaced are copied into a ring of 65,536 host descriptors, indexed by version. This happens for a descriptor write (Write::new) and for a descriptor copy into the heap (copy_host_range).Arena::resolve_inline: versions are unique across the device, so a record whose version is no longer the slot's resolves to its kept view, while fewer than 65,536 views have been replaced since. Root tables and the index map both resolve through it.In ProjectScarlett, with traces I kept out of this branch, the refresh counted 16,661 stale records in 84 s without this change and 2,848 in 165 s with it, about 12 times fewer per second. The copies a submission reaches lag about 12,500 versions behind their slot. Some still go stale: they lag further, and I have not checked whether that is past the ring.
In game I tested this on an older
maintogether with other fixes of mine, not on this branch alone; with all my fixes a 30-minute run had no fault.Tested
New Lanes scenario
bindless-raw-copy-reused(gateslanes-bindless-raw-copy-reused-wideand-constrained, in thelanes-bindless-computesuite). It is #391'sbindless-raw-copy, except that the title writes another view into the CPU heap slot it copied from before it submits. The copy must keep the view it was given. With #391 alone both gates fail:GPU, driver and backend: AMD Radeon RX 9070 (1002:7550, RADV GFX1201), Mesa 26.2.7, Linux 7.3, GE-Proton11-14 (
--backend proton).Commands run and their results:
The D3D12 controls ran with the tool's own case table, staging and
validate, but outside its Bubblewrap/xvfb-runsandbox, which stalls on this machine (it has no Xvfb).Checks
No evidence JSON changes.
Imported from brcly/TuxBox. Originally posted by DrArroway on 2026-11-28T15:28:10Z.
Tested in ProjectScarlett 1.0.2.1 on an AMD Radeon RX 6900 XT (
1002:73bf, RADV NAVI21), Mesa 26.3.1, Linux 7.3.6, GE-Proton11-14 (--backend proton), warm shader caches.mainat6f89916): Two runs both lost the device immediately on the first 3D world frame (radv: GPUVM fault,CLIENT_ID: TCP (0x8)).d9dfe887, including #391) stacked with #373, #389 and #398 on6f89916: Rendered13+world frames over 7m 12s (2,105frames total) with0GPUVM faults and0device losses (ending on a title CPUEXCEPTION_BREAKPOINTin resource loading). Two further world runs rebased ontoe380da1also entered the world cleanly with no copied-descriptor faults.Also confirmed this rebases cleanly onto
mainafter #395 and #399 (567bd04), needing onlyin_flight: Mutex::default(), pins: Mutex::default()added to the testArenaliteral inruntime/d3d12/src/tests/device/descriptor_paging.rs.Imported from brcly/TuxBox. Originally posted by MathiewMay on 2026-11-28T16:19:44Z.
Thanks for testing, and for the rebase note.
Rebased onto
2af42c9with that change: the testArenaliteral getsin_flightandpins. The literal is in #391's commit, so the change is there. #391 is now99d8569, and this branch is0ae06f5on top of it.After the rebase, on an RX 9070 (RADV GFX1201, Mesa 26.2.7, GE-Proton11-14): 292 crate tests pass, the 39
lanes-selftestandlanes-bindless-computegates pass (including the four raw-copy ones), andtuxbox.py check --no-gpupasses.