perf(texture): stream large BC tile bands into mapped staging #659

Open
github-bot wants to merge 9 commits from github-bot/gh-659 into main AGit
Owner

@⁠tommiehansen on GitHub · 2026-12-06 01:36 UTC · original
tommiehansen:perf/phase13-bc-band-stream-20261206 → main · +513 −6 · 3 files · 9 commits · open

Why

Large BC texture uploads can spend substantial CPU time on intermediate guest snapshots and detiling. Issue #636 reports that SW_4KB_S and SW_64KB_D BC account for most detiled bytes in its streaming bursts; this does not establish coverage of the narrower admitted family here.

What changes

Opt-in VICTORY_BC_BAND_STREAM=1 streams contiguous non-XOR BC tile-row bands directly into mapped staging. Admission requires a single watched 2D subresource of at least 8 MiB and checked compatible layout/extents. Four leased reusable buffers bound retained band scratch to 4 MiB total, at most 1 MiB per lease; saturation falls back without blocking. Ordinary fallback scratch and run metadata are separate. Unsupported/guarded layouts retain existing conversion and fault handling.

Benchmark results

Final head 5a86dd5, Windows D3D12 WARP, 4096², eight alternating ABBA/BAAB blocks per shape. Median block medians, paired total reductions:

Format Prep before → after (ms) Total before → after (ms) Paired total time change
SW_4KB_S BC1 1.822 → 1.339 3.505 → 2.894 −15.27%
SW_4KB_S BC3 4.098 → 2.817 6.887 → 5.585 −17.03%
SW_64KB_D BC1 2.457 → 1.170 4.119 → 2.817 −30.91%
SW_64KB_D BC3 3.619 → 1.863 6.360 → 4.567 −27.65%

All 32 paired blocks improve total time. Prep reductions 27.66%, 29.31%, 49.49%, 48.25%. Small 512² rejected controls remain byte-exact and do not activate; two warm changed passes 589.4/500.2 µs disabled versus 618.9/520.3 µs enabled are insufficient to establish a reliable small-path overhead estimate.

Why this should be merged

Avoids full texture snapshot scratch storage on the admitted route, reduces measured large-upload preparation and total software-fixture time, and retains bounded memory, dirty tracking and existing fallback. Ready for review as a scoped opt-in improvement, not default-on.

Validation

Final-head CI 47594645326 both jobs passed: 384 exact CPU arms, 128 exact WARP paired arms, 24 actual Staging::refresh_timed production passes and four fault controls, two replicas of a shared watched address, repeated updates, dirty/claim-upload assertions, rejected smaller texture and lease saturation. Actual readbacks are exact. Earlier CI 47592749020 provides independent prior measurements.

Compatibility and dependencies

Independent main-based branch; no dependency on #655. Default off. Actual title coverage, physical AMD timing and distinct physical aliases remain open. No gameplay FPS or zero-copy claim.

Asynchronous compatibility

The original combined async test exposed an existing upstream first-upload alias barrier error for committed resources, reproduced on unchanged main. The independent #662 fix preserves placed/reserved barriers. Corrected baseline and all four combined switch arms pass D3D12 debug-layer exact asynchronous readback, committed/placed resources and deferred owner/fence retirement. This is not a full title lifetime proof.

Physical AMD capture

Test-only head c1ec4ac adds a strict actual DXGI AMD adapter identity gate, without changing production logic. Use the shared runner with PRC_AMD_GATES=bc_band and eight internal paired blocks. Physical execution remains pending. Earlier tables retain their measured revision; negative paired time change means improvement.

**@⁠tommiehansen** on GitHub · 2026-12-06 01:36 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/659) `tommiehansen:perf/phase13-bc-band-stream-20261206` → `main` · +513 −6 · 3 files · 9 commits · open ## Why Large BC texture uploads can spend substantial CPU time on intermediate guest snapshots and detiling. Issue #636 reports that SW_4KB_S and SW_64KB_D BC account for most detiled bytes in its streaming bursts; this does not establish coverage of the narrower admitted family here. ## What changes Opt-in VICTORY_BC_BAND_STREAM=1 streams contiguous non-XOR BC tile-row bands directly into mapped staging. Admission requires a single watched 2D subresource of at least 8 MiB and checked compatible layout/extents. Four leased reusable buffers bound retained band scratch to 4 MiB total, at most 1 MiB per lease; saturation falls back without blocking. Ordinary fallback scratch and run metadata are separate. Unsupported/guarded layouts retain existing conversion and fault handling. ## Benchmark results Final head 5a86dd5, Windows D3D12 WARP, 4096², eight alternating ABBA/BAAB blocks per shape. Median block medians, paired total reductions: | Format | Prep before → after (ms) | Total before → after (ms) | Paired total time change | |---|---:|---:|---:| | SW_4KB_S BC1 | 1.822 → 1.339 | 3.505 → 2.894 | −15.27% | | SW_4KB_S BC3 | 4.098 → 2.817 | 6.887 → 5.585 | −17.03% | | SW_64KB_D BC1 | 2.457 → 1.170 | 4.119 → 2.817 | −30.91% | | SW_64KB_D BC3 | 3.619 → 1.863 | 6.360 → 4.567 | −27.65% | All 32 paired blocks improve total time. Prep reductions 27.66%, 29.31%, 49.49%, 48.25%. Small 512² rejected controls remain byte-exact and do not activate; two warm changed passes 589.4/500.2 µs disabled versus 618.9/520.3 µs enabled are insufficient to establish a reliable small-path overhead estimate. ## Why this should be merged Avoids full texture snapshot scratch storage on the admitted route, reduces measured large-upload preparation and total software-fixture time, and retains bounded memory, dirty tracking and existing fallback. Ready for review as a scoped opt-in improvement, not default-on. ## Validation [Final-head CI 47594645326](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47594645326) both jobs passed: 384 exact CPU arms, 128 exact WARP paired arms, 24 actual Staging::refresh_timed production passes and four fault controls, two replicas of a shared watched address, repeated updates, dirty/claim-upload assertions, rejected smaller texture and lease saturation. Actual readbacks are exact. [Earlier CI 47592749020](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47592749020) provides independent prior measurements. ## Compatibility and dependencies Independent main-based branch; no dependency on #655. Default off. Actual title coverage, physical AMD timing and distinct physical aliases remain open. No gameplay FPS or zero-copy claim. ### Asynchronous compatibility The original combined async test exposed an existing upstream first-upload alias barrier error for committed resources, reproduced on unchanged main. The independent [#662](https://git.gtahub.st/github/lobomfz--VIctory-xmem/pulls/662) fix preserves placed/reserved barriers. [Corrected baseline](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47597249936) and [all four combined switch arms](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47597247097) pass D3D12 debug-layer exact asynchronous readback, committed/placed resources and deferred owner/fence retirement. This is not a full title lifetime proof. ### Physical AMD capture Test-only head `c1ec4ac` adds a strict actual DXGI AMD adapter identity gate, without changing production logic. Use the [shared runner](https://github.com/tommiehansen/VIctory-xmem/blob/tracking/phases-8-10/validation/amd-production-gates.sh) with `PRC_AMD_GATES=bc_band` and eight internal paired blocks. Physical execution remains pending. Earlier tables retain their measured revision; negative paired time change means improvement.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-06 01:42:55 +00:00
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/659/head:github-bot/gh-659'
git switch 'github-bot/gh-659'

Merge

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