Skip staging for fully GPU-written texture uploads #248

Closed
github-bot wants to merge 1 commit from github-bot/gh-248 into main AGit
Owner

@⁠tommiehansen on GitHub · 2026-12-02 20:55 UTC · original
tommiehansen:perf/skip-staging-for-copied-textures → main · +83 −22 · 2 files · 1 commits · closed without merging

Problem

Submission preparation read, hashed or detiled title texture memory before deciding whether it would upload the staging data. When earlier GPU copies already covered every part, the upload was discarded and that CPU-side work had no consumer. A skipped refresh can avoid a whole texture read, including a VRAM readback when the title pages are on the card.

Change and correctness

Use the existing full-coverage predicate when preparing refreshes. Include the submitted bits and the prefix of copies from strictly earlier lists in this submission. Resolve the mask by host-copy identity. A copy in the current or a later list cannot suppress the prelude. Partial coverage still refreshes as before. The sequential and parallel planners use the same test, and deferred execution checks the actual submitted state again. The existing upload decision and logging still run. Resource references, GPU copies, queue order and fence or barrier behavior are preserved.

This should reduce preparation time and the cost of streaming frames that contain discarded uploads. The frequency and critical-path impact of those uploads remain unmeasured.

Validation

Windows-target cargo check passed with and without diagnostics and with test targets enabled, using a check-only mimalloc override and pure Rust BLAKE3 on macOS. Portable tests compared mask planning with an explicit subresource model over 65,536 randomized write orders and checked current-list exclusions, partial coverage and the 64-part limit. git diff --check passed. Hardware benchmarking was unavailable during initial development.

Please test RX 9060 XT 16 GB at native 1920×1080 and RX 9070 XT at native 2560×1440, with RT enabled and no frame generation. Compare texture-preparation bytes and milliseconds, P99 frame time and image parity in a streaming route with GPU-copied textures. Include texture growth, baked decals and Bink playback to check that genuinely needed refreshes still happen.

Independent hardware testing

Both #248 and #233 were independently adopted by @⁠ultimatebash in PR #267 and are included in commit 9166acc0.

The combined configuration reported the following results on an AMD Radeon RX 6750 XT (12 GB VRAM), comparing the old configuration with the new short release run:

Metric Before After Change
Average FPS 19.3 22.3 +15.5%
1% low FPS 6.0 9.1 +51.7%
P99 frame time 167 ms 110 ms −34.1%
VRAM usage 10.86 GB 8.92 GB −17.9%

These are independently reported results for the combined configuration, including other RAM and VRAM management changes. The runs differ in duration, and the author reports substantial run-to-run variation in separate experiments. They do not establish the individual performance contribution of either PR, but they do provide evidence of successful integration and hardware exercise on AMD. Isolated A/B measurements and RDNA4 validation remain desirable.

**@⁠tommiehansen** on GitHub · 2026-12-02 20:55 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/248) `tommiehansen:perf/skip-staging-for-copied-textures` → `main` · +83 −22 · 2 files · 1 commits · closed without merging ## Problem Submission preparation read, hashed or detiled title texture memory before deciding whether it would upload the staging data. When earlier GPU copies already covered every part, the upload was discarded and that CPU-side work had no consumer. A skipped refresh can avoid a whole texture read, including a VRAM readback when the title pages are on the card. ## Change and correctness Use the existing full-coverage predicate when preparing refreshes. Include the submitted bits and the prefix of copies from strictly earlier lists in this submission. Resolve the mask by host-copy identity. A copy in the current or a later list cannot suppress the prelude. Partial coverage still refreshes as before. The sequential and parallel planners use the same test, and deferred execution checks the actual submitted state again. The existing upload decision and logging still run. Resource references, GPU copies, queue order and fence or barrier behavior are preserved. This should reduce preparation time and the cost of streaming frames that contain discarded uploads. The frequency and critical-path impact of those uploads remain unmeasured. ## Validation Windows-target `cargo check` passed with and without diagnostics and with test targets enabled, using a check-only mimalloc override and pure Rust BLAKE3 on macOS. Portable tests compared mask planning with an explicit subresource model over 65,536 randomized write orders and checked current-list exclusions, partial coverage and the 64-part limit. `git diff --check` passed. Hardware benchmarking was unavailable during initial development. Please test RX 9060 XT 16 GB at native 1920×1080 and RX 9070 XT at native 2560×1440, with RT enabled and no frame generation. Compare texture-preparation bytes and milliseconds, P99 frame time and image parity in a streaming route with GPU-copied textures. Include texture growth, baked decals and Bink playback to check that genuinely needed refreshes still happen. ## Independent hardware testing Both #248 and #233 were independently adopted by @⁠ultimatebash in [PR #267](https://git.gtahub.st/github/lobomfz--VIctory-xmem/pulls/267) and are included in [commit 9166acc0](https://github.com/ultimatebash/VIctory-xmem/commit/9166acc089012482fa06db595b272ceab94aec38). The combined configuration reported the following results on an AMD Radeon RX 6750 XT (12 GB VRAM), comparing the old configuration with the new short release run: | Metric | Before | After | Change | |---|---:|---:|---:| | Average FPS | 19.3 | 22.3 | **+15.5%** | | 1% low FPS | 6.0 | 9.1 | **+51.7%** | | P99 frame time | 167 ms | 110 ms | **−34.1%** | | VRAM usage | 10.86 GB | 8.92 GB | **−17.9%** | These are independently reported results for the combined configuration, including other RAM and VRAM management changes. The runs differ in duration, and the author reports substantial run-to-run variation in separate experiments. They do not establish the individual performance contribution of either PR, but they do provide evidence of successful integration and hardware exercise on AMD. Isolated A/B measurements and RDNA4 validation remain desirable.
Submission preparation refreshed a title texture before discovering that earlier GPU copies already covered every part and the upload would be discarded. Check the existing GPU-written mask while planning refreshes, including copies from strictly earlier lists in the same submission.

Use the same full-coverage predicate at upload time. A partial write, a write in the same or a later list, and a distinct host copy cannot cancel a needed refresh. This avoids reads, hashes and detiling for discarded uploads while preserving the original queue, prelude and fallback ordering.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 20:56:58 +00:00
Author
Owner

@⁠tommiehansen on GitHub · 2026-12-03 11:18 UTC · original

Independent hardware testing update: @⁠ultimatebash integrated this PR together with #233 in #267 (commit 9166acc0).

On an RX 6750 XT (12 GB), the combined configuration reported:

  • Average FPS: 19.3 → 22.3 (+15.5%)
  • 1% low FPS: 6.0 → 9.1 (+51.7%)
  • P99 frame time: 167 → 110 ms (−34.1%)
  • VRAM usage: 10.86 → 8.92 GB (−17.9%)

These results include other memory-management changes and compare runs of different durations, so they cannot be attributed to this PR alone. Nevertheless, they confirm external adoption and hardware exercise. I've updated the PR description with the evidence and its limitations. Isolated A/B testing would help establish the individual impact.

**@⁠tommiehansen** on GitHub · 2026-12-03 11:18 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/248#issuecomment-7376498516) Independent hardware testing update: @⁠ultimatebash integrated this PR together with #233 in #267 ([commit 9166acc0](https://github.com/ultimatebash/VIctory-xmem/commit/9166acc089012482fa06db595b272ceab94aec38)). On an RX 6750 XT (12 GB), the combined configuration reported: - Average FPS: 19.3 → 22.3 (**+15.5%**) - 1% low FPS: 6.0 → 9.1 (**+51.7%**) - P99 frame time: 167 → 110 ms (**−34.1%**) - VRAM usage: 10.86 → 8.92 GB (**−17.9%**) These results include other memory-management changes and compare runs of different durations, so they cannot be attributed to this PR alone. Nevertheless, they confirm external adoption and hardware exercise. I've updated the PR description with the evidence and its limitations. Isolated A/B testing would help establish the individual impact.
github-bot closed this pull request 2026-12-03 17:03:28 +00:00
Author
Owner

@⁠goldfishdev on GitHub · 2026-12-03 16:57 UTC · original

Superseded by #267, which carries this change and has 12 GB hardware testing. Closing to keep the review in one place.

**@⁠goldfishdev** on GitHub · 2026-12-03 16:57 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/248#issuecomment-7385740099) Superseded by #267, which carries this change and has 12 GB hardware testing. Closing to keep the review in one place.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.