GPU: specialize the indirect argument clamp for single records #1016

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

@⁠Lkxex on GitHub · 2026-11-25 16:18 UTC · original
Lkxex:perf/single-record-indirect-clamp → main · +151 −11 · 3 files · 1 commits · open

The latest frame breakdown reports about 2,400 indirect calls per frame that still run separate clamps with draw windows enabled, including about 960 compute calls and 1,000 scattered mesh draws. This targets the one-record calls that reach the inline clamp, including pipelines that are ineligible for draw windows.

With VICTORY_INDIRECT_SINGLE=1, one-record calls use a one-thread variant of the existing shader. Both variants share argument decoding, bounds checks and record writes. The specialized shader drops group-memory synchronization and the lane scans, and preserves the saturating atomic budget charge, mesh diagnostics, padding, count-buffer rules and D3D12 barriers. Larger calls and windows continue through the group shader. The switch defaults to off and falls back to the group shader if compilation fails.

RX 6600, 3,200 synthetic indirect draws, GPU timestamp medians of nine samples per case, device-local budget and identical barriers in both cases:

Run Group kernel Single-record kernel GPU time
1 7.98 ms 6.71 ms -15.9%
2 8.91 ms 7.32 ms -17.8%
3 8.06 ms 6.72 ms -16.6%

The benchmark includes the clamp and tiny graphics draws. These figures describe the synthetic workload. A game run and NVIDIA measurements are pending.

The diagnostics indirect suite passed 14 tests on Windows with VICTORY_D3D12_DEBUG=1 and VICTORY_INDIRECT_SINGLE=1. The new WARP parity test compares scratch and all three budget words across draw, indexed draw, dispatch and mesh, including a zero count, exact budget fit, saturation, and an unfilled ahead record. The ignored timestamp benchmark also passed on the hardware adapter.

Related: #1001 reduces the number of clamp passes for compatible prefixes. This change reduces the cost of a clamp that runs individually.

AI-assisted.

**@⁠Lkxex** on GitHub · 2026-11-25 16:18 UTC · [original](https://github.com/fxceless/victory-fork/pull/1016) `Lkxex:perf/single-record-indirect-clamp` → `main` · +151 −11 · 3 files · 1 commits · open The latest frame breakdown reports about 2,400 indirect calls per frame that still run separate clamps with draw windows enabled, including about 960 compute calls and 1,000 scattered mesh draws. This targets the one-record calls that reach the inline clamp, including pipelines that are ineligible for draw windows. With VICTORY_INDIRECT_SINGLE=1, one-record calls use a one-thread variant of the existing shader. Both variants share argument decoding, bounds checks and record writes. The specialized shader drops group-memory synchronization and the lane scans, and preserves the saturating atomic budget charge, mesh diagnostics, padding, count-buffer rules and D3D12 barriers. Larger calls and windows continue through the group shader. The switch defaults to off and falls back to the group shader if compilation fails. RX 6600, 3,200 synthetic indirect draws, GPU timestamp medians of nine samples per case, device-local budget and identical barriers in both cases: | Run | Group kernel | Single-record kernel | GPU time | | --- | ---: | ---: | ---: | | 1 | 7.98 ms | 6.71 ms | -15.9% | | 2 | 8.91 ms | 7.32 ms | -17.8% | | 3 | 8.06 ms | 6.72 ms | -16.6% | The benchmark includes the clamp and tiny graphics draws. These figures describe the synthetic workload. A game run and NVIDIA measurements are pending. The diagnostics indirect suite passed 14 tests on Windows with VICTORY_D3D12_DEBUG=1 and VICTORY_INDIRECT_SINGLE=1. The new WARP parity test compares scratch and all three budget words across draw, indexed draw, dispatch and mesh, including a zero count, exact budget fit, saturation, and an unfilled ahead record. The ignored timestamp benchmark also passed on the hardware adapter. Related: #1001 reduces the number of clamp passes for compatible prefixes. This change reduces the cost of a clamp that runs individually. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:56:03 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/indirect.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1016/head:github-bot/gh-1016'
git switch 'github-bot/gh-1016'

Merge

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