[pr-fix][memory] A title free reaches the paged copies even with nothing in place #321
Loading…
Reference in a new issue
No description provided.
Delete branch "ntsthay/title-free-paged"
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?
Not run in the game. A unit test shows the problem: it fails on
mainand passes with this change.Contributor role (optional)
What it changes
a_title_free_reaches_the_paged_copies_with_nothing_in_placefails onf3840d7withleft: [],right: [(1098842112, 65536)], because the free never reachesshadow::paged_freed.watch::title_memory_freedtold the copies held page by page about a free only throughinplace::title_memory_freeing, and it called that only when something was in place (inplace::holds_any()). In play nothing is in place, so withDARNER_PAGE_BUFFERS=2or3the paged copies never learn that the title freed or decommitted the memory under them. Under mode 2, tiles that lie wholly inside a freed range keep their memory. Under mode 3, whichplaysets, the report leaves out the bytes kept under freed tiles.The telling now lives in
tell_holders_of_freed_memory. When nothing is in place and a paged mode is on, it callsshadow::paged_freeditself, so each free reaches the paged copies once: throughinplacewhen something is in place, directly when nothing is.freed_lenreplaces the two copies of the "length, or the whole allocation" computation.The hook in
shadow.rsis#[cfg(test)]only. It records the rangespaged_freedwas asked about, since a real paged copy needs the adapter.How it was tested
6a00b27, this branch onf3840d7.cargo test -p darner-gpu --lib a_title_free: passes on6a00b27, fails onf3840d7with the message above.cargo test -p darner-gpu --lib -- --test-threads=1 watch:: shadow::: 199 passed and 10 ignored on6a00b27(209 tests, the new one included); 198 passed and 10 ignored onf3840d7.6a00b27: gates 1 and 2 (cargo clippy --workspace --all-targets --locked -- -D warnings, and the same with--all-features) are clean. Gate 3 ran under Wine (Proton on Linux, RTX 4080), not on Windows, and only thedarner-gputests above count as passed. Under Wine some tests fail onf3840d7too, such astests::windows_is_not_wine, therun::tests::late_dll_*tests, and somedarner-gpufont, panel and pipeline tests. None of them is in the files this PR changes.Checklist
main.docs/asset-policy.md.It was not run in the game. In play its effect is a count in the report under mode 3, or tiles given back under mode 2, and the unit test covers the path.
Checked for overlap
watch.rs, for landed pages, which is a different problem.Independent Windows build, gate, and code-read review of head
6a00b277ad8db247ff0187a6045b026683991567, based onmainf3840d73d3504c30218debfbc8795b9225447317. Not run in-game.Environment
x86_64-pc-windows-msvc), MSVC 19.44.35230.Measured results
cargo clippy --workspace --all-targets --locked -- -D warnings): PASS.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings): PASS.cargo xtask policy: PASS (asset policy: 555 files ok).cargo test --locked -p darner-gpu --lib a_title_free: PASS (1 passed; 0 failed; 0 ignored).cargo test --locked -p darner-gpu --lib watch:: -- --test-threads=1: 88 passed; 1 failed; 0 ignored.cargo test --locked -p darner-gpu --lib watch::tests::ask_once_by_res_splits_reservations_without_refusals -- --exacton currentmain: 1 passed; 0 failed; 0 ignored.cargo test --locked -p darner-gpu --lib shadow:: -- --test-threads=1: 109 passed; 1 failed; 10 ignored.cargo test --locked -p darner-gpu --lib shadow::wide_tests::nested_wide_each_scoped_handles_overflow_concurrency_and_panics -- --exactalso fails on currentmain(0 passed; 1 failed; 0 ignored).Code-read audit
freed_lenpreserves the old explicit-length versus whole-allocation calculation.tell_holders_of_freed_memoryavoids allocation queries when there is no consumer and no length, retainstexture::remapped, and routes throughinplace::title_memory_freeingwhen in-place state exists; otherwise it callsshadow::paged_freeddirectly (crates/darner-gpu/src/watch.rs:5903-5937). The in-place path already callspaged_freedonce (crates/darner-gpu/src/inplace.rs:523-535), so the new branch avoids duplicate notification.shadow::paged_freedkeeps its existing mode-2 release and mode-3 accounting behavior; the added thread-local call recorder is test-only (crates/darner-gpu/src/shadow.rs:951-1007). The regression test clears and checks that recorder around a fresh allocation/free (crates/darner-gpu/src/watch.rs:6927-6953).main, and the watch failure is the known flaky test and passed isolated onmain. The targeted regression passes on this head.No blocking issue found.
Verdict: PASS.
AI-assisted: yes (GitHub Copilot, Auto mode).
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.