Fix physical page mapping and GPU test assumptions #153
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!153
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-153"
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?
@ceracty on GitHub · 2026-11-25 17:31 UTC · original
ceracty:fix/physical-page-mapping-tests→main· +23 −21 · 3 files · 1 commits · openWhy
The whole-reservation mapping shortcut was also applied to small reservations. This broke partial unmaps and could merge placeholders that the title had split explicitly. Zero-length alias requests could also fail when the destination was inside a whole-mapped reservation.
Changes
Cellfor memory that the command-list synchronization test updates through a raw pointer.Validation
On Windows, all 102 active
victory-hletests and all 111 activevictory-gputests passed. This includes the five previously failing physical memory tests.The full workspace suite still reports 23 shader test failures on the test machine and one repository policy failure because
lower.rsexceeds the file-size limit. In-game performance on Radeon was not measured.@KernelSmoker on GitHub · 2026-11-25 17:46 UTC · original
Tested PR head
0f373acon Bazzite Linux 45 using GE-Proton 10-34 / Wine 10.0 and vkd3d-proton 3.0.0, on an NVIDIA GeForce RTX 3090 (host driver 620.73.04).The targeted test
descriptor::host::tests::dynamic_slots_are_held_until_releasedpassed under Proton (1 passed, 0 failed). The D3D12 host reported the 1,000,000-slot heap cap, and the test now correctly uses the actual heap count as the first dynamic slot. This is a Windows test binary under Proton, not a native Windows result.@adrianmjim on GitHub · 2026-11-25 18:57 UTC · original
Tested head
0f373acon an RX 7900 XT (Windows 11 build 26300, Rust 1.98.1), with separate target dirs. I did not run the game.cargo test -p victory-hle --lib:000ffdd): 97 passed, 5 failed (the five xmem tests from #8).--test-threads=1. There were also no failures in 40 more parallel runs ofxmemand 40 of the whole crate.In
victory-gpulib, run serially, the only failure is the known #102 watch flake.Compared with the other open fixes for these failures (#14, #16, #93, #99, and #154, which carries #93):
a_large_run_of_pages_is_shown_whole(65 pages)a_small_run_into_a_reservation_shown_whole_is_mapped(70 then 10 of 80 pages)Both pass with
--test-threads=1. In parallel runs the first one sometimes fails, for the shared-state reason #93 serialises them. Adding tests like these would keep the path covered.shadow.rs: a mapped view is used in place only from 16 MiB (end - start < 16 << 20returnsNone). With 4 MiB, reservations between 4 and 16 MiB are coalesced into one view that the GPU side never uses in place.n == 0early return inXMemMapPhysicalPagesdoes not change behaviour. On main,n == 0already returnsaddress, becauseunmapreturns at once for length 0 and the mapping loop does nothing.dynamic_slots_are_held_until_released: KernelSmoker's Proton run shows the test passing with a 1,000,000-slot cap. On a capped host, though, main gives the small 4-slot heap 933,440 title slots (see my comment on #52). This change makes the test accept that count. #52 instead makesHostHeap::newgive at most the requested slots, so the original assertion holds again. If #52 is merged, this part is not needed. If this part is merged without #52, the test no longer detects that heap being enlarged on capped hosts. This card is not capped, so here the test passes either way.Not tested: NVIDIA, Proton, the game.
@qtLkz on GitHub · 2026-11-25 22:09 UTC · original
Tested on NVIDIA: RTX 4070 Ti, driver 621.01, Windows 11 Pro 26300, Rust 1.98.1, this PR on main
4f62c2a.cargo test -p victory-hle --lib --locked: 102 passed, 0 failed. The 5 xmem failures on main (a_run_keeps_the_placeholders_it_spans,a_run_maps_across_two_placeholders,a_run_maps_again_after_a_partial_unmap,mapping_no_pages_changes_nothing,physical_pages_map_alias_and_unmap) are gone.dynamic_slots_are_held_until_releasednow passes on this capped (1,000,000) heap.watch::tests::written_pages_are_reported_to_every_askerfails (before.is_empty(), watch.rs:1097) in the fullcargo test -p victory-gpu --librun with this PR, with or without--test-threads=1. It passes withwatch::run alone, and in the full run on plain main. It looks like a test-ordering interaction.Details and the combined run with #128 / #201: #74.
AI-assisted (Claude).
@adrianmjim on GitHub · 2026-11-25 22:12 UTC · original
@qtLkz on
watch::tests::written_pages_are_reported_to_every_asker: it also fails on plainmainhere, intermittently, in fullvictory-gpu --libruns. RX 7900 XT, Windows 11 26300, default test threads. On000ffdd, whosewatch.rsis the same as4f62c2a's, it failed in 5 of 100 full runs (same assert,before.is_empty()). In the 140-run comparison on #175 it failed on both trees. So a pass on main in one run does not rule it out there. It looks like an interaction between tests in the same binary rather than something this PR adds, although this PR may make it more likely. A few full runs each way on your card would tell.@qtLkz on GitHub · 2026-11-26 10:59 UTC · original
Follow-up on the one failure left with this PR on NVIDIA,
watch::tests::written_pages_are_reported_to_every_asker: it is not caused by this PR. It is a test-order dependence that is already onmain.RTX 4070 Ti, driver 621.01, Windows 11 Pro 26300, Rust 1.98.1,
main4f62c2aandmain+ this PR.What happens.
watch::JOURNAL.writtenis process-global and keeps page entries after the memory is freed.texture::tests::warp_write_watched_texture_uploads_only_when_writtenallocates one write-watched 64 KiB page, writes it, haswatch::writesrecord it, and frees it. Whenwritten_pages_are_reported_to_every_askerruns next in the same process,VirtualAlloccan hand it a 4-page range that covers the freed page, so its firstwrites()already returns that page andassert!(before.is_empty())fails.A temporary print in both tests (not committed) shows the overlap on every failing run:
Reproduction, just the two tests, single-threaded:
main4f62c2a: watch test fails 3 of 5 runs.main+ this PR: fails 3 of 3. In the full single-threadedvictory-gpurun it fails every time (2 of 2) with this PR, and passes onmain, presumably because the PR changes the address layout so the reuse always lands. The full run in parallel passes.A bisection over all 116 earlier tests (each subset followed by the watch test) points to that texture test alone.
Possible fixes (test-only; for the title, a stale entry only means an extra upload, not a missed one):
before.is_empty()assumption and check only what the test is about: after the write, pagep / PAGE + 1is reported withnow, and a later asker still sees it withnow; orwatch::forget(start, end)called from the texture test beforeVirtualFree), which would also keep the journal from growing in long runs.I can put either one on a branch if that helps.
AI-assisted (Claude).
@adrianmjim on GitHub · 2026-11-26 11:01 UTC · original
Thanks @qtLkz, that explains it. It also fits our RX 7900 XT numbers (5 of 100 full parallel runs on
000ffdd): it only fails when the allocator happens to hand back the freed page. #102 is the open issue for this flake, so the cause and the two-test reproduction would be worth adding there.Of the two fixes I'd lean towards the second, forgetting a range's journal entries when it is freed. The first makes the test pass. The second also keeps a stale entry from ever being reported for new memory at a reused address, and keeps the journal from growing over a long run, as you note.
@qtLkz on GitHub · 2026-11-26 15:43 UTC · original
@adrianmjim Agreed on the second fix. It already exists as #112 (adritoyalser), which forgets the journal entries of fully covered pages in
title_memory_remapped. I shouldn't have offered a new branch without checking. I've added the cause, the two-test reproduction and NVIDIA results to #102. On the RTX 4070 Ti,main+ this PR + #112 gives 114 passed, 0 failed forvictory-gpu --lib --test-threads=1(2 of 2 runs), and the pair reproduction fails 0/10 with #112, against 7/10 with this PR alone.One correction to my comment above: I wrote that the full single-threaded run passes on
main. Rerunning today on the same4f62c2a, the watch test fails there too (2 of 2 full runs, 9 of 10 pair runs). It depends on the addressVirtualAllocreturns and not on this PR, so the conclusion stands, but "passes onmain" did not hold up.AI-assisted (Claude).
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.