[pr-performance][memory] Windows of title memory on the card tile by tile (DARNER_WINDOWS_SPARSE; off by default) #62
Loading…
Reference in a new issue
No description provided.
Delete branch "Sobo/Darner:windows-sparse"
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?
With DARNER_WINDOWS_SPARSE=1 (and tiled resources tier 2 or more), the
card side of a window of title memory is a reserved buffer: its 64 KiB
tiles get memory from a pool of 64 MiB heaps only when a send first
brings them bytes that are not zero, or when shaders may write them, and
give it back when a send brings a whole tile as zeros. Empty heaps go
back to the card 5 s later. The mappings are made on the queue before
the list that sends. Unset or 0: windows as before.
A window made tile by tile is counted in WINDOW_SPARSE_BYTES, not in
WINDOW_CARD_BYTES, so its drop leaves WINDOW_CARD_BYTES alone: taking its
size off there ran the count below zero a few minutes into a city, and
from then on window_admission refused every new window the card. The
windows line says that count too.
Ported from fxceless/blackbebec b715714 (GPL-3.0), without its
DIRECT/Sources parts.
Co-Authored-By: Claude Opus 5.5 [email protected]
Fluxer-ID: 1577742832095989771
Contributor role (optional)
What it changes
Switch:
DARNER_WINDOWS_SPARSE=1(off by default).A window of title memory (memory outside the title's buffers) gets as its card side a reserved buffer (CreateReservedResource) that is given memory in 64 KiB tiles, from a pool of heaps, only where the GPU or the CPU actually touches it. Empty heaps are released after 5 s, not at once (releasing them at once lost the device). Page buffers stay out of tiled windows (
buffer_sides(..., direct = !tiled)).A tiled window is counted in
WINDOW_SPARSE_BYTES, not inWINDOW_CARD_BYTES, so its drop leavesWINDOW_CARD_BYTESalone. (Taking its size off there ran that count below zero a few minutes into a city; from then onwindow_admissionrefused every new window the card (Fallback::Cap) and placed it in the PC's memory.) The windows line also says that count now.Ported from fxceless/blackbebec b715714 (GPL-3.0), without its DIRECT/Sources parts.
How it was tested
main4a92569fb(git.gtahub.st) with this patch applied. Build check:cargo clippy -p darner-gpu --all-targets --target x86_64-pc-windows-msvc --locked -- -D warnings: clean.cargo testwas not run (no Windows machine for the checks). The gameplay numbers below come from my own builds, which carried this change together with other local changes (same scene, settings and hardware before and after).darner warm --used --againwithDARNER_WARM_SHARED=1.buffer mirror spanof about 17,592,186,040,000 MB in the compile-memory line). In three runs with it (Series S profile, 1440p output, FSR 3 frame generation 2x, 5 to 6 minutes of city each), the count stayed at 0 MB, the span stayed positive (4.3 to 4.9 GB), and at the end 1,126 windows (6.9 GB) were on the card, none in the PC's memory, none turned away.DARNER_PAGE_BUFFERS=3(now on by default) solves a similar problem; the two have not been compared side by side.Checklist
main.docs/asset-policy.md.Checked for overlap
WIP: Windows of title memory on the card tile by tile (DARNER_WINDOWS_SPARSE; off by default)to [pr-performance][memory] Windows of title memory on the card tile by tile (DARNER_WINDOWS_SPARSE; off by default)View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.