[pr-performance][memory][RAYTRACING] xmem: a scatter mapping's unmapped pages leave the RT tables once, at its end #334
Loading…
Reference in a new issue
No description provided.
Delete branch "MesoPlz/Darner:pr-xmem-scatter-freed-gathered"
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?
Contributor role (optional)
What it changes
XMemMapPhysicalPagesScatterwalking the ray tracing tables, once per page. xperf (CPU samples with stacks) of 3 s of a load, onmainf3840d7: that thread had 1,100 samples, 620 of them underXMemMapPhysicalPagesScatterand 377 underwatch::title_memory_unmapping→hwrt::title_memory_freed_many.XMemMapPhysicalPagesScattermaps one page per address throughXMemMapPhysicalPages, so every page's unmap went throughtitle_memory_unmappingand walked every RT table on its own. #92 gathered those walks for the page-mapping copies (map_aliases) only. This runsXMemMapPhysicalPagesScatterinside the samedarner_gpu::title_memory_freed_gatheredscope, so the ranges it unmaps leave the tables once, before the call returns to the title. The tables end up as before;DARNER_HW_RT_FREED_GATHERED=0restores the walk per page, as for #92. Onlyxmem.rschanges (8 lines).How it was tested
Tested revision:
6bd653aonmainf3840d7. The game runs used the same change on the samemain(d5aa933).Commands and results:
cargo clippy --workspace --all-targets --locked -- -D warnings: cleancargo clippy --workspace --all-targets --all-features --locked -- -D warnings: cleancargo test --workspace --locked --no-fail-fast: 2,786 passed, 3 failed, 105 ignored. None is indarner-hleor near this change:emit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders(#92 reports it failing onmain1a5286atoo),host::card_steps::tests::shared_scratch_eliminates_flight_settle_end_to_endandshadow::wide_tests::nested_wide_each_scoped_handles_overflow_concurrency_and_panics(both timing-dependent; the second also failed once in two runs ofcargo test -p darner-gpu --libon cleanmainfc3642e). Thedarner-shadertest binary hung while the game ran on the same card and was stopped, so not all of its tests ran.cargo test --profile fast --locked -p darner-hle --lib xmem: 53 passed, 1 ignored (ond5aa933, the same diff)Changes a default: no (it uses #92's switch, on by default).
A/B result: the same route twice (start from the same save, drive into the same busy part of the city right away), built with the
fastprofile, RTX 4080 16 GB, driver 621.40, 64 GB RAM, Series X profile, 1440p, DLSS quality, frame generation off, hardware RT. Both runs with the streaming log on (DARNER_DSTORAGE_LOG). Non-default rows in both:DARNER_CARD_WINDOWS_MB=1536,DARNER_WINDOWS_BAR_MB=0,DARNER_ASK_FAST=1,DARNER_HW_RT_BLAS_HEAPS=0,DARNER_KEEP_SHOWN=checked. One run each, hand-driven, so the routes differ a little:main, 134 s logged)The mapping calls' system calls took longer in B (unmap 14.3 → 19.0 s, map 6.0 → 13.2 s, about as many calls), so the calls' total did not fall (34.4 → 36.9 s): those wait for the process's address-space lock, which a kernel thread rebuilding large pages (
MiRebuildLargePages) held for most of a load in the traced runs. This PR only removes Darner's own work in them.Gates run on that revision: all three, results above.
Gameplay: see the A/B row.
Shader wave sizes tested: not relevant (no shader change).
Hardware dependence: needs hardware RT (without it
title_memory_freedreturns early); the cost removed grows with the RT tables.Coverage gaps: one card, one player, one run each; not tested with software RT, AMD, Series S or frame generation. The player saw less pop-in in B; no screenshot comparison.
Checklist
main.docs/asset-policy.md.Checked for overlap
XMemMapPhysicalPagesScatter); #219 changesxmem.rs(other functions).🤖 Generated with Claude Code
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.