Tests: release placed descriptor heaps before reusing their memory #2260
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2262"
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?
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T09:17:32Z.
Fixes #2252.
The placed-heap test overwrote its first COM handle and then dropped the backing memory. Its still-registered heap could intercept writes when another fixture allocated descriptors at that address. That left the new heap's host descriptors uninitialized. Release both fixture heaps before returning and check that a descriptor write at a reused address reaches the new heap.
940d32f, the new address-reuse assertion fails because the new heap receives no descriptor write. It passes with the release calls.Please preserve the Git author if reapplying this change. If its code or test is folded into another commit, please add:
Co-authored-by: andrewpozdnakov7-jpg [email protected]
AI-assisted. Synthetic tests only.
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T09:23:30Z.
Review: APPROVED
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):cargo test -p victory-gpu --lib descriptor::tests::— 5 passed, 0 failedcargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean fix releasing placed descriptor heaps before reusing their backing memory in tests. Looks good.
AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T09:35:34Z.
Review: COMMENTED
Tests: release placed descriptor heaps before reusing their addresses; Windows-only reuse check added. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Test-only fix for cross-test heap-address aliasing.
Imported from Marvisak/VIctory. Originally posted by eazyves on 2026-11-25T10:42:42Z.
On an RX 9070 XT (RDNA4), hardware adapter:
main940d32ffails in 10 of 250 runs, this PR (d183e7c, same base) in 0 of 250.Each run is the built
victory-gpulib test binary, default threads, default features, one process after another.mainbindless::tests::heap_views_are_current(0 instead of 1064)bindless::tests::heap_views_follow_writes_through_another_mapping(0 instead of 1064)draw::tests::root_views_reach_their_copy_and_read_zeros_past_it(draw.rs:2024, all zeros instead of 20480..)shadow::tests::marked_pages_go_back_by_the_bytes_the_gpu_changed(shadow.rs:1136, 0 instead of 170)An earlier 80 runs of
mainhad 5 such failures: 2heap_views_follow_..., 2root_views_reach_..., and 1descriptor::host::tests::dynamic_slots_are_held_until_released.So the two
bindlesstests are the ones I can tie to this fix. The other three are rarer: 0 in 250 fits this fix covering them, but it is too few to say so, and I have not traced them.Setup: RX 9070 XT, driver 32.0.32029.2010, Ryzen 7 5800X3D, Windows 11 26200, Rust 1.98.1. The tests ran from a service session (session 0). No game data. AI-assisted (Claude Code); run on my machine.
Imported from Marvisak/VIctory. Originally posted by eazyves on 2026-11-25T12:17:11Z.
Follow-up with more runs, same two builds and machine as above: this PR now has 0 failures in 1,000 runs (250 + 750).
The second series on
mainwas cut off before its end, so I only know it had at most 750 runs. In it:main(≤ 750 runs)heap_views_are_currentheap_views_follow_writes_through_another_mappingroot_views_reach_their_copy_and_read_zeros_past_itdynamic_slots_are_held_until_releasedframe::tests::waits_end_on_ticks_and_count_framesThat changes one thing I wrote:
root_views_reach_...now has 10 failures onmain(2 + 2 + 6, in at most 1,080 runs) against 0 in 1,000 here, so this fix most likely covers it too. I have not traced why. The last two are too rare to say, andmarked_pages_go_back_...did not fail again.Correction: other builds ran on the machine during part of the second
mainseries, so its conditions differed from this PR's series. The first 250 against 250 is the cleaner comparison (10 against 0).AI-assisted (Claude Code); run on my machine. No game data.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T12:45:18Z.
Automated triage for the maintainers.
Merge candidate (test fix). The placed-heap test in
crates/victory-gpu/src/descriptor.rsleft its placed descriptor heaps registered after it finished. Another test whose heap later reused that address could then have its descriptor writes routed to the stale registration. The PR releases both heaps. On Windows it also checks that a heap created again at the same address receives a descriptor write (pending == [0]).The evidence is strong. On an RX 9070 XT,
mainshowed intermittent failures in severalbindless/drawtests (about 1 in 50 runs), and this PR showed none in 1,000 runs. CIcheckpasses, and the branch merges cleanly. This likely explains the flakybindless::testsfailure reported as #2252.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by fyernald on 2026-11-25T16:28:25Z.
Review: APPROVED
The cause checks out in the code on current
main(67e8ae1).create_heapregisters every shader-visible heap inSHADER_HEAPS, and onlyHeap::droptakes the entry out.placed_heaps_start_at_the_title_memorynever released its placed heap, and itsVecwas freed at the end of the test. That left a live registration over freed memory, which a later heap at the same address loses its writes to.Merged onto
67e8ae1(no conflicts): the test passes, including the new reuse check. The fullvictory-gpulib binary was run 50 times in parallel (Windows 10 19045, RTX 3080) with nobindless::tests::heap_views_*failure. To be fair to the numbers: I couldn't reproduce that flake on plainmainon this machine either (0 in 300+ runs). So my support here rests on the deterministic reuse check and the code, not on a before/after rate.