GPU: preserve indirect draw budget order across groups #898

Open
avt0m4t48 wants to merge 1 commit from upstream-pr/899 into main
avt0m4t48 commented 2026-11-25 12:15:30 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by avt0m4t48 on 2026-11-25T12:15:30Z.


Refs #888.

The clamp now dispatches 64-record groups in input order, with a UAV barrier between groups. It keeps the existing lane-ordered budget calculation within each group. The 128-record regression still requires draws 1 and 2 to survive, and reports the actual surviving indices if it fails.

This is a focused alternative to #864. It keeps main's per-group charge and ordered lane walk, and it preserves the legacy benchmark's six-constant single-dispatch path.

On Windows Server 2025 WARP, the original f85101b failed the reported assertion on attempt 2. At 684eb7a (based on a253706), all 13 indirect tests passed, and seven additional isolated runs each kept records [1, 2]. The existing indirect benchmark ran on the Microsoft Basic Render Driver and exercised both recorder paths. Asset policy and the MSVC-target Rust check also passed. Baseline run · Patched run

Calls with more than 64 records now record more dispatches and barriers, including count-buffer calls whose actual count is lower than their maximum. The existing draw window is capped at 64. Physical adapter and large-window performance were not measured. The tests use source-built fixtures.

AI-assisted using Codex.

<!-- greyfinch-sync:fxceless/victory-fork:issue:5491132246 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/899). Originally posted by [avt0m4t48](https://github.com/avt0m4t48) on 2026-11-25T12:15:30Z. --- Refs #888. The clamp now dispatches 64-record groups in input order, with a UAV barrier between groups. It keeps the existing lane-ordered budget calculation within each group. The 128-record regression still requires draws 1 and 2 to survive, and reports the actual surviving indices if it fails. This is a focused alternative to #864. It keeps main's per-group charge and ordered lane walk, and it preserves the legacy benchmark's six-constant single-dispatch path. On Windows Server 2025 WARP, the original `f85101b` failed the reported assertion on attempt 2. At `684eb7a` (based on `a253706`), all 13 indirect tests passed, and seven additional isolated runs each kept records `[1, 2]`. The existing indirect benchmark ran on the Microsoft Basic Render Driver and exercised both recorder paths. Asset policy and the MSVC-target Rust check also passed. [Baseline run](https://github.com/avt0m4t48/victory-fork/actions/runs/45610184876) · [Patched run](https://github.com/avt0m4t48/victory-fork/actions/runs/45611523140) Calls with more than 64 records now record more dispatches and barriers, including count-buffer calls whose actual count is lower than their maximum. The existing draw window is capped at 64. Physical adapter and large-window performance were not measured. The tests use source-built fixtures. AI-assisted using Codex.
avt0m4t48 commented 2026-11-25 14:10:52 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by avt0m4t48 on 2026-11-25T13:56:57Z.


I measured the extra dispatches on Windows WARP at 684eb7a against the exact parallel clamp shader from a253706. The two variants ran in one process with the same outer barriers, 3,200 small synthetic draws, and the same budget storage. Each figure is the median over nine runs after warmup.

Records per clamp Parallel WARP ms Ordered WARP ms CPU recording ms, parallel → ordered
32 23.15 23.46 0.18 → 0.18
64 24.36 24.44 0.14 → 0.14
128 23.78 23.79 0.12 → 0.13
512 23.37 23.32 0.10 → 0.11

At 128 and 512 records the recording increase was 0.01 ms at the benchmark's reporting precision. These measurements include the synthetic draws and come from the software adapter. Physical GPU timing, count-buffer stalls, and game frame time still need separate measurements. Benchmark source · Windows run

AI-assisted using Codex.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7164524621 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/899#issuecomment-7164524621). Originally posted by [avt0m4t48](https://github.com/avt0m4t48) on 2026-11-25T13:56:57Z. --- I measured the extra dispatches on Windows WARP at `684eb7a` against the exact parallel clamp shader from `a253706`. The two variants ran in one process with the same outer barriers, 3,200 small synthetic draws, and the same budget storage. Each figure is the median over nine runs after warmup. | Records per clamp | Parallel WARP ms | Ordered WARP ms | CPU recording ms, parallel → ordered | | ---: | ---: | ---: | ---: | | 32 | 23.15 | 23.46 | 0.18 → 0.18 | | 64 | 24.36 | 24.44 | 0.14 → 0.14 | | 128 | 23.78 | 23.79 | 0.12 → 0.13 | | 512 | 23.37 | 23.32 | 0.10 → 0.11 | At 128 and 512 records the recording increase was 0.01 ms at the benchmark's reporting precision. These measurements include the synthetic draws and come from the software adapter. Physical GPU timing, count-buffer stalls, and game frame time still need separate measurements. [Benchmark source](https://github.com/avt0m4t48/victory-fork/commit/46fdfdde78b029901adf7b94729998fae081281f) · [Windows run](https://github.com/avt0m4t48/victory-fork/actions/runs/45627839456) AI-assisted using Codex.
nnonno91 commented 2026-11-25 22:07:21 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by nnonno91 on 2026-11-25T21:10:55Z.


Independent native D3D12 check on a GeForce RTX 5090 (617.42), Ryzen 7 9800X3D, Windows 11 build 26200, Rust 1.98.1. I compared this PR at 684eb7a with its parent a253706.

The synthetic 128-record clamp test ran 20 times per adapter and revision. I adapted the test harness to select and report the adapter, require initialization, and print the surviving indices.

Adapter Baseline failures PR failures
RTX 5090 6/20 0/20
WARP 20/20 0/20

Every failure retained records [64, 65]. Every run with the PR retained [1, 2] and passed the budget saturation and record-field checks.

I also ran the existing indirect-draw benchmark on the RTX 5090 with 3,200 tiny synthetic draws and 128 records per clamp. These are medians of five alternating process runs per revision, with nine timed frames per case after warmup.

Budget storage Baseline GPU time PR GPU time
CPU-mapped 0.27 ms (0.26–0.28) 0.35 ms (0.32–0.37)
GPU-local 0.21 ms (0.21–0.28) 0.30 ms (0.27–0.32)

The one-record CPU-mapped case varied across runs (14.90–17.12 ms baseline, 14.96–18.01 ms with the PR). These measurements cover the synthetic draws and clamp work. Count-buffer behavior and in-game frame time remain open.

Tested and summarized with Codex.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7174720808 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/899#issuecomment-7174720808). Originally posted by [nnonno91](https://github.com/nnonno91) on 2026-11-25T21:10:55Z. --- Independent native D3D12 check on a GeForce RTX 5090 (617.42), Ryzen 7 9800X3D, Windows 11 build 26200, Rust 1.98.1. I compared this PR at <code>684eb7a</code> with its parent <code>a253706</code>. The synthetic 128-record clamp test ran 20 times per adapter and revision. I adapted the test harness to select and report the adapter, require initialization, and print the surviving indices. | Adapter | Baseline failures | PR failures | | --- | ---: | ---: | | RTX 5090 | 6/20 | 0/20 | | WARP | 20/20 | 0/20 | Every failure retained records <code>[64, 65]</code>. Every run with the PR retained <code>[1, 2]</code> and passed the budget saturation and record-field checks. I also ran the existing indirect-draw benchmark on the RTX 5090 with 3,200 tiny synthetic draws and 128 records per clamp. These are medians of five alternating process runs per revision, with nine timed frames per case after warmup. | Budget storage | Baseline GPU time | PR GPU time | | --- | ---: | ---: | | CPU-mapped | 0.27 ms (0.26–0.28) | 0.35 ms (0.32–0.37) | | GPU-local | 0.21 ms (0.21–0.28) | 0.30 ms (0.27–0.32) | The one-record CPU-mapped case varied across runs (14.90–17.12 ms baseline, 14.96–18.01 ms with the PR). These measurements cover the synthetic draws and clamp work. Count-buffer behavior and in-game frame time remain open. Tested and summarized with Codex.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/899:upstream-pr/899'
git switch 'upstream-pr/899'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/899'
git switch 'upstream-pr/899'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/899'
git switch 'upstream-pr/899'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/899'
git switch 'main'
git merge --squash 'upstream-pr/899'
git switch 'main'
git merge --ff-only 'upstream-pr/899'
git switch 'main'
git merge 'upstream-pr/899'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!898
No description provided.