d3d12: skip unchanged texture publications, store into XMem pages, share in-flight readback buffers #439
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/439"
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 NickStallman on 2026-11-29T04:17:26Z.
Draft. Unrun in the game on
main, and not measured there. The full check passes on an RTX 5090 and an RDNA 2 iGPU, and so do this PR's 12 device tests on both. Opening early because it touches whatc92559b6just changed, so it can be steered before more work goes in.Summary
c92559b6narrows what is read back, and caps idle readback buffers. Three things remain for the mips that are still read back. They behave independently, but their changes sharewriteback.rsand a test rig, so this is one PR to review commit by commit:TUXBOX_PUBLICATION_COMPARE=0turns it off.WriteProcessMemory, which is a Wine server request per run. Pages that aren't plain read-write keep the native write, including a page in a reservation of the title's own that carries the title's write watch (#290).TUXBOX_PUBLICATION_STORE=0turns it off.submitalready queues one on the worker's fence.TUXBOX_READBACK_SHARE=0turns it off.Overlap with
c92559b6Commits 1 and 2 act on mips still read back, so they don't duplicate it, but they plausibly gain less than before. Commit 3 overlaps only in the idle cap, whose constant it reuses. If you'd rather take only some of these, I can split or drop them.
What I don't know
main: not measured yet. A run with an earlier version of these commits, withoutc92559b6, still spent a good part of its frame time publishing, so they are not a full fix.Tested
python tuxbox.py checkon an RTX 5090 (10de:2b85, NVIDIA 620.70.10) and an AMD Raphael iGPU (1002:13c0, Mesa RADV 26.0.8), GE-Proton11-14: all steps passed (guest-present-4k-splash skipped on AMD). On962a1cee.main. Removing the title-watch rule, the XMem store or the holed-baseline overlay each makes a test fail.publication_compare.rsanda_finished_readback_lends_its_buffer_and_list_to_the_next), by exact name, on both cards: all pass, and each prints the device it opened, so none returned early. The project's checks only typecheck the D3D12 crate, so run these by name.Lanes: no new scenario. These commits must not change output, only work done and memory, and the two correctness edges (a title store racing a publication, a title-owned watched reservation) can't be made deterministic from a guest. The existing publication Lanes cases cover the output.
🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by DrArroway on 2026-11-29T08:38:42Z.
Tested same-binary A/B of
#439(962a1cee) in ProjectScarlett (1.0.2.1, 3840×2160, offline) on AMD Radeon RX 6900 XT (1002:73bf, RADV NAVI21, Mesa 26.3.1, Linux 7.3.6,GE-Proton11-14) withTUXBOX_SUBMIT_PROFILE=1.main(2871726) +#455(guest-memory BLAS lifetime) +#441(root SRV/UAV reach) +#439(962a1cee, clean merge).TUXBOX_PUBLICATION_COMPARE=0 TUXBOX_PUBLICATION_STORE=0 TUXBOX_READBACK_SHARE=0(449.7stotal,113D world windows /22placement publicationprofile windows =188.7s,38readback windows =191.9s)623.6stotal,103D world windows /21placement publicationprofile windows =117.6s,24readback windows =121.0s)3D World Steady-State Comparison
#439OFF#439ON (default)21frames /174s(8.29 s/frame,0.121 FPS; steady after first window:18/155s=8.61 s/frame)27frames /107s(3.96 s/frame,0.252 FPS,3 frames / 11–13s)2.1×–2.2×fasterplacement publication157.07s / 188.7s(83.2%wall,229calls, avg685.9 ms, max2,699.2 ms,78,220.5 MiB,2.008 ms/MiB)49.34s / 117.6s(42.0%wall,299calls, avg165.0 ms, max1,592.4 ms,104,147.2 MiB,0.474 ms/MiB)4.24×faster/MiB,4.16×lower avg/batchpublish-compare(commit 1)17.72s(15.1%wall,0.173 ms/MiB,69,422units /102,218.7 MiB)unchanged ... written againfell from17,378 / 48,681(35.7%) to3,034 / 63,423(4.8%)publish-retile48.21s(25.5%wall,52,415units /76,778.3 MiB, avg210.5 ms, max1,001.0 ms,0.628 ms/MiB)14.18s(12.1%wall,8,792units /26,482.1 MiB, avg55.0 ms, max392.5 ms,0.536 ms/MiB)3.8×lower avg/batchpublish-store(commit 2)107.47s(57.0%wall, avg469.3 ms, max1,811.9 ms,1.400 ms/MiB)16.01s(13.6%wall, avg62.1 ms, max709.4 ms,0.605 ms/MiB)2.31×faster/MiB,7.56×lower avg/batch,0store faultsplacement readback(queue side)3.42s(232calls, avg14.7 ms, max284.6 ms)1.78s(307calls, avg5.8 ms, max47.6 ms)2.5×faster avg,6.0×lower max189created (88,695.4 MiB),51reused (21.2%across240batches)32created (1,540.4 MiB),274reused (89.5%across306batches;0created /100%reused in the final steady windows)98.3%less allocation churnVK_ERROR_DEVICE_LOST00Summary
All three commits pay off clearly on
main(2871726) on RADV:publish-compareitself at0.173 ms/MiB).publish-storecost per MiB by 2.31× with0store faults.86.6 GiB→1.50 GiB).main:placement publicationstill takes42.0%of wall time (15.1%compare +12.1%retile +13.6%store) because~104 GiBof placed textures (largest=939.3MiB/504 texturesper batch) are still read back.Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-29T10:19:53Z.
Measured in ProjectScarlett's world load on
main(75453953), RTX 4070 Ti SUPER, warm caches, one run each:mainCombined with #460 and a heap write bitmap (#462, stacked on this and #460), pinned readback in the world load is 0.29 GiB.
lanes-bindless-compute22/22 on an RTX 4070 Ti SUPER and a Radeon 610M,lanes-selftest27/27 andd3d12-placementon NVIDIA,publication_compareand the rest of the d3d12--libtests (376) under Wine.#462 changes
Worker::enqueueto take an optional readback beside the bitmap part, so one job still signals publication once per batch.Could this come out of draft? #462 builds on it.