test: add WARP regression for async prewarm upload-buffer overwrite #203

Open
github-bot wants to merge 2 commits from github-bot/gh-203 into main AGit
Owner

@⁠battledogegames-design on GitHub · 2026-11-25 21:51 UTC · original
battledogegames-design:test/async-prewarm-warp-regression → main · +256 −3 · 3 files · 2 commits · open

Adds an opt-in Windows D3D12 WARP regression for the upload-buffer overlap Zetsukae identified in #139. With async submission enabled, the early prewarm refresh can overwrite shared upload bytes while an earlier GPU submission still needs them. Thanks to Zetsukae for identifying the overlap and recommending a standalone test against main. Original evidence · Zetsukae’s reply

The test uses synthetic words, a queue gate to force the overlap, and a completion fence before readback. It checks synchronous overlap and asynchronous disjoint ranges before asserting that an asynchronous overlapping refresh preserves the first read. The upload-shadow constructor and synchronization checkpoint are test-only. Production keeps its existing async selection and prewarm/drain order.

Original comparison Existing prewarm Early prewarm omitted locally
main 4f62c2a 20/20 overlap failures 20/20 passes
#139 a208d61 20/20 overlap failures 20/20 passes

Fresh validation on main at 4f62c2a. The explicit test reached the overlap assertion. The GPU read [0xAABBCCDD, 0xAABBCCDD]; expected [0x11223344, 0xAABBCCDD]. The default invocation reported one ignored test. Five existing indirect tests passed. Targeted Clippy (lib and tests) and the non-test library build check completed with warnings.

cargo test --locked -p victory-gpu --lib host::prewarm_tests::async_prewarm_preserves_an_in_flight_read -- --exact --ignored --nocapture --test-threads=1

The regression stays ignored while the overwrite is present. A production fix should make the explicit run pass. The drain checkpoint may need revisiting if a fix moves the blocking wait. This evidence covers software WARP. Physical GPU behavior, game lighting, and performance remain unverified.

Coalesced disjoint refreshes

Nyx identified a second way to trigger the same early-prewarm overwrite. Neither four-byte refresh at offsets 0 and 131072 touches the pending GPU read at 66048. Batching both refreshes on the same non-sparse Shadow expands the actual copy to [0, 131076), which includes that read. Checking each requested range separately would miss the overlap.

Windows D3D12 WARP results on 70697c1 with the added test. Each prewarm setting ran in 20 fresh processes. Each process exercised both cases on separate WARP hosts. Both reads should return OLD (0x11223344). NEW is 0xAABBCCDD.

Early prewarm Single refresh Two refreshes
Enabled 20/20 [OLD, OLD] 20/20 [NEW, OLD]
Omitted locally 20/20 [OLD, OLD] 20/20 [OLD, OLD]
cargo test --locked -p victory-gpu --lib host::prewarm_tests::async_prewarm_coalesced_refresh_preserves_an_in_flight_read -- --ignored --exact --nocapture --test-threads=1

Both tests remain ignored by default. On the final test-only commit, each explicit WARP run reproduced its expected readback failure. The locked non-test library check passed with warnings.

AI-assisted with Astra 6.2.

**@⁠battledogegames-design** on GitHub · 2026-11-25 21:51 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/203) `battledogegames-design:test/async-prewarm-warp-regression` → `main` · +256 −3 · 3 files · 2 commits · open Adds an opt-in Windows D3D12 WARP regression for the upload-buffer overlap Zetsukae identified in #139. With async submission enabled, the early prewarm refresh can overwrite shared upload bytes while an earlier GPU submission still needs them. Thanks to Zetsukae for identifying the overlap and recommending a standalone test against main. [Original evidence](https://git.gtahub.st/github/Belobug--VIctory-Belobug-AMD/pulls/139) · [Zetsukae’s reply](https://git.gtahub.st/github/Belobug--VIctory-Belobug-AMD/pulls/139) The test uses synthetic words, a queue gate to force the overlap, and a completion fence before readback. It checks synchronous overlap and asynchronous disjoint ranges before asserting that an asynchronous overlapping refresh preserves the first read. The upload-shadow constructor and synchronization checkpoint are test-only. Production keeps its existing async selection and prewarm/drain order. | Original comparison | Existing prewarm | Early prewarm omitted locally | | --- | --- | --- | | main `4f62c2a` | 20/20 overlap failures | 20/20 passes | | #139 `a208d61` | 20/20 overlap failures | 20/20 passes | **Fresh validation on main at `4f62c2a`.** The explicit test reached the overlap assertion. The GPU read `[0xAABBCCDD, 0xAABBCCDD]`; expected `[0x11223344, 0xAABBCCDD]`. The default invocation reported one ignored test. Five existing indirect tests passed. Targeted Clippy (lib and tests) and the non-test library build check completed with warnings. cargo test --locked -p victory-gpu --lib host::prewarm_tests::async_prewarm_preserves_an_in_flight_read -- --exact --ignored --nocapture --test-threads=1 The regression stays ignored while the overwrite is present. A production fix should make the explicit run pass. The drain checkpoint may need revisiting if a fix moves the blocking wait. This evidence covers software WARP. Physical GPU behavior, game lighting, and performance remain unverified. ### Coalesced disjoint refreshes Nyx identified a second way to trigger the same early-prewarm overwrite. Neither four-byte refresh at offsets 0 and 131072 touches the pending GPU read at 66048. Batching both refreshes on the same non-sparse Shadow expands the actual copy to `[0, 131076)`, which includes that read. Checking each requested range separately would miss the overlap. Windows D3D12 WARP results on `70697c1` with the added test. Each prewarm setting ran in 20 fresh processes. Each process exercised both cases on separate WARP hosts. Both reads should return OLD (`0x11223344`). NEW is `0xAABBCCDD`. | Early prewarm | Single refresh | Two refreshes | | --- | --- | --- | | Enabled | 20/20 `[OLD, OLD]` | 20/20 `[NEW, OLD]` | | Omitted locally | 20/20 `[OLD, OLD]` | 20/20 `[OLD, OLD]` | cargo test --locked -p victory-gpu --lib host::prewarm_tests::async_prewarm_coalesced_refresh_preserves_an_in_flight_read -- --ignored --exact --nocapture --test-threads=1 Both tests remain ignored by default. On the final test-only commit, each explicit WARP run reproduced its expected readback failure. The locked non-test library check passed with warnings. AI-assisted with Astra 6.2.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:37:54 +00:00
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-26 19:48 UTC · original

Tested at 70697c1; the later commit (d2adbc2) doesn't touch the overlapping-refresh test. It only adds the coalesced-refresh test, which I did not run.

Tested on Windows 11 with an RX 7900 XT (driver 32.0.32029.2010), Rust 1.98.1, debug build. PR head 70697c1, base 4f62c2a. Each run used a fresh process and the command from the PR body.

WARP:

  • 20/20 runs fail on "asynchronous overlapping refresh", with the same values as in the PR body ([0xAABBCCDD, 0xAABBCCDD] vs [0x11223344, 0xAABBCCDD]).
  • The synchronous overlap and asynchronous disjoint controls passed in every run.

Hardware GPU: I changed Host::new_warp() locally so it creates the device on fastest_adapter() (the RX 7900 XT) instead of WARP. Nothing else in the test changed.

  • 20/20 runs fail with the same assertion and the same values.
  • So, with the test's queue gate holding the first copy, the overwrite also happens on a physical GPU, not only on WARP.

With the early self.prewarm(runs) call skipped locally:

  • WARP: 20/20 pass.
  • RX 7900 XT: 20/20 pass.

Full victory-gpu lib tests, 7 runs of base and 7 runs of the PR, interleaved:

  • The PR adds one ignored test (4 -> 5 ignored).
  • frame::tests::waits_end_on_ticks_and_count_frames and watch::tests::a_write_through_another_view_is_reported_at_the_guarded_one failed in some runs on both base and PR.
  • pipeline::library::tests::concurrent_atomic_writes_publish_one_complete_file failed once in the PR runs with os error 5 (access denied). The PR does not touch that file, and it did not fail again in 30 runs on its own and 8 more full-suite runs.
  • Other heavy jobs were running on the machine during these runs.

Not tested: a production fix (there is none yet), the performance cost of skipping the early prewarm, release builds, and the game itself.

**@⁠adrianmjim** on GitHub · 2026-11-26 19:48 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/203#issuecomment-7201985091) Tested at 70697c1; the later commit (d2adbc2) doesn't touch the overlapping-refresh test. It only adds the coalesced-refresh test, which I did not run. Tested on Windows 11 with an RX 7900 XT (driver 32.0.32029.2010), Rust 1.98.1, debug build. PR head 70697c1, base 4f62c2a. Each run used a fresh process and the command from the PR body. WARP: - 20/20 runs fail on "asynchronous overlapping refresh", with the same values as in the PR body ([0xAABBCCDD, 0xAABBCCDD] vs [0x11223344, 0xAABBCCDD]). - The synchronous overlap and asynchronous disjoint controls passed in every run. Hardware GPU: I changed `Host::new_warp()` locally so it creates the device on `fastest_adapter()` (the RX 7900 XT) instead of WARP. Nothing else in the test changed. - 20/20 runs fail with the same assertion and the same values. - So, with the test's queue gate holding the first copy, the overwrite also happens on a physical GPU, not only on WARP. With the early `self.prewarm(runs)` call skipped locally: - WARP: 20/20 pass. - RX 7900 XT: 20/20 pass. Full `victory-gpu` lib tests, 7 runs of base and 7 runs of the PR, interleaved: - The PR adds one ignored test (4 -> 5 ignored). - `frame::tests::waits_end_on_ticks_and_count_frames` and `watch::tests::a_write_through_another_view_is_reported_at_the_guarded_one` failed in some runs on both base and PR. - `pipeline::library::tests::concurrent_atomic_writes_publish_one_complete_file` failed once in the PR runs with os error 5 (access denied). The PR does not touch that file, and it did not fail again in 30 runs on its own and 8 more full-suite runs. - Other heavy jobs were running on the machine during these runs. Not tested: a production fix (there is none yet), the performance cost of skipping the early prewarm, release builds, and the game itself.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/203/head:github-bot/gh-203'
git switch 'github-bot/gh-203'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-203'
git switch 'github-bot/gh-203'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-203'
git switch 'github-bot/gh-203'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-203'
git switch 'main'
git merge --squash 'github-bot/gh-203'
git switch 'main'
git merge --ff-only 'github-bot/gh-203'
git switch 'main'
git merge 'github-bot/gh-203'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.