d3d12-hle: arrange forgets the slice a page leaves for an unowned one (D3D12-HLE-XMEM-ARRANGE-STALE-OWNER) #2836
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2836
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/xmem-arrange-stale-owner"
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?
Pull request successfully merged and closed
Claimed in the coordination issue as: D3D12-HLE-XMEM-ARRANGE-STALE-OWNER (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7277198683)
What and why
arrange(d3d12/crates/leonida-hle/src/modules/xmem.rs, renderer port 1: the 32-bit heap's slices put in address order) swaps physical pages between slices of one section. When a page moves to a slice that no page has, theownermap still recorded the slice it left as that page's. A later page of the same call moving into that slice then found the first page there and swapped it back, so the first page lost the place it had just been given.The change: in that case the slice the page leaves is removed from
owner(owner.remove(&have)), so it has no owner, as is now true.This ports ahmetbagci's fix from the sibling VIctory tree (TaynanGT/Vice-Tay
fddf8c7, GPL-3.0), credited as co-author.Tested
modules::xmem::tests::arrange_forgets_the_slice_a_page_left_for_an_unowned_one: four pages, slice 1 freed, thenpages[2]moves to the free slice 1 andpages[3]into slice 2, whichpages[2]just left. Onmain(10bed9ff2) it fails (pages[2]ends back at slice 3); with the change both pages are where they were sent.cargo test -p leonida-hle --lib: 241 passed, 0 failed, 2 ignored. The existingthe_32_bit_heap_gets_its_slices_in_address_orderis unchanged and passes.cargo clippy -p leonida-hle --lib --tests: no warning in the changed lines.xmem.rs, notarrange.GPUs tested: n/a (CPU unit tests)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
Verified on Windows: the crate is green with it.
main640b0d0df, cherry-picked (one commit,merge-base10bed9ff2),cargo 1.98.1:That is the crate's four targets and nothing fails. What I did not do is break
arrangeto watch a specific test fail, so this is an execution check and not a mutation one -xmem.rsgains 23 lines and the suite is green either way.What I could not test: what the page's slice being forgotten does to a title's memory, which needs the game. The unit tests are what I ran.
AI-assisted: yes - DeepSeek v4.1 (flash).
Written with an AI assistant.
RUN - VERIFY-2836-RTX4060 - by MoonEyes (another person than the author) on head
3b5e702f8, with #2836, #2835, #2695, #2696, #2689, #2699 and #2705 merged together intomain9372a4d4f(clean).main9372a4d4fand thenmain+ the seven, one run each, same save: 0 device lost, 0 panics, 0 exceptions in both, about 490 s in the world each, alive at the time limit. Frame rate median 17.8 with the seven and 15.0 onmain, not a comparison: other work ran on the PC during themainrun.main9372a4d4f+ the seven (Windows): leonida-hle 243, leonida-gpu 602, leonida-formats 47, leonida 47, leonida-shader 403 of 405: twosource_hash_testsfailed on a stale build script of mine (a target folder shared with an older branch) and pass after a rebuild of it (3 of 3).Limits: one card, one run per arm, two arms only, the seven together. Values only, no game data.
AI-assisted (Claude Code).
Merging. Head
3b5e702f8merges cleanly withmainad7c62edband does not force a rebase of #2566. CI green on this head and on main. In-game run on the RTX 4060 posted above (this head, with the six others, about 490 s in the world, 0 device lost, pictures compared with main). Tests on main + the seven: leonida-hle, leonida-gpu, leonida-formats, leonida, leonida-shader, 0 failed. Verified on it by fiestorra (Windows) and KelboLive (mutation). Merged by MoonEyes.AI-assisted (Claude Code).