feat: optional direct Vulkan texture compute substage #653

Open
github-bot wants to merge 8 commits from github-bot/gh-653 into main AGit
Owner

@⁠tommiehansen on GitHub · 2026-12-06 00:16 UTC · original
tommiehansen:perf/phase13-vulkan-texture-compute-20261206 → main · +556 −0 · 11 files · 8 commits · draft

Why

Texture staging currently depends on CPU layout conversion. A compute implementation may move some detiling work off the CPU, but transfers, private buffer allocations and synchronization can outweigh the arithmetic benefit. Measuring the entire conversion/upload path is essential.

What changes

The optional direct-vulkan build feature and VICTORY_VK_COMPUTE=1 initialize a Vulkan device, compute queue, pipeline, descriptor bindings and private storage buffers. The staging conversion path can use fence-synchronized compute detiling, with CPU fallback for unsupported layouts or failed operations. Private buffer readback is not zero-copy. Boxon's run-detile design is the inspiration; independent implementation.

Benchmark results — software Vulkan correctness

CI 47586227814, 71193b41.

Fixture Result
128 × 128, 4 bytes Exact
257 × 129, 8 bytes Exact
128 × 64, 16 bytes Exact

SPIR-V validation and Windows production feature compilation also passed. No elapsed-time, physical AMD or gameplay measurement exists.

Why this should be merged

This isolated opt-in substage provides a bounded way to evaluate compute-assisted texture conversion without replacing the existing renderer. Keep draft until actual staging activation, unsupported-layout fallback and full upload costs (initialization, allocations, copies, synchronization) are verified.

Validation and compatibility

Reproduce the pinned software Vulkan/llvmpipe and Windows feature-compile workflow above with direct-vulkan and the runtime option enabled. Compare with the original CPU path and #604 where applicable, using complete upload cost rather than isolated kernel time. Request physical RDNA testing and repeated pipeline-amortized workloads. This is not a general Vulkan execution backend or guest dispatch routing.

Current revision b192578

After a successful Vulkan fence, publish the mapped destination directly into row-pitched staging memory, eliminating the extra CPU output vector and copy. Validate mip and shape before indexing, and skip per-element planning after cached context initialization failure. New rejection tests check untouched output; 96 paired CPU/Vulkan conversion rows require exact output including row padding. Current-head CI 47589584984 has passed the Vulkan job; Windows production validation has completed. Software timings are not full D3D12 uploads or physical AMD measurements.

Current-head paired conversion results — llvmpipe

The Vulkan job of CI 47589584984 passed, including 96 exact rows (8 paired ABBA/BAAB blocks per shape, 16 samples per arm). Median of block medians, in microseconds; change is median paired percentage.

Fixture CPU Software Vulkan Paired time change Vulkan wins
128 × 128, 4 bytes 8.403 476.289 +5754.81% 0/8
257 × 129, 8 bytes 24.267 948.416 +3800.11% 0/8
128 × 64, 16 bytes 10.546 455.785 +4184.99% 0/8

The first cold conversion including context initialization took 27.94 ms. Device: llvmpipe (LLVM 22.1.2, 256 bits), CPU type. The current implementation is substantially slower in this software control. Keep draft and disabled by default; do not infer native AMD or gameplay behavior from these numbers. Windows production-feature job passed.

Both jobs of CI 47589584984 are now complete and passed, including Windows production feature compilation. The software-device performance results remain negative; no native AMD timing exists.

Validated adapter gate

760f044a rejects non-AMD and CPU Vulkan devices in production, requires Vulkan 1.1 and sufficient storage/compute dispatch limits, and keeps explicit device selection among multiple eligible adapters. 12f5c8b separates test-only software execution from production-equivalent software rejection. CI 47591649283 passed both jobs: exact Vulkan tests, unchanged-output rejection and Windows production feature compilation. Software override is compiled only in tests. No repeated negative software timing run; physical AMD and full staging-to-upload performance remain unverified.

Physical production staging fixture

ef184eef: CI 47593457980 passed Vulkan and Windows production compile jobs. The new ignored physical test exercises Staging::detile_part, actual D3D12 texture upload/readback, 1/4-texture batches and linear fallback with exact output and activation checks. It requires a physical AMD adapter and records Vulkan device identity. The shared physical runner exposes PRC_AMD_GATES=vk_texture and paired preparation/total measurements. Physical execution and comparisons with #604/#655 are still pending; CI compiled the fixture, it did not measure a GPU. Remains draft.

**@⁠tommiehansen** on GitHub · 2026-12-06 00:16 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/653) `tommiehansen:perf/phase13-vulkan-texture-compute-20261206` → `main` · +556 −0 · 11 files · 8 commits · draft ## Why Texture staging currently depends on CPU layout conversion. A compute implementation may move some detiling work off the CPU, but transfers, private buffer allocations and synchronization can outweigh the arithmetic benefit. Measuring the entire conversion/upload path is essential. ## What changes The optional `direct-vulkan` build feature and `VICTORY_VK_COMPUTE=1` initialize a Vulkan device, compute queue, pipeline, descriptor bindings and private storage buffers. The staging conversion path can use fence-synchronized compute detiling, with CPU fallback for unsupported layouts or failed operations. Private buffer readback is not zero-copy. Boxon's run-detile design is the inspiration; independent implementation. ## Benchmark results — software Vulkan correctness [CI 47586227814](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47586227814), `71193b41`. | Fixture | Result | |---|---| | 128 × 128, 4 bytes | Exact | | 257 × 129, 8 bytes | Exact | | 128 × 64, 16 bytes | Exact | SPIR-V validation and Windows production feature compilation also passed. No elapsed-time, physical AMD or gameplay measurement exists. ## Why this should be merged This isolated opt-in substage provides a bounded way to evaluate compute-assisted texture conversion without replacing the existing renderer. Keep draft until actual staging activation, unsupported-layout fallback and full upload costs (initialization, allocations, copies, synchronization) are verified. ## Validation and compatibility Reproduce the pinned software Vulkan/llvmpipe and Windows feature-compile workflow above with `direct-vulkan` and the runtime option enabled. Compare with the original CPU path and #604 where applicable, using complete upload cost rather than isolated kernel time. Request physical RDNA testing and repeated pipeline-amortized workloads. This is not a general Vulkan execution backend or guest dispatch routing. ### Current revision `b192578` After a successful Vulkan fence, publish the mapped destination directly into row-pitched staging memory, eliminating the extra CPU output vector and copy. Validate mip and shape before indexing, and skip per-element planning after cached context initialization failure. New rejection tests check untouched output; 96 paired CPU/Vulkan conversion rows require exact output including row padding. [Current-head CI 47589584984](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47589584984) has passed the Vulkan job; Windows production validation has completed. Software timings are not full D3D12 uploads or physical AMD measurements. ### Current-head paired conversion results — llvmpipe The Vulkan job of [CI 47589584984](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47589584984) passed, including 96 exact rows (8 paired ABBA/BAAB blocks per shape, 16 samples per arm). Median of block medians, in microseconds; change is median paired percentage. | Fixture | CPU | Software Vulkan | Paired time change | Vulkan wins | |---|---:|---:|---:|---:| | 128 × 128, 4 bytes | 8.403 | 476.289 | +5754.81% | 0/8 | | 257 × 129, 8 bytes | 24.267 | 948.416 | +3800.11% | 0/8 | | 128 × 64, 16 bytes | 10.546 | 455.785 | +4184.99% | 0/8 | The first cold conversion including context initialization took 27.94 ms. Device: llvmpipe (LLVM 22.1.2, 256 bits), CPU type. The current implementation is substantially slower in this software control. Keep draft and disabled by default; do not infer native AMD or gameplay behavior from these numbers. Windows production-feature job passed. Both jobs of CI 47589584984 are now complete and passed, including Windows production feature compilation. The software-device performance results remain negative; no native AMD timing exists. ### Validated adapter gate `760f044a` rejects non-AMD and CPU Vulkan devices in production, requires Vulkan 1.1 and sufficient storage/compute dispatch limits, and keeps explicit device selection among multiple eligible adapters. `12f5c8b` separates test-only software execution from production-equivalent software rejection. [CI 47591649283](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47591649283) passed both jobs: exact Vulkan tests, unchanged-output rejection and Windows production feature compilation. Software override is compiled only in tests. No repeated negative software timing run; physical AMD and full staging-to-upload performance remain unverified. ### Physical production staging fixture `ef184eef`: [CI 47593457980](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47593457980) passed Vulkan and Windows production compile jobs. The new ignored physical test exercises `Staging::detile_part`, actual D3D12 texture upload/readback, 1/4-texture batches and linear fallback with exact output and activation checks. It requires a physical AMD adapter and records Vulkan device identity. The [shared physical runner](https://github.com/tommiehansen/VIctory-xmem/blob/tracking/phases-8-10/validation/amd-production-gates.sh) exposes `PRC_AMD_GATES=vk_texture` and paired preparation/total measurements. Physical execution and comparisons with #604/#655 are still pending; CI compiled the fixture, it did not measure a GPU. Remains draft.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-06 00:17:40 +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/653/head:github-bot/gh-653'
git switch 'github-bot/gh-653'

Merge

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