GPU: batch requested indirect prefixes in one prelude (opt-in) #1001

Open
github-bot wants to merge 11 commits from github-bot/gh-1001 into main AGit
Owner

@⁠Demon12377 on GitHub · 2026-11-25 15:35 UTC · original
Demon12377:perf/ordered-indirect-prefix → main · +2183 −312 · 12 files · 11 commits · open

Indirect calls switch from drawing to compute and back for each argument clamp. With VICTORY_INDIRECT_BATCH=1 (off by default), an actual prefix of up to 256 nonwriting, single-record draw/indexed/mesh calls is prepared in one native prelude. Independent prepares share a binding with no inter-prepare barriers; one final group charges the original list budget in call order. Consumers keep their own pipeline and root state.

Latest sync: upstream 3973179 is an ancestor of this branch. Its new pipeline meters, joined submissions, copy-back own-view fixes, monitorx/mwaitx counters, spread experiment and WINDOW_JUMP diagnostics are preserved. Jump/read state is tracked per cached window when combined with the existing eight-window cache.

This proposal includes and supersedes #889, including its repaired coalesced hash (paired sign-bit regression), disjoint window scratch, guarded copy repairs and staging reuse. It includes current upstream 39731795d2d5117e6f90939273ee130428d28137, preserving the frame log, card meter, driver-watch fallback and latest plain-copy/affinity changes.

The new prefix:

  • Ends before a GPU write, copy, barrier, query, count-buffered/multi-record call or other execution; it never cuts a native list or predicts future records.
  • Uses the ordinary clamp for a prefix of one. Longer prefixes have N independent prepares, one ordered charge and two global UAV barriers for the whole prefix, instead of two per call.
  • Leaves scratch readable through the consumer list's close, including a draw whose preparation helper ends the prefix before its execution is recorded.
  • Reclamps on every replay, resets only after the owner's executions finish, bounds the full record/padding and falls back for in-place title arguments or capacity exhaustion.
  • Disables speculative ahead windows while batch mode is enabled, including its inline fallback. The batch also disables itself for serial GPU timing or a tripped driver watch.

Measured synthetic WARP timestamps on Windows/Rust 1.98.1, debug layer/GBV/card meter/serial timing off, five warmups and ten samples. Both modes assert the same weighted work every execution; timestamps include the prelude and consumers:

Calls Inline median, us Batch median, us Inline / batch
1 431.829 493.149 0.88x
16 749.118 763.086 0.98x
64 2146.781 1340.813 1.60x
256 9468.522 4942.667 1.92x

Short prefixes can cost more. These are software-adapter compute-consumer measurements, not game FPS or native mesh/graphics results. A comparable scene benchmark is still needed; no 60-FPS claim is made. Upstream's former 6.0 -> 8.9 FPS comparison was withdrawn in 0b0074e.

The table above was measured on the combined 0b0074e tree; the ordinary clamp shader is unchanged in 3973179. Validation below was rerun after integrating 3973179.

Validation of the current combined tree:

  • Both workspace Clippy configurations (--all-targets, with and without --all-features, --locked -- -D warnings) pass.
  • Asset policy: 182 files pass.
  • Diagnostics victory-gpu, WARP + debug, batch/window flags set: 206 passed, 7 ignored, one inherited depth-bounds test excluded.
  • victory-loader: 26 unit tests pass; the unchanged crash::tests::unwinds_like_the_system_walk fails because the system walk returns an empty vector. The same 26/1 result reproduces on unmodified upstream 3973179. This is recorded as a failure, not a passed/skipped check.
  • Nine new batch tests also pass with GPU Based Validation: ordered budget/counts/padding vs inline; per-call roots; producer before/after the prefix; query boundary; capacity/tail; pending consumer; replay/reset.
  • The timestamp benchmark ran separately with assertions, rather than treating its ignored status as validation.

The excluded depth_bounds_pipeline_loads_and_filters_draws test has a previously reproduced upstream E_INVALIDARG at root-signature creation on this machine. Shader Model 6.6/game validation was not performed here. Follow-on work remains for prefixes after an in-list producer, physical-page coherence and translated shader cost. Related budget-order proposals #864/#899 address a different grouping boundary.

AI-assisted implementation and source review; local tests use synthetic data only. No game assets or derived fixtures.

**@⁠Demon12377** on GitHub · 2026-11-25 15:35 UTC · [original](https://github.com/fxceless/victory-fork/pull/1001) `Demon12377:perf/ordered-indirect-prefix` → `main` · +2183 −312 · 12 files · 11 commits · open Indirect calls switch from drawing to compute and back for each argument clamp. With `VICTORY_INDIRECT_BATCH=1` (off by default), an actual prefix of up to 256 nonwriting, single-record draw/indexed/mesh calls is prepared in one native prelude. Independent prepares share a binding with no inter-prepare barriers; one final group charges the original list budget in call order. Consumers keep their own pipeline and root state. Latest sync: upstream 3973179 is an ancestor of this branch. Its new pipeline meters, joined submissions, copy-back own-view fixes, monitorx/mwaitx counters, spread experiment and WINDOW_JUMP diagnostics are preserved. Jump/read state is tracked per cached window when combined with the existing eight-window cache. This proposal includes and supersedes #889, including its repaired coalesced hash (paired sign-bit regression), disjoint window scratch, guarded copy repairs and staging reuse. It includes current upstream `39731795d2d5117e6f90939273ee130428d28137`, preserving the frame log, card meter, driver-watch fallback and latest plain-copy/affinity changes. The new prefix: - Ends before a GPU write, copy, barrier, query, count-buffered/multi-record call or other execution; it never cuts a native list or predicts future records. - Uses the ordinary clamp for a prefix of one. Longer prefixes have N independent prepares, one ordered charge and two global UAV barriers for the whole prefix, instead of two per call. - Leaves scratch readable through the consumer list's close, including a draw whose preparation helper ends the prefix before its execution is recorded. - Reclamps on every replay, resets only after the owner's executions finish, bounds the full record/padding and falls back for in-place title arguments or capacity exhaustion. - Disables speculative ahead windows while batch mode is enabled, including its inline fallback. The batch also disables itself for serial GPU timing or a tripped driver watch. Measured synthetic WARP timestamps on Windows/Rust 1.98.1, debug layer/GBV/card meter/serial timing off, five warmups and ten samples. Both modes assert the same weighted work every execution; timestamps include the prelude and consumers: | Calls | Inline median, us | Batch median, us | Inline / batch | |---:|---:|---:|---:| | 1 | 431.829 | 493.149 | 0.88x | | 16 | 749.118 | 763.086 | 0.98x | | 64 | 2146.781 | 1340.813 | 1.60x | | 256 | 9468.522 | 4942.667 | 1.92x | Short prefixes can cost more. These are software-adapter compute-consumer measurements, not game FPS or native mesh/graphics results. A comparable scene benchmark is still needed; no 60-FPS claim is made. Upstream's former 6.0 -> 8.9 FPS comparison was withdrawn in 0b0074e. The table above was measured on the combined 0b0074e tree; the ordinary clamp shader is unchanged in 3973179. Validation below was rerun after integrating 3973179. Validation of the current combined tree: - Both workspace Clippy configurations (`--all-targets`, with and without `--all-features`, `--locked -- -D warnings`) pass. - Asset policy: 182 files pass. - Diagnostics victory-gpu, WARP + debug, batch/window flags set: 206 passed, 7 ignored, one inherited depth-bounds test excluded. - victory-loader: 26 unit tests pass; the unchanged crash::tests::unwinds_like_the_system_walk fails because the system walk returns an empty vector. The same 26/1 result reproduces on unmodified upstream 3973179. This is recorded as a failure, not a passed/skipped check. - Nine new batch tests also pass with GPU Based Validation: ordered budget/counts/padding vs inline; per-call roots; producer before/after the prefix; query boundary; capacity/tail; pending consumer; replay/reset. - The timestamp benchmark ran separately with assertions, rather than treating its ignored status as validation. The excluded depth_bounds_pipeline_loads_and_filters_draws test has a previously reproduced upstream E_INVALIDARG at root-signature creation on this machine. Shader Model 6.6/game validation was not performed here. Follow-on work remains for prefixes after an in-list producer, physical-page coherence and translated shader cost. Related budget-order proposals #864/#899 address a different grouping boundary. AI-assisted implementation and source review; local tests use synthetic data only. No game assets or derived fixtures.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:55:36 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/draw.rs
  • crates/victory-gpu/src/host.rs
  • crates/victory-gpu/src/indirect.rs
  • crates/victory-gpu/src/list.rs
  • crates/victory-gpu/src/resource.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/1001/head:github-bot/gh-1001'
git switch 'github-bot/gh-1001'

Merge

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