perf(gpu): experimental GPU texture detiling with CPU fallback #604

Open
github-bot wants to merge 23 commits from github-bot/gh-604 into main AGit
Owner

@⁠tommiehansen on GitHub · 2026-12-05 16:17 UTC · original
tommiehansen:perf/phase8-gpu-detile-upstream-20261205 → main · +1791 −3 · 7 files · 23 commits · draft

Why

CPU texture detiling can delay staging/upload preparation. Offloading layout conversion to GPU compute could help large compatible textures, but extra staging allocation and synchronization can make the complete upload slower. The initial software-backend measurements demonstrated exactly that risk.

What changes

Opt-in VICTORY_GPU_DETILE=1; default remains off. Reject software, unknown and non-AMD adapters before allocating or taking snapshot locks. Admit only conservative shapes: useful payload at least 2 MiB, padding at most 12.5%, combined snapshot/linear allocation at most 64 MiB and bounded dispatch density. A process-wide 256 MiB aligned staging budget is reserved before allocation and held by the prepared resource through list reset. Budget exhaustion or rejected shape uses the original CPU path. Separate diagnostic WARP path retains exactness testing.

Benchmark results

Historical diagnostic WARP measurements (four paired blocks per run) are not the current production admission behavior.

Workload / run Original Forced GPU detile Paired change
CPU preparation, initial 0.503 ms 0.256 ms ~−49%
Complete transfer, initial 0.981 ms 16.322 ms Severe regression
CPU preparation, repeat 0.508 ms 0.362 ms −28.1%
Complete transfer, repeat 1.117 ms 20.438 ms +1729.4%

Current actual software fallback 47581549678: eight exact paired blocks, preparation +1.64%, total −0.72% median paired. This is a fallback control, not a detile speedup.

Why this should be merged

The bounded implementation makes physical testing of large compatible textures possible without activating the expensive software path or allowing unbounded staging. Retain draft: actual complete AMD upload cost must justify the added dispatch and allocation. The requested allocation ceiling is not measured peak VRAM.

Validation and compatibility

At fb6b477, 47586341337 passed concurrent reservation (16 workers, exactly four admitted), overflow rejection, abandoned lease and recovery, and eight exact software fallback blocks. 47584091713 passed retention/budget checks; 47580505713 passed shape boundaries and diagnostic copy.
Use the pinned AMD runner detile gate with VICTORY_GPU_DETILE=1 and VICTORY_GPU_DETILE_TEST_AMD=1 on a physical supported AMD adapter, not forced WARP. Report actual activation, full staging/upload times, memory and exact bytes. Compare #653 separately; no hardware speedup or FPS established.

2026-12-06 — allocation amortization

Opt-in VICTORY_GPU_DETILE_REUSE=1 adds exact-size retired staging/linear allocation reuse. At most two idle pairs and 32 MiB retained, included in the existing budget. Last Prepared/flight owner releases or pools allocation; try-lock and idle eviction avoid indefinite waiting. Default remains off. 47599663769 passed actual diagnostic WARP reuse with changed input, exact bytes and budget release; no physical cost claim. Follow-up 38d688c4 uses identical changing inputs for both reuse arms and requires 16 actual physical reuse hits vs zero when disabled. Current CI. The shared AMD runner now compares fresh GPU allocations vs warm reuse as well as CPU fallback with separate prep and complete upload timing. No default activation pending physical net benefit.

2026-12-06 — concurrent retirement and size coverage

CI 47602005100, head 659a4b5c, passed production fallback, changed-source exact diagnostic reuse and new pool lifecycle test: four simultaneously live pairs have unique GPU addresses, no pooling while list-held, two retained idle pairs, actual retired-pair reuse, oversized 40 MiB retention rejection and complete budget release. The common return helper preserves the 32 MiB/2-pair limit.
Head a539786e extends the exact upload/readback fixture to 2/8/16 MiB RGBA8 tiled payloads. CI 47602628481 pending; shared physical gate requires exact matching sizes and reports fresh CPU/GPU and warm GPU reuse separately. Complete measured transfer includes readback common to both arms. No directly matched workload intersection with the linear, twin and BC-specific scopes of #655/#657/#659 established. Physical net timing still required; default off.

**@⁠tommiehansen** on GitHub · 2026-12-05 16:17 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/604) `tommiehansen:perf/phase8-gpu-detile-upstream-20261205` → `main` · +1791 −3 · 7 files · 23 commits · draft ## Why CPU texture detiling can delay staging/upload preparation. Offloading layout conversion to GPU compute could help large compatible textures, but extra staging allocation and synchronization can make the complete upload slower. The initial software-backend measurements demonstrated exactly that risk. ## What changes Opt-in `VICTORY_GPU_DETILE=1`; default remains off. Reject software, unknown and non-AMD adapters before allocating or taking snapshot locks. Admit only conservative shapes: useful payload at least 2 MiB, padding at most 12.5%, combined snapshot/linear allocation at most 64 MiB and bounded dispatch density. A process-wide 256 MiB aligned staging budget is reserved before allocation and held by the prepared resource through list reset. Budget exhaustion or rejected shape uses the original CPU path. Separate diagnostic WARP path retains exactness testing. ## Benchmark results Historical diagnostic WARP measurements (four paired blocks per run) are not the current production admission behavior. | Workload / run | Original | Forced GPU detile | Paired change | |---|---:|---:|---:| | CPU preparation, [initial](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47538748813) | 0.503 ms | 0.256 ms | ~−49% | | Complete transfer, initial | 0.981 ms | 16.322 ms | Severe regression | | CPU preparation, [repeat](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47541154945) | 0.508 ms | 0.362 ms | −28.1% | | Complete transfer, repeat | 1.117 ms | 20.438 ms | +1729.4% | Current actual software fallback [47581549678](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47581549678): eight exact paired blocks, preparation +1.64%, total −0.72% median paired. This is a fallback control, not a detile speedup. ## Why this should be merged The bounded implementation makes physical testing of large compatible textures possible without activating the expensive software path or allowing unbounded staging. Retain draft: actual complete AMD upload cost must justify the added dispatch and allocation. The requested allocation ceiling is not measured peak VRAM. ## Validation and compatibility At `fb6b477`, [47586341337](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47586341337) passed concurrent reservation (16 workers, exactly four admitted), overflow rejection, abandoned lease and recovery, and eight exact software fallback blocks. [47584091713](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47584091713) passed retention/budget checks; [47580505713](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47580505713) passed shape boundaries and diagnostic copy. Use the [pinned AMD runner](https://github.com/tommiehansen/VIctory-xmem/blob/tracking/phases-8-10/validation/amd-production-gates.sh) detile gate with `VICTORY_GPU_DETILE=1` and `VICTORY_GPU_DETILE_TEST_AMD=1` on a physical supported AMD adapter, not forced WARP. Report actual activation, full staging/upload times, memory and exact bytes. Compare #653 separately; no hardware speedup or FPS established. ### 2026-12-06 — allocation amortization Opt-in `VICTORY_GPU_DETILE_REUSE=1` adds exact-size retired staging/linear allocation reuse. At most two idle pairs and 32 MiB retained, included in the existing budget. Last Prepared/flight owner releases or pools allocation; try-lock and idle eviction avoid indefinite waiting. Default remains off. [47599663769](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47599663769) passed actual diagnostic WARP reuse with changed input, exact bytes and budget release; no physical cost claim. Follow-up `38d688c4` uses identical changing inputs for both reuse arms and requires 16 actual physical reuse hits vs zero when disabled. [Current CI](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47600300734). The shared AMD runner now compares fresh GPU allocations vs warm reuse as well as CPU fallback with separate prep and complete upload timing. No default activation pending physical net benefit. ### 2026-12-06 — concurrent retirement and size coverage [CI 47602005100](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47602005100), head `659a4b5c`, passed production fallback, changed-source exact diagnostic reuse and new pool lifecycle test: four simultaneously live pairs have unique GPU addresses, no pooling while list-held, two retained idle pairs, actual retired-pair reuse, oversized 40 MiB retention rejection and complete budget release. The common return helper preserves the 32 MiB/2-pair limit. Head `a539786e` extends the exact upload/readback fixture to 2/8/16 MiB RGBA8 tiled payloads. [CI 47602628481](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47602628481) pending; shared physical gate requires exact matching sizes and reports fresh CPU/GPU and warm GPU reuse separately. Complete measured transfer includes readback common to both arms. No directly matched workload intersection with the linear, twin and BC-specific scopes of #655/#657/#659 established. Physical net timing still required; default off.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 16:18:34 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/604/head:github-bot/gh-604'
git switch 'github-bot/gh-604'

Merge

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