watch: clear BESIDE/opened on remap/free and fix parallel test flakes (#321) #347
No reviewers
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX!347
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-347"
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?
@ending3729 on GitHub · 2026-11-26 18:04 UTC · original
ending3729:fix/watch-beside-and-test-isolation→main· +289 −19 · 3 files · 4 commits · openFixes #321 (complements #277; leaves
watch.rs:3628untouched for #241 andviews_are_made_beside_the_heap_and_copied_inuntouched for #298).Root causes & changes
BESIDEandg.openedacross remap/unmap/free (crates/victory-gpu/src/watch.rs):title_memory_changed(called bytitle_memory_remappedandtitle_memory_unmapping) clearsPUBLISHED/BESIDEbits andg.openedentries in the affected block range.title_memory_freedincludesg.aliased,BESIDE, andg.openedin both itsnotedcheck and cleanup path (for both boundedlen != 0andlen == 0allocation_endpaths), and runsopen(&g, at, end * BLOCK)before clearingBESIDE/g.openedso still-mapped aliased views (VirtualFreefailing on a view) still invalidate their sibling views viag.aliased(caught bySr-0w/Victory-Native#162in-game cutscene testing).watch::tests::remapping_and_unmapping_clear_beside_and_opened_stateandwatch::tests::freeing_memory_clears_beside_opened_and_aliased_state(including sibling-view invalidation ontitle_memory_freed, a 30 s retry budget, andBeside::Fullhandling onPUTmodulo-8192 collisions).look_at_holes(crates/victory-gpu/src/watch.rs):look_at_holesre-checksg.held.contains(block) && uncommitted_end(block) <= blockafter re-acquiringguards(), preventing a concurrent remap+unmap cycle from dropping a freshly registered placeholder hole fromg.heldand clearing itsPUBLISHEDbit.watch::tests(crates/victory-gpu/src/watch.rs):forget_test_range(waiting ontitle_memory_remapping()so any in-flightRemappingdrops and clearsg.changingbefore guarding fresh OS allocations) intwo_views,a_refresh_leaves_open_what_the_kernel_is_writing,kernel_reads_into_guarded_blocks_after_opening(also closing the section handle),placeholder,writes_in_partly_committed_view_blocks_are_reported,a_range_that_begins_in_an_unmapped_block_is_guarded, andunmapped_blocks_are_reported_once_until_mapped.drop_viewsto calltitle_memory_section_gone(section)insidetitle_memory_remapping()beforeCloseHandle(section)so a recycled handle in a parallel test cannot be unregistered underneath it.Dropguard ina_block_just_written_reststo always restoreREST_IN_TEST.watch.rs,host.rs):watch::lock_standing_asking()acrosshost::refresh_tests::submission,host::refresh_tests::unchanged_ranges_are_known,watch::tests::the_rest_of_the_one_asking_has_a_number_of_its_own, andwatch::port7_tests::no_write_is_lost_with_port_7so concurrent tests do not clobberJOURNAL.ahead.descriptor::host::tests::views_off_their_elements_get_a_copy_of_their_bytes(crates/victory-gpu/src/descriptor/host.rs):startpast pages where(start + 8) % gridis a multiple of the 456-byte structured stride (456 = 8 * 57), which otherwise legitimately matched the 4 MiB loose window (4194304) instead of an exact copy (2048) when raw twins are enabled.Verification (Windows 11, RX 6600 XT RDNA 2, latest commit
14cdb13)freeing_memory_clears_beside_opened_and_aliased_statefailed before thetitle_memory_freedordering fix (and both originalwatch::testsfailed before3407f67).cargo test -p victory-gpu --lib --locked -- --skip views_are_made_beside_the_heap_and_copied_in: 20/20 consecutive parallel runs passed (382 passed, 0 failed per run; prior commit3345a6dalso passed 100/100).cargo test -p victory-gpu --lib --features diagnostics --locked -- --test-threads=1 --skip views_are_made_beside_the_heap_and_copied_in: passed (434 passed, 0 failed).cargo test -p xtask --locked: passed (9 passed, 0 failed).cargo clippy -p victory-gpu --all-targets --locked --no-deps -- -D warnings(default &--all-features): 0 warnings/errors on touched code; only pre-existing upstreamwatch.rs:3628(#241).@kilolimaVIreported 100/100 clean parallel runs on14cdb13(Radeon 780M / Ryzen 7 8845HS,#321), and@akimfominreported 100/100 clean parallelwatch::testsruns (3,100/3,100) on3345a6d.AI-assisted: yes
@felicerosella on GitHub · 2026-11-26 18:25 UTC · original
NVIDIA results for this PR:
cargo test -p victory-gpu --lib, parallel, RTX 4070 SUPER, Ryzen 7 7800X3D, Windows 11 26200, onmain2de9980.watch::tests::freeing_memory_clears_beside_opened_and_aliased_state, in run 47. In 25 more suite runs it didn't fail again, so that's 1 in 75. Alone it passed 200/200. I didn't catch the panic message. One candidate: its 5 s budget forput_besidereturningCannot. Other tests hold mapping changes in the parallel suite, so #315 and #328 use 30 s.main15/20, and #328 + #342 + #277 together 49/50 (numbers in #321).This PR covers both #328 (
BESIDEon remap/unmap/free) and #342 (one lock for the tests that play the submission, the same four tests). If the maintainer prefers this one, I'm happy to close #328 and #342 in its favour. #342's description has the bisection behind the submission part (refreshed_ranges_hold_title_memorymadeno_write_is_lost_with_port_7fail 20/20), in case it helps review.AI-assisted: yes (Claude Code)
@ending3729 on GitHub · 2026-11-26 18:52 UTC · original
Thanks for the RTX 4070 SUPER runs and for pointing to
#342's bisection!Pushing a follow-up commit (
8a86a45) to tighten up the new tests and address that 1-in-75 race:drop_views:drop_viewswas closing the section handle (CloseHandle) before callingtitle_memory_section_gone(section), and the two new tests inherited that order. Callingtitle_memory_section_gone(section)insidetitle_memory_remapping()beforeCloseHandleavoids having a recycled handle unregistered underneath a parallel test.g.changingis still populated:forget_test_rangenow takestitle_memory_remapping()before clearing a freshly mapped range, waiting for any in-flightRemappingwhoseUnmapViewOfFilejust freed that address to drop and clearg.changingbeforeguard()runs (which also caught a parallel flake ina_write_opens_the_view_it_goes_throughduring stress runs).put_besideretries & smaller diff: Bumped theBeside::Cannotwait to 30 s with diagnostics, retry onBeside::Fullin case of aPUTmodulo-8192 collision with a parallel test, and extracted small helpers to trim the test diff down.Re-verified locally with 20/20 clean parallel
victory-gpu --libruns (skipping only the pre-existing RDNA 2views_are_made_beside_the_heap_and_copied_infailure), plus--features diagnosticsandxtask.@akimfomin on GitHub · 2026-11-26 23:30 UTC · original
The current
3345a6de23af37c3c83dbbac074f450ade7eeb27passed 100 fresh Windows processes running the 31watch::testsin parallel, 3,100 test results with zero failures. I builtcargo test --locked -p victory-gpu --lib --no-runwith Rust 1.100.0 and ran the resulting binary withwatch::tests:: --quietonce per process. This independently checks the follow-up after the8a86a45and3345a6drace fixes. Exact head.One next check is the full GPU lib suite under the same default test parallelism, since the subset cannot cover interference from other modules. No game input was used. PortBridge · AI-assisted test report.
@UwUCammie on GitHub · 2026-11-27 11:50 UTC · original
I tested the four commits on the current Wine launcher branch. Both focused Windows MSVC tests passed under Wine 11.22, including the remap/unmap cleanup and sibling-view invalidation on free. I opened the Wine port with the original commits and credit intact. Wine follow-up
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.