GPU tests: a freed test pool keeps its addresses, and mark tests hold off submissions #3085
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3085
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3085"
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?
@0xkn0wh3r3 on GitHub · 2026-11-26 07:02 UTC · original
0xkn0wh3r3:tests/parallel-races→main· +25 −3 · 3 files · 2 commits · openRun in parallel (the default
cargo test), victory-gpu's shadow and watch tests fail now and then, and each passes when run alone. There are two causes, and both are fixed in the tests only.1. A freed test pool's addresses were handed out again while a tracker still guarded them.
watch::protectcounts a page that is already in the guard set as guarded, and skipsVirtualProtectfor it. A test can leave a tracker of its pool behind (a host copy or a texture's staging that something global still holds) and then free the pool. I instrumentedwatch::tests::free, and in every run some tests freed memory that was still inGUARDS:host::batch::a_copy_is_refreshed_once_per_submission_by_the_pages_writtenhost::withholding::only_programs_using_title_memory_are_withheldtexture::tests::a_texture_viewed_from_a_later_level_is_staged_from_it_onlyIf another test's
VirtualAlloclands on those addresses, its pages count as guarded already. Its writes then never fault, so nothing is seen as changed or saved. This produced the failures inwatch::tests::armed_ranges_keep_their_pages_bytes_from_before_the_first_write,unmapped_pages_are_taken_apartand the partial-refresh tests.watch::tests::freenow decommits the pool and keeps its addresses reserved, so no later allocation lands there, whichever test leaked the tracker.2. A submission of a test running alongside took the marks a mark test had just set.
shadow::copy_back_markstakes every mark in the bitmaps, andHost::executecalls it. The fix addshost::tests::no_submissions(), which holds the submission lock while it is alive, as the read-mark tests inhost.rsalready do. These tests now hold it:marked_pages_go_back_by_the_bytes_the_gpu_changedmarks_of_shaders_using_title_memory_are_held_backpartial_refresh_under_marked_range_updates_saved_bytesNone of them submits work itself.
Measured. 20 runs of
cargo test -p victory-gpu --libon Windows with an NVIDIA GPU.Two tests fail on main in every run, with or without this change:
memory::tests::lists_share_a_table_and_copies_keep_their_viewsanddescriptor::host::tests::dynamic_slots_are_held_until_released. They are not related to this change.@Dukestar69 on GitHub · 2026-11-26 07:07 UTC · original · approved these changes
Tested locally merged onto
origin/main(63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090):cargo test -p victory-gpu watch::tests -- --test-threads=1: 15 passed, 0 failed.cargo test -p victory-gpu shadow::tests -- --test-threads=1: 9 passed, 0 failed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@oni-swr on GitHub · 2026-11-26 07:38 UTC · original
Independent WARP-only verification of this PR at
b57d5a0cc544c4dc5bb4764bded9f8eb1b271eb8(claim: #1633). Existing tests only, no source edits, no PR. AI use: Claude Code (Claude Sonnet 5.5), coordinated by Codex (gpt-6.2-sol).Result. I did not reproduce the shadow/watch/mark flake on the parent under WARP, so these runs neither confirm nor refute the PR's fix. The PR head had no failures in 180 runs.
Compared
63bcca43c6a00a758510398fa43096ce7e4f7df0(the PR's base)46b8c8163580e6717c80cd0938811e16b716e7a0(the head's immediate parent, the first PR commit)b57d5a0cc544c4dc5bb4764bded9f8eb1b271eb8Environment
d3d10warp.dll10.0.26100.9818.VICTORY_D3D12_WARP=1,VICTORY_DXIL= Windows SDK 10.0.26100.0x64\dxil.dll(1.8.2502.11).D:\victory-3085-warp-target, with-j 4on every cargo command. D: stayed above 188 GB free.Adapter check
VICTORY_D3D12_WARPonly takes effect in a--features diagnosticsbuild (host.rs:cfg!(feature = "diagnostics") && switch::on(...)). A default-feature build ignores it and would use the physical GPU. All repeated runs therefore use--features diagnosticsbuilds only.d3d10warp.dll,Microsoft.Internal.WarpPal.dll,d3d12.dll,D3D12Core.dll,dxilconv.dll, and no vendor driver module.amdxc64.dllandamdihk64.dllloaded instead.host::tests::warp_adapter_accepts_only_softwareprintedEnumWarpAdapter: vendor=0x1414, flags=0x2(Microsoft, software).Commands
Runs were interleaved across the three builds. The test executables were run directly, not through
cargo test.Counts (failed runs / runs)
--test-threads=32Failures
descriptor::host::tests::views_bound_while_another_slot_gets_its_texture_do_not_wait(descriptor/host.rs:2011, "both made"). It is in a file this PR does not touch.shadow::,watch::or mark test failed in any run on any commit.memory::tests::lists_share_a_table_and_copies_keep_their_viewsanddescriptor::host::tests::dynamic_slots_are_held_until_released, passed in all 540 runs here.Limitations
victory-gpu --libwas run. No other crates, no game, no dumps.@Marvisak on GitHub · 2026-11-26 08:21 UTC · original
Automated triage for the maintainers.
Merge candidate. This changes tests only.
watch::tests::freenow usesMEM_DECOMMIT(size 0 at the allocation base decommits the whole region) instead ofMEM_RELEASE. The address range stays reserved, so a later test's pool cannot land on pages that a leaked tracker still keeps inGUARDS. The newhost::tests::no_submissions()holdsHost::submitted, the same lock the existing read-mark tests inhost.rshold. The three shadow mark/refresh tests now take it. I checked that their bodies (register,find->shared_buffer,copy_back_marks) never submit, so they cannot deadlock. Their lock order (submitted, then buffers) is the same asHost::execute's. One cost: test address space is no longer returned, which is fine at these pool sizes.CI: passing (check).
Generated by Claude Code
@fuzeofficlal on GitHub · 2026-11-26 08:40 UTC · original · approved these changes
Clean, test-only fix for both parallel test races:
#[cfg(test)](host.rs,shadow.rs,watch.rs), with no production code impact.watch::tests::freecall sites: every caller passes a base allocation fromwatch::tests::pool, soVirtualFree(p, 0, MEM_DECOMMIT)safely decommits the whole region while keeping its virtual address range reserved so leakedGUARDSentries from other tests cannot poison subsequent pools.shadow::testsholdinghost::tests::no_submissions(): none of them submit command lists or re-enterhost.submitted, matching the existing pattern inhost::tests.Verified locally on Windows 11 with default parallel test execution (no
--test-threads=1):cargo test -p victory-gpu --lib -- watch:: shadow::— 10/10 parallel runs passed (25/25 each)--features diagnostics,VICTORY_D3D12_WARP=1):watch:: shadow::— 5/5 parallel runs passed (25/25 each)cargo clippy -p victory-gpu --all-targets -- -D warnings(default and--all-features): cleancargo xtask policy: 191 files okLGTM.
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.