WIP: [pr-performance][memory] DARNER_LAND_LEAVE: listed ranges stay on the card when shader writes are declared, not compared there #310
Loading…
Reference in a new issue
No description provided.
Delete branch "Yorivel/Darner:pr/land-leave-declared"
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?
Refs #287
Draft. Update below: a city run, but with #274 merged in too, so its copy-back figures are not this change's alone. A city run with this change alone is next.
Contributor role (optional)
What it changes
DARNER_LAND_LEAVEleaves listed ranges only at the landing (host.rs, the relay's fetch plan): the card has already hashed and compared them by then. In my A/B (below, "v0") it left 185 pieces, 5.6 MB a frame, and landed pieces fell by 42 %, but the relay's time and the frame times did not improve.Shadow::shader_writesnow cuts a declared shader write by the list (land::leave::split). The parts inside a listed range are left on the card the wayDARNER_WC_NO_BACKleaves write-combined memory:note_batch_write,mark_written,leaves, and no deferred write, so the card neither hashes nor compares them. The parts outside go on as before (the rest ofshader_writes, moved intoShadow::shader_writes_backunchanged). The landing's check stays, for pieces flagged another way. The frame-rate line of the switch also gives the MB of declared writes left. With the switch unset nothing changes:leave::on()is false andshader_writescallsshader_writes_backwith the whole write, as before.The risks are
DARNER_WC_NO_BACK's, for the listed ranges only: the title reading there sees old bytes, and a page the CPU writes goes up whole and takes back the shaders' bytes in it. Hence the list comes from aDARNER_LAND_READScensus (#300 names the code places that touch landed pages): ranges the title's code never touched.How it was tested
Tested revision: the same commit on
f3840d7with #185 merged, PGO build; the gates on this branch (onmainf3840d7).Commands and results:
cargo test -p darner-gpu --lib land::leave(2 tests, one new: a write cut by the listed ranges); the gates below.Changes a default: no (only with
DARNER_LAND_LEAVEset, off by default).A/B result: RTX 4090, the same save, 10 min each,
DARNER_UNIFIED_STATS=1; A = no list (two runs), v0 = main's landing-time leave, v1 = this change; the same list of 15 ranges, 21 MiB, made from two censuses that agreed on 21 of 22 MiB.Gates run on
53d43eb: the asset policy and gates 1 and 2 (both clippy runs) pass. Gate 3: every crate passes exceptdarner-gpu's library tests, where onewatch::test (watch_pipe_epoch_tests::ask_once_delta_reask_direct_carves_refreshes_and_updates_page_epochs) failed in the full parallel run. This change touches nowatchcode; the same tests fail by chance onmaintoo (see #300's description, and #224, #261).Gameplay: RTX 4090, i9-14900K, Series X, 1440p, DLSS Quality, DLSS frame generation 2x, hardware RT. No visual faults seen with the list, in either run.
Hardware dependence: the mechanism is general; the list is per PC until shown otherwise (the census's addresses held between my runs, other PCs untested).
Coverage gaps: one run per variant. The v1 run had lighter scenes (no samples above 9,000 draws, five at 7,000-9,000), so its whole-run figures gain from that; the per-band rows are the fairer comparison. Driving into the city at its end it stuttered with the texture queue at 10,300 slots, 2,939 waiting for memory; heavy scenes are the next run.
Update: a run into the city
Same settings and list, 10 min, into the city from about the second minute. The build had this change plus #274 (and #283, which does nothing with Reflex off), so the copy-back figures are the two together.
Copy-back about halves in every band, the city's too; wc to copy back per frame, median, 94 MB (A 159 / 149). No visual faults seen.
Frames over 50 ms did not fall in the city, and per minute they follow the texture queue, not the landing:
So the city's remaining stutter looks like texture streaming waiting for room, which this change does not touch. The A runs spent less time in the city, so the per-band comparison is the fairest there is, not an exact one.
Checklist
main.docs/asset-policy.md.Checked for overlap
land/leave.rs. #37, #214, #218, #219 and #221 changeshadow.rselsewhere; #221's hunk lies next toshader_writes, and a trial merge of it with this branch has no conflict.🤖 Generated with Claude Code
Amazing🎉
@TrustNo1 review this
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.