gpu: refresh shared upload buffers after draining in-flight work #273

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

@⁠battledogegames-design on GitHub · 2026-11-26 17:54 UTC · original
battledogegames-design:gpu/drain-before-shadow-refresh → main · +8 −31 · 1 files · 1 commits · open

An asynchronous submission can still be reading a Shadow upload buffer when the next submission calls Host::prewarm. A direct refresh can overwrite those bytes. Batching two disjoint requests can also overwrite bytes between them.

Remove the early refresh call, its private helper and its write-only timing counter. Normal deferred preparation refreshes the upload after the existing drain. CPU command-list recording can still overlap GPU execution. Both gated regression tests are in PR #203.

Windows validation

On PR #203 at d2adbc2, each unchanged regression reproduced its assertion failure once. With the equivalent correction applied to that branch, each passed in 20 fresh WARP processes using its original fence checkpoint. Each pair gives the earlier and later GPU reads.

Regression Baseline Corrected
Direct overlap NEW, NEW OLD, NEW (20/20)
Disjoint requests coalesced across the pending read NEW, OLD OLD, OLD (20/20)

OLD was 0x11223344 and NEW was 0xAABBCCDD. On clean main at 4f62c2a and on that revision plus this patch, cargo test --locked -p victory-gpu reported 113 passed, 0 failed and 4 ignored on each. Targeted Clippy completed with matching warnings. The corrected production crate built successfully.

Scope and performance

Removing early refresh gives up overlap between those CPU copies and the preceding GPU submission. In-game frame time, physical-GPU rendering and lighting were unmeasured. The correctness evidence covers the two synthetic WARP paths. This submission is for correctness review. Merge readiness requires maintainer evaluation of the unmeasured in-game tradeoff.

This touches the path in #232, which retains early refresh for a busy predecessor, and the helper extended by #215. Combining these changes would need separate validation.

Thanks to Zetsukae for identifying the overlap in #139 and recommending standalone regression coverage. Nyx identified the coalesced-range case and prepared the production correction.

AI-assisted with Astra 6.2.

**@⁠battledogegames-design** on GitHub · 2026-11-26 17:54 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/273) `battledogegames-design:gpu/drain-before-shadow-refresh` → `main` · +8 −31 · 1 files · 1 commits · open An asynchronous submission can still be reading a Shadow upload buffer when the next submission calls `Host::prewarm`. A direct refresh can overwrite those bytes. Batching two disjoint requests can also overwrite bytes between them. Remove the early refresh call, its private helper and its write-only timing counter. Normal deferred preparation refreshes the upload after the existing drain. CPU command-list recording can still overlap GPU execution. Both gated regression tests are in [PR #203](https://git.gtahub.st/github/Belobug--VIctory-Belobug-AMD/pulls/203). ### Windows validation On PR #203 at `d2adbc2`, each unchanged regression reproduced its assertion failure once. With the equivalent correction applied to that branch, each passed in 20 fresh WARP processes using its original fence checkpoint. Each pair gives the earlier and later GPU reads. | Regression | Baseline | Corrected | | --- | --- | --- | | Direct overlap | NEW, NEW | OLD, NEW (20/20) | | Disjoint requests coalesced across the pending read | NEW, OLD | OLD, OLD (20/20) | OLD was `0x11223344` and NEW was `0xAABBCCDD`. On clean main at `4f62c2a` and on that revision plus this patch, `cargo test --locked -p victory-gpu` reported 113 passed, 0 failed and 4 ignored on each. Targeted Clippy completed with matching warnings. The corrected production crate built successfully. ### Scope and performance Removing early refresh gives up overlap between those CPU copies and the preceding GPU submission. In-game frame time, physical-GPU rendering and lighting were unmeasured. The correctness evidence covers the two synthetic WARP paths. This submission is for correctness review. Merge readiness requires maintainer evaluation of the unmeasured in-game tradeoff. This touches the path in [#232](https://git.gtahub.st/github/Belobug--VIctory-Belobug-AMD/pulls/232), which retains early refresh for a busy predecessor, and the helper extended by [#215](https://git.gtahub.st/github/Belobug--VIctory-Belobug-AMD/pulls/215). Combining these changes would need separate validation. Thanks to Zetsukae for identifying the overlap in #139 and recommending standalone regression coverage. Nyx identified the coalesced-range case and prepared the production correction. AI-assisted with Astra 6.2.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 18:10:13 +00:00
Author
Owner

@⁠battledogegames-design on GitHub · 2026-11-27 00:43 UTC · original

Physical AMD hardware validation of production fix 7ae9c1d5 is complete on a Radeon RX 6800 XT (RDNA 2), using native Windows and AMD driver 32.0.21045.29003.

Both regressions from #203 were executed in 20 fresh processes per implementation:

Regression Baseline With #273
Direct overlap 20/20 failed: [NEW, NEW] 20/20 passed: [OLD, NEW]
Coalesced disjoint refresh 20/20 failed: [NEW, OLD] 20/20 passed: [OLD, OLD]

OLD = 0x11223344, NEW = 0xAABBCCDD.

All 80 hardware runs produced their expected outcomes. No skips, timeouts, or device initialization failures occurred.

Every D3D12 test device matched the selected physical DXGI adapter's LUID, PCI ID 1002:73bf, and software flag 0. The harness modification was limited to explicit adapter selection and the two test device-construction calls. The original synchronization gates, fence checkpoints and readback assertions remained unchanged.

Tested revisions:

  • Baseline: 4f62c2a5e27e7beebf3e8d68f77898e43dc7b77c
  • Regression tests: d2adbc2dc5be507200bf7aaa387f972e0a48be5a
  • Production fix: 7ae9c1d5ff94871c319a8f89ea7a070bd39365c1

These results extend the independent RX 7900 XT reproduction reported in #203 by validating the exact production correction and the coalesced-refresh case on RDNA 2 hardware.

The evidence supports correctness on the tested main implementation. The separate a-publier host implementation, submission overhead and in-game performance remain unmeasured.

Raw logs, adapter checks, harness changes and reproduction commands have been preserved and are available upon request.

AI-assisted development: Nyx (Claude, Anthropic). Native Windows and physical AMD GPU validation: Astra 6.2 (OpenAI).

**@⁠battledogegames-design** on GitHub · 2026-11-27 00:43 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/273#issuecomment-7206696375) Physical AMD hardware validation of production fix `7ae9c1d5` is complete on a Radeon RX 6800 XT (RDNA 2), using native Windows and AMD driver `32.0.21045.29003`. Both regressions from #203 were executed in 20 fresh processes per implementation: | Regression | Baseline | With #273 | |---|---|---| | Direct overlap | 20/20 failed: `[NEW, NEW]` | 20/20 passed: `[OLD, NEW]` | | Coalesced disjoint refresh | 20/20 failed: `[NEW, OLD]` | 20/20 passed: `[OLD, OLD]` | `OLD = 0x11223344`, `NEW = 0xAABBCCDD`. All 80 hardware runs produced their expected outcomes. No skips, timeouts, or device initialization failures occurred. Every D3D12 test device matched the selected physical DXGI adapter's LUID, PCI ID `1002:73bf`, and software flag `0`. The harness modification was limited to explicit adapter selection and the two test device-construction calls. The original synchronization gates, fence checkpoints and readback assertions remained unchanged. Tested revisions: - Baseline: `4f62c2a5e27e7beebf3e8d68f77898e43dc7b77c` - Regression tests: `d2adbc2dc5be507200bf7aaa387f972e0a48be5a` - Production fix: `7ae9c1d5ff94871c319a8f89ea7a070bd39365c1` These results extend the independent RX 7900 XT reproduction reported in #203 by validating the exact production correction and the coalesced-refresh case on RDNA 2 hardware. The evidence supports correctness on the tested `main` implementation. The separate `a-publier` host implementation, submission overhead and in-game performance remain unmeasured. Raw logs, adapter checks, harness changes and reproduction commands have been preserved and are available upon request. **AI-assisted development: Nyx (Claude, Anthropic). Native Windows and physical AMD GPU validation: Astra 6.2 (OpenAI).**
Author
Owner

@⁠hajduzsolt on GitHub · 2026-11-27 09:32 UTC · original · reviewed

crates/victory-gpu/src/host.rs:1264 now drains prior work before preparing the next submission. I checked the red CI run while reviewing that ordering. CI stops in Clippy on existing shader diagnostics, including the hex literal at crates/victory-shader/src/native.rs:389 and the return binding in crates/victory-shader/src/emit/mod.rs:350. Both reproduce on clean main at 4f62c2a, and #3 already covers the shader lint cleanup.

The locked Windows workspace tests on 7ae9c1d and 4f62c2a reported the same set of baseline failures. This check leaves the WARP regressions in #203 and the performance tradeoff for separate validation.

AI assistance: ChatGPT 6.2 Sol Extra High.

**@⁠hajduzsolt** on GitHub · 2026-11-27 09:32 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/273#pullrequestreview-6086081331) · **reviewed** `crates/victory-gpu/src/host.rs:1264` now drains prior work before preparing the next submission. I checked the red CI run while reviewing that ordering. CI stops in Clippy on existing shader diagnostics, including the hex literal at `crates/victory-shader/src/native.rs:389` and the return binding in `crates/victory-shader/src/emit/mod.rs:350`. Both reproduce on clean `main` at `4f62c2a`, and #3 already covers the shader lint cleanup. The locked Windows workspace tests on `7ae9c1d` and `4f62c2a` reported the same set of baseline failures. This check leaves the WARP regressions in #203 and the performance tradeoff for separate validation. AI assistance: ChatGPT 6.2 Sol Extra High.
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/273/head:github-bot/gh-273'
git switch 'github-bot/gh-273'

Merge

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