Tests: release placed descriptor heaps before reusing their memory #2262

Manually merged
github merged 1 commit from gh-pr/2262/head into gh-pr/2262/base 2026-11-26 05:00:15 +00:00
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 09:17 UTC · original
andrewpozdnakov7-jpg:fix/2252-test-descriptor-heap-lifetime → main · +18 −11 · 1 files · 1 commits · merged 2026-11-25 21:56 UTC

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.

  • On main 940d32f, the new address-reuse assertion fails because the new heap receives no descriptor write. It passes with the release calls.
  • An observation-only build of main reproduced the reported 0 instead of 1064 in 3 of 63 parallel victory-gpu runs on WARP. In all three, the heap tracked zero viewed buffer ranges even though both title-side view records were present.
  • With the fix, the full victory-gpu suite passed on WARP with 146 passed and 2 ignored. Both bindless tests and the full suite then passed in all 85 additional parallel runs (16 test threads). Clippy with default and diagnostics features and the staged policy check passed.

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.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 09:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/2262) `andrewpozdnakov7-jpg:fix/2252-test-descriptor-heap-lifetime` → `main` · +18 −11 · 1 files · 1 commits · merged 2026-11-25 21:56 UTC 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. - On main 940d32f, the new address-reuse assertion fails because the new heap receives no descriptor write. It passes with the release calls. - An observation-only build of main reproduced the reported 0 instead of 1064 in 3 of 63 parallel victory-gpu runs on WARP. In all three, the heap tracked zero viewed buffer ranges even though both title-side view records were present. - With the fix, the full victory-gpu suite passed on WARP with 146 passed and 2 ignored. Both bindless tests and the full suite then passed in all 85 additional parallel runs (16 test threads). Clippy with default and diagnostics features and the staged policy check passed. 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:00:13 +00:00
github manually merged commit d183e7c9b9 into gh-pr/2262/base 2026-11-26 05:00:15 +00:00
Author
Owner

@⁠eazyves on GitHub · 2026-11-25 10:42 UTC · original

On an RX 9070 XT (RDNA4), hardware adapter: main 940d32f fails in 10 of 250 runs, this PR (d183e7c, same base) in 0 of 250.

Each run is the built victory-gpu lib test binary, default threads, default features, one process after another.

failing test main this PR
bindless::tests::heap_views_are_current (0 instead of 1064) 4 0
bindless::tests::heap_views_follow_writes_through_another_mapping (0 instead of 1064) 3 0
draw::tests::root_views_reach_their_copy_and_read_zeros_past_it (draw.rs:2024, all zeros instead of 20480..) 2 0
shadow::tests::marked_pages_go_back_by_the_bytes_the_gpu_changed (shadow.rs:1136, 0 instead of 170) 1 0

An earlier 80 runs of main had 5 such failures: 2 heap_views_follow_..., 2 root_views_reach_..., and 1 descriptor::host::tests::dynamic_slots_are_held_until_released.

So the two bindless tests 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.

**@⁠eazyves** on GitHub · 2026-11-25 10:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/2262#issuecomment-7160069886) **On an RX 9070 XT (RDNA4), hardware adapter: `main` 940d32f fails in 10 of 250 runs, this PR (d183e7c, same base) in 0 of 250.** Each run is the built `victory-gpu` lib test binary, default threads, default features, one process after another. | failing test | `main` | this PR | |---|---|---| | `bindless::tests::heap_views_are_current` (0 instead of 1064) | 4 | 0 | | `bindless::tests::heap_views_follow_writes_through_another_mapping` (0 instead of 1064) | 3 | 0 | | `draw::tests::root_views_reach_their_copy_and_read_zeros_past_it` (draw.rs:2024, all zeros instead of 20480..) | 2 | 0 | | `shadow::tests::marked_pages_go_back_by_the_bytes_the_gpu_changed` (shadow.rs:1136, 0 instead of 170) | 1 | 0 | An earlier 80 runs of `main` had 5 such failures: 2 `heap_views_follow_...`, 2 `root_views_reach_...`, and 1 `descriptor::host::tests::dynamic_slots_are_held_until_released`. So the two `bindless` tests 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.
Author
Owner

@⁠eazyves on GitHub · 2026-11-25 12:17 UTC · original · edited 2026-11-25 13:03 UTC

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 main was cut off before its end, so I only know it had at most 750 runs. In it:

failing test failures on main (≤ 750 runs) this PR (750 runs)
heap_views_are_current 7 0
heap_views_follow_writes_through_another_mapping 6 0
root_views_reach_their_copy_and_read_zeros_past_it 6 0
dynamic_slots_are_held_until_released 1 0
frame::tests::waits_end_on_ticks_and_count_frames 1 0

That changes one thing I wrote: root_views_reach_... now has 10 failures on main (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, and marked_pages_go_back_... did not fail again.

Correction: other builds ran on the machine during part of the second main series, 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.

**@⁠eazyves** on GitHub · 2026-11-25 12:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/2262#issuecomment-7162168901) · edited 2026-11-25 13:03 UTC 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 `main` was cut off before its end, so I only know it had at most 750 runs. In it: | failing test | failures on `main` (≤ 750 runs) | this PR (750 runs) | |---|---|---| | `heap_views_are_current` | 7 | 0 | | `heap_views_follow_writes_through_another_mapping` | 6 | 0 | | `root_views_reach_their_copy_and_read_zeros_past_it` | 6 | 0 | | `dynamic_slots_are_held_until_released` | 1 | 0 | | `frame::tests::waits_end_on_ticks_and_count_frames` | 1 | 0 | That changes one thing I wrote: `root_views_reach_...` now has 10 failures on `main` (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, and `marked_pages_go_back_...` did not fail again. **Correction:** other builds ran on the machine during part of the second `main` series, 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.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 12:45 UTC · original

Automated triage for the maintainers.

Merge candidate (test fix). The placed-heap test in crates/victory-gpu/src/descriptor.rs left 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, main showed intermittent failures in several bindless/draw tests (about 1 in 50 runs), and this PR showed none in 1,000 runs. CI check passes, and the branch merges cleanly. This likely explains the flaky bindless::tests failure reported as #2252.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 12:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/2262#issuecomment-7162809147) <!-- victory-triage v1 head=d183e7c9b920f45c06f4c5bed4c24298463f7f12 verdict=merge-candidate at=2026-11-25T12:47:00Z --> Automated triage for the maintainers. **Merge candidate (test fix).** The placed-heap test in `crates/victory-gpu/src/descriptor.rs` left 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, `main` showed intermittent failures in several `bindless`/`draw` tests (about 1 in 50 runs), and this PR showed none in 1,000 runs. CI `check` passes, and the branch merges cleanly. This likely explains the flaky `bindless::tests` failure reported as #2252. --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2262
No description provided.