GPU: preserve newer CPU writes across copied-buffer overlaps #238

Open
github-bot wants to merge 1 commit from github-bot/gh-238 into main AGit
Owner

@⁠loyodea on GitHub · 2026-11-26 08:01 UTC · original
loyodea:victory-card-buffer-copy → main · +67 −53 · 1 files · 1 commits · open

Related to #105. Ordinary copied buffers retain a snapshot to identify bytes written by the GPU. Advance it after copy-back, as the sparse path already does, so overlapping ranges do not misclassify previously mirrored CPU bytes and overwrite a newer write.

Tested

  • Windows 11 build 26300, Radeon RX 9060 XT driver 32.0.32029.2010, WARP, Rust 1.100.0 GNU x64.
  • Two synthetic D3D12 cases failed before the change and passed afterward, including with kernel copying enabled. Each checks real GPU writes in overlapping ranges and a newer CPU write between merges.
  • Serial victory-gpu library suite: 114 passed, one failed, and four ignored. Clean main at 4f62c2a failed the same write-watch assertion. The asset policy reported the existing lower.rs size violation.

The tests select the ordinary copy path directly. Actual VRAM exhaustion, Wine, the RX 7900 XT, and the reported rendering symptom remain unverified. Codex contributed the implementation and verification.

**@⁠loyodea** on GitHub · 2026-11-26 08:01 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/238) `loyodea:victory-card-buffer-copy` → `main` · +67 −53 · 1 files · 1 commits · open Related to #105. Ordinary copied buffers retain a snapshot to identify bytes written by the GPU. Advance it after copy-back, as the sparse path already does, so overlapping ranges do not misclassify previously mirrored CPU bytes and overwrite a newer write. **Tested** - Windows 11 build 26300, Radeon RX 9060 XT driver 32.0.32029.2010, WARP, Rust 1.100.0 GNU x64. - Two synthetic D3D12 cases failed before the change and passed afterward, including with kernel copying enabled. Each checks real GPU writes in overlapping ranges and a newer CPU write between merges. - Serial victory-gpu library suite: 114 passed, one failed, and four ignored. Clean main at 4f62c2a failed the same write-watch assertion. The asset policy reported the existing lower.rs size violation. The tests select the ordinary copy path directly. Actual VRAM exhaustion, Wine, the RX 7900 XT, and the reported rendering symptom remain unverified. Codex contributed the implementation and verification.
Advance the snapshot after each copied-buffer merge, as the sparse path already does. This prevents overlapping ranges from classifying previously mirrored CPU bytes as fresh GPU writes. Original native and WARP regressions demonstrate the failure and fix. Related to #105.

Co-authored-by: Codex <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:18:14 +00:00
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-26 21:43 UTC · original

Tested on an RX 7900 XT (RDNA3, driver 32.0.32029.2010) with Rust 1.98.1. Head b325bad, against main 4f62c2a. This covers the RX 7900 XT that the PR lists as unverified.

  • The two new tests fail on 4f62c2a and pass on b325bad, on hardware and on WARP.
  • I added one more case:
    • The GPU writes bytes inside the overlap of two declared ranges.
    • The first copy-back merges them, then the CPU overwrites them.
    • On 4f62c2a, the second overlapping copy-back puts the merged GPU bytes back over the newer CPU write, on hardware and on WARP.
    • A third range covering both also writes stale bytes back on 4f62c2a.
    • With this PR, all of it passes.
    • The test is on a local branch. I can share it if useful.
  • victory-gpu lib tests, base and PR interleaved, 31 parallel runs each plus 2 serial runs each: no failure specific to the PR. Both sides show the same timing and guard-page flakes (frame waits, watch views, queue waits, depth bounds). The machine was busy with other jobs.
  • One parallel run with the PR code crashed (segfault) without naming a test. The other 61 parallel runs with the PR code did not crash, and neither did any of the 31 base runs. 1 in 62 is too rare to tell apart from base, and I could not tie it to this change.
  • clippy: no new warnings.

Not tested: the game, Wine, real card-buffer exhaustion (#105), write-watched modes, or performance.

**@⁠adrianmjim** on GitHub · 2026-11-26 21:43 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/238#issuecomment-7203992712) Tested on an RX 7900 XT (RDNA3, driver 32.0.32029.2010) with Rust 1.98.1. Head b325bad, against main 4f62c2a. This covers the RX 7900 XT that the PR lists as unverified. - The two new tests fail on 4f62c2a and pass on b325bad, on hardware and on WARP. - I added one more case: - The GPU writes bytes inside the overlap of two declared ranges. - The first copy-back merges them, then the CPU overwrites them. - On 4f62c2a, the second overlapping copy-back puts the merged GPU bytes back over the newer CPU write, on hardware and on WARP. - A third range covering both also writes stale bytes back on 4f62c2a. - With this PR, all of it passes. - The test is on a local branch. I can share it if useful. - victory-gpu lib tests, base and PR interleaved, 31 parallel runs each plus 2 serial runs each: no failure specific to the PR. Both sides show the same timing and guard-page flakes (frame waits, watch views, queue waits, depth bounds). The machine was busy with other jobs. - One parallel run with the PR code crashed (segfault) without naming a test. The other 61 parallel runs with the PR code did not crash, and neither did any of the 31 base runs. 1 in 62 is too rare to tell apart from base, and I could not tie it to this change. - clippy: no new warnings. Not tested: the game, Wine, real card-buffer exhaustion (#105), write-watched modes, or performance.
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/238/head:github-bot/gh-238'
git switch 'github-bot/gh-238'

Merge

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