Tests: retry the decommit in the WARP placed-buffer test while the adapter lets go of the pages #80

Open
harrisotiropoulos-jpg wants to merge 1 commit from upstream-pr/80 into main
harrisotiropoulos-jpg commented 2026-11-26 16:24:48 +00:00 (Migrated from github.com)

Imported from DexNom/VIctory. Originally posted by harrisotiropoulos-jpg on 2026-11-26T16:24:48Z.


What

inplace::tests::warp_a_title_buffer_in_place_shows_its_bytes_at_its_offset fails now and then when the whole suite runs. The test drops the placed heap and immediately decommits half of its pages. The software adapter (WARP) releases the opened pages a few milliseconds after the heap's last reference goes away. So under load, VirtualFree(MEM_DECOMMIT) can still find the pages held and fail with ERROR_INVALID_PARAMETER (87), which trips the assert_ne!(..., 0).

The fix retries the decommit every 5 ms, for 2 s at most, before failing with the error code. The assertion that matters, that memory not committed whole is turned down without asking the host, is unchanged.

Evidence

  • A full cargo test --workspace --locked failed only on this test: 682 passed, 1 failed, 12 ignored.
  • The test passes when run alone (8 of 8 runs).
  • The victory-gpu lib tests, 6 processes at a time, 30 runs in all:
    • Before: 1 run failed here, and 4 more needed 2–4 retries (each time error 87, then success).
    • After: 0 of 30 failed.

Test machine (NVIDIA, since the README asks)

GPU NVIDIA GeForce RTX 4080
CPU AMD Ryzen 7 9800X3D
RAM 32 GB
OS Windows 11 Pro, build 26300
Toolchain Rust 1.98.1 (pinned), VS 2022 Build Tools 14.44

On this machine, at 64bd58f:

  • cargo build --locked --release -p victory --features diagnostics --bins builds with no warnings.
  • Both clippy jobs from CI pass.
  • Every GPU test that runs on the hardware adapter passes on the RTX 4080.

No gameplay results yet.

Other things seen under the same 6× parallel stress (not changed here)

  • frame::tests::waits_end_on_ticks_and_count_frames failed in 9–10 of 30 runs, with flip ticks skipped (e.g. [3, 4, 5, 7]). It's a wall-clock test, and the CPU was oversubscribed, so this is probably just the load. It never failed in normal cargo test runs.
  • texture::ahead::tests::first_upload_waits_for_its_copy_fence_and_preserves_texture_bytes failed once in 30 runs, at ahead.rs:682: retire(&copy) returned Some(..) instead of None after the source byte changed. This one may be a real race between the ready upload and retire. I didn't dig into it.

🤖 Generated with Claude Code

<!-- greyfinch-sync:DexNom/VIctory:issue:5513626244 --> Imported from [DexNom/VIctory](https://github.com/DexNom/VIctory/pull/80). Originally posted by [harrisotiropoulos-jpg](https://github.com/harrisotiropoulos-jpg) on 2026-11-26T16:24:48Z. --- ## What `inplace::tests::warp_a_title_buffer_in_place_shows_its_bytes_at_its_offset` fails now and then when the whole suite runs. The test drops the placed heap and immediately decommits half of its pages. The software adapter (WARP) releases the opened pages a few milliseconds *after* the heap's last reference goes away. So under load, `VirtualFree(MEM_DECOMMIT)` can still find the pages held and fail with `ERROR_INVALID_PARAMETER` (87), which trips the `assert_ne!(..., 0)`. The fix retries the decommit every 5 ms, for 2 s at most, before failing with the error code. The assertion that matters, that memory not committed whole is turned down without asking the host, is unchanged. ## Evidence - A full `cargo test --workspace --locked` failed only on this test: 682 passed, 1 failed, 12 ignored. - The test passes when run alone (8 of 8 runs). - The `victory-gpu` lib tests, 6 processes at a time, 30 runs in all: - **Before:** 1 run failed here, and 4 more needed 2–4 retries (each time error 87, then success). - **After:** 0 of 30 failed. ## Test machine (NVIDIA, since the README asks) | | | | --- | --- | | GPU | NVIDIA GeForce RTX 4080 | | CPU | AMD Ryzen 7 9800X3D | | RAM | 32 GB | | OS | Windows 11 Pro, build 26300 | | Toolchain | Rust 1.98.1 (pinned), VS 2022 Build Tools 14.44 | On this machine, at `64bd58f`: - `cargo build --locked --release -p victory --features diagnostics --bins` builds with no warnings. - Both clippy jobs from CI pass. - Every GPU test that runs on the hardware adapter passes on the RTX 4080. No gameplay results yet. ## Other things seen under the same 6× parallel stress (not changed here) - `frame::tests::waits_end_on_ticks_and_count_frames` failed in 9–10 of 30 runs, with flip ticks skipped (e.g. `[3, 4, 5, 7]`). It's a wall-clock test, and the CPU was oversubscribed, so this is probably just the load. It never failed in normal `cargo test` runs. - `texture::ahead::tests::first_upload_waits_for_its_copy_fence_and_preserves_texture_bytes` failed once in 30 runs, at `ahead.rs:682`: `retire(&copy)` returned `Some(..)` instead of `None` after the source byte changed. This one may be a real race between the ready upload and retire. I didn't dig into it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
harrisotiropoulos-jpg commented 2026-11-26 16:48:33 +00:00 (Migrated from github.com)

Imported from DexNom/VIctory. Originally posted by harrisotiropoulos-jpg on 2026-11-26T16:48:33Z.


Card measurements on an RTX 4080 (no game files needed)

I ran the --ignored measurement tests on NVIDIA hardware: cargo test --release --locked -p <crate> --lib <name> -- --ignored --exact --nocapture, at commit 64bd58f. All five pass.

GPU NVIDIA GeForce RTX 4080, 16 GB, driver 621.01
CPU AMD Ryzen 7 9800X3D
OS Windows 11 Pro, build 26300

indirect::bare_cost::bare_command_cost

10,000 one-triangle draws into 2560×1440, three batches each. The numbers are µs per draw on the card.

Case µs/draw Recording
(a) nothing changes 0.01 0.1 ms
(b) another pipeline every draw 0.12 0.6 ms
(c) barrier pair on a second texture 0.74 3.1 ms
(d) depth texture write↔read every draw 0.01 1.5 ms
(e) another pair of descriptor heaps 0.01 0.3 ms
(f) another colour target 0.08 1.1 ms
(g) nothing changes, 100 lists one by one 0.20 (0.20 / 0.23 / 0.78) 2.0 ms
(h) one-group compute pass before every draw 3.69 2.0 ms
(i) same, between two UAV waits 3.71 10.0 ms

The compute pass before a draw, (h) and (i), costs about 3.7 µs per draw on NVIDIA. That's about 300× an unchanged draw, so it's where per-draw overhead goes on this card.

host::tiled_write_probe::reserved_gpu_buffer_write_masks_match_snapshot_compare

  • Setup: a reserved buffer of 32 MiB.
  • 32 of 512 tiles touched: snapshot compare 0.061 ms, write mask 0.006 ms.
  • All 512 tiles touched: snapshot compare 0.061 ms, write mask 0.007 ms.
  • Result: the masks match, and the write mask is about 9–10× faster.

host::batch::texture_checks_per_submission

  • Setup: 12 lists sampling 48 textures of 4 MiB.
  • Result: 576 hashes in 219.3 ms before, 48 hashes in 18.2 ms after, which is 12.1× faster.

watch::tests::measures_mapped_guard_scans

These are medians.

Blocks Alias write µs/check
8 no 0.022
8 yes 4.218
1024 no 0.023
1024 yes 4.914

bcpack::tests::bcpack_throughput (CPU)

Format Throughput ns/block
BC1 110.5 MB/s 72.4
BC4 110.2 MB/s 72.6
BC7 65.0 MB/s 246.2
<!-- greyfinch-sync:DexNom/VIctory:comment:7198122103 --> Imported from [DexNom/VIctory](https://github.com/DexNom/VIctory/pull/80#issuecomment-7198122103). Originally posted by [harrisotiropoulos-jpg](https://github.com/harrisotiropoulos-jpg) on 2026-11-26T16:48:33Z. --- ## Card measurements on an RTX 4080 (no game files needed) I ran the `--ignored` measurement tests on NVIDIA hardware: `cargo test --release --locked -p <crate> --lib <name> -- --ignored --exact --nocapture`, at commit `64bd58f`. All five pass. | | | | --- | --- | | GPU | NVIDIA GeForce RTX 4080, 16 GB, driver 621.01 | | CPU | AMD Ryzen 7 9800X3D | | OS | Windows 11 Pro, build 26300 | ### `indirect::bare_cost::bare_command_cost` 10,000 one-triangle draws into 2560×1440, three batches each. The numbers are µs per draw on the card. | Case | µs/draw | Recording | | --- | --- | --- | | (a) nothing changes | 0.01 | 0.1 ms | | (b) another pipeline every draw | 0.12 | 0.6 ms | | (c) barrier pair on a second texture | 0.74 | 3.1 ms | | (d) depth texture write↔read every draw | 0.01 | 1.5 ms | | (e) another pair of descriptor heaps | 0.01 | 0.3 ms | | (f) another colour target | 0.08 | 1.1 ms | | (g) nothing changes, 100 lists one by one | 0.20 (0.20 / 0.23 / 0.78) | 2.0 ms | | (h) one-group compute pass before every draw | 3.69 | 2.0 ms | | (i) same, between two UAV waits | 3.71 | 10.0 ms | The compute pass before a draw, (h) and (i), costs about 3.7 µs per draw on NVIDIA. That's about 300× an unchanged draw, so it's where per-draw overhead goes on this card. ### `host::tiled_write_probe::reserved_gpu_buffer_write_masks_match_snapshot_compare` - **Setup:** a reserved buffer of 32 MiB. - **32 of 512 tiles touched:** snapshot compare 0.061 ms, write mask 0.006 ms. - **All 512 tiles touched:** snapshot compare 0.061 ms, write mask 0.007 ms. - **Result:** the masks match, and the write mask is about 9–10× faster. ### `host::batch::texture_checks_per_submission` - **Setup:** 12 lists sampling 48 textures of 4 MiB. - **Result:** 576 hashes in 219.3 ms before, 48 hashes in 18.2 ms after, which is 12.1× faster. ### `watch::tests::measures_mapped_guard_scans` These are medians. | Blocks | Alias write | µs/check | | --- | --- | --- | | 8 | no | 0.022 | | 8 | yes | 4.218 | | 1024 | no | 0.023 | | 1024 | yes | 4.914 | ### `bcpack::tests::bcpack_throughput` (CPU) | Format | Throughput | ns/block | | --- | --- | --- | | BC1 | 110.5 MB/s | 72.4 | | BC4 | 110.2 MB/s | 72.6 | | BC7 | 65.0 MB/s | 246.2 |
andrewDoing commented 2026-11-27 00:07:37 +00:00 (Migrated from github.com)

Imported from DexNom/VIctory. Originally posted by andrewDoing on 2026-11-27T00:07:37Z.


I reproduced one way the unrelated ahead.rs:682 failure mentioned in the PR can occur at 7a2e7f6, using the original test's real copy queue/fence/readback on native Windows and no production-logic changes. A second thread held watch::MAPPING only during the test's 100 while_ready checks. Each returned false before validating the changed fingerprint because watch.rs:903 uses try_lock; no stale descriptor was published. After releasing the lock, retire returned Some(3930892424531486835), matching the unexpected result. The same binary passed without the held lock.

Repeated false results therefore do not necessarily mean stale-state cleanup occurred. A bounded wait for transition out of READY, or synchronization on a successful pin, plus an assertion that publish never ran may stabilize the fixture. This demonstrates a test assumption under contention; it does not by itself show wrong texture bytes or a regression introduced by this PR.

Verification was AI-assisted with GPT-6.2 Astra.

<!-- greyfinch-sync:DexNom/VIctory:comment:7206192740 --> Imported from [DexNom/VIctory](https://github.com/DexNom/VIctory/pull/80#issuecomment-7206192740). Originally posted by [andrewDoing](https://github.com/andrewDoing) on 2026-11-27T00:07:37Z. --- I reproduced one way the unrelated `ahead.rs:682` failure mentioned in the PR can occur at `7a2e7f6`, using the original test's real copy queue/fence/readback on native Windows and no production-logic changes. A second thread held `watch::MAPPING` only during the test's 100 `while_ready` checks. Each returned false before validating the changed fingerprint because `watch.rs:903` uses `try_lock`; no stale descriptor was published. After releasing the lock, `retire` returned `Some(3930892424531486835)`, matching the unexpected result. The same binary passed without the held lock. Repeated false results therefore do not necessarily mean stale-state cleanup occurred. A bounded wait for transition out of READY, or synchronization on a successful pin, plus an assertion that publish never ran may stabilize the fixture. This demonstrates a test assumption under contention; it does not by itself show wrong texture bytes or a regression introduced by this PR. Verification was AI-assisted with GPT-6.2 Astra.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/80:upstream-pr/80'
git switch 'upstream-pr/80'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/80'
git switch 'upstream-pr/80'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/80'
git switch 'upstream-pr/80'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/80'
git switch 'main'
git merge --squash 'upstream-pr/80'
git switch 'main'
git merge --ff-only 'upstream-pr/80'
git switch 'main'
git merge 'upstream-pr/80'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
DexNom/VIctory!80
No description provided.