GPU: reuse indirect argument windows and coalesce card compares #889

Closed
github-bot wants to merge 7 commits from gh-pr/889/head into gh-pr/889/base
Owner

@⁠Demon12377 on GitHub · 2026-11-25 11:57 UTC · original
Demon12377:perf/gpu-hot-path-validated → main · +974 −253 · 8 files · 7 commits · closed without merging

Superseded by #1001. The new proposal contains all of this PR's validated changes and repaired card hash, plus opt-in indirect-prefix batching and its GPU validation/measurement tests. Closing this duplicate proposal preserves one review target.

Interleaved indirect draws currently replace the last clamped window, and CARD_COMPARE hashes each 64 KiB piece on one lane. This retains up to eight indirect windows in disjoint scratch slices and hashes a piece with a coalesced 64-thread group.

The branch includes current main 0b0074e0b2. Its frame log, card meter, driver-watch fallback, plain-copy path and rehash A/B mode are preserved.

Changes:

  • Add aligned scratch offsets and allocation epochs; keep replaced resources alive until reset and invalidate windows after scratch replacement/wrap.
  • Increase the window limit to 128 records. Widen only when two complete padded records fit; a short final record uses its original command-signature stride.
  • Avalanche and permute the right hash-reduction branch to prevent paired sign-bit writes cancelling. A new WARP test covers one zero page and 128 seeded pages, plus compare-and-store mode; it fails on the former shader and passes after the fix.
  • Batch upload transitions and reuse compare/fetch bindings, including the new upstream card-meter instrumentation. The new hash values differ from the serial hash, but the same shader produces and compares them.
  • Use stack buffers and reusable descriptor-table vectors; pool staging buffers up to 64 MiB within the existing 256 MiB total cap.
  • Add mapping-guarded x64 reads behind VICTORY_FAST_COPY=1, with checked VEH installation and clean failure for access violations, guard-page exceptions and in-page errors. The separate upstream VICTORY_COPY_PLAIN path remains available.
  • Preserve opt-in rollout defaults and disable windows when upstream driver-watch trips.
  • Keep the budget test's saturation/source/padding checks while accepting either GPU-group scheduling order, following #849.
  • Remove/gate unused diagnostic items and fix the sorting and new is_multiple_of lint so both Clippy configurations pass.

Validation on the synchronized tree, Windows/Rust 1.98.1, synthetic data:

  • cargo clippy --workspace --all-targets --locked -- -D warnings: passes.
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passes.
  • cargo xtask policy: 179 files pass.
  • Diagnostics victory-gpu: 191 passed, 6 ignored, 1 excluded, with WARP and D3D12 debug enabled on the current synchronized tree.
  • Earlier victory-hle validation: 98 unit tests and one integration test passed before the latest upstream affinity changes; current workspace Clippy also checks those changes.
  • Published branch tree is identical to the locally tested merge; upstream 0b0074e is an ancestor.

The excluded depth_bounds_pipeline_loads_and_filters_draws test has an inherited E_INVALIDARG failure at root-signature creation on this machine. The full workspace suite was not rerun for this sync: its GPU shader tests require Shader Model 6.6, unavailable here. No scene/visual/FPS benchmark was performed, so the PR remains a draft.

The former 6.0 -> 8.9 FPS upstream window comparison was withdrawn in 0b0074e because draw counts differed. This PR claims no game/FPS improvement.

Related overlapping proposals: #71, #154 and #867. AI-assisted code and review; validation ran locally. No game files or derived fixtures are included.

**@⁠Demon12377** on GitHub · 2026-11-25 11:57 UTC · [original](https://github.com/fxceless/victory-fork/pull/889) `Demon12377:perf/gpu-hot-path-validated` → `main` · +974 −253 · 8 files · 7 commits · closed without merging Superseded by https://git.gtahub.st/github/fxceless--victory-fork/pulls/1001. The new proposal contains all of this PR's validated changes and repaired card hash, plus opt-in indirect-prefix batching and its GPU validation/measurement tests. Closing this duplicate proposal preserves one review target. Interleaved indirect draws currently replace the last clamped window, and CARD_COMPARE hashes each 64 KiB piece on one lane. This retains up to eight indirect windows in disjoint scratch slices and hashes a piece with a coalesced 64-thread group. The branch includes current main 0b0074e0b2765e574c622e9a3de566f20f04135b. Its frame log, card meter, driver-watch fallback, plain-copy path and rehash A/B mode are preserved. Changes: - Add aligned scratch offsets and allocation epochs; keep replaced resources alive until reset and invalidate windows after scratch replacement/wrap. - Increase the window limit to 128 records. Widen only when two complete padded records fit; a short final record uses its original command-signature stride. - Avalanche and permute the right hash-reduction branch to prevent paired sign-bit writes cancelling. A new WARP test covers one zero page and 128 seeded pages, plus compare-and-store mode; it fails on the former shader and passes after the fix. - Batch upload transitions and reuse compare/fetch bindings, including the new upstream card-meter instrumentation. The new hash values differ from the serial hash, but the same shader produces and compares them. - Use stack buffers and reusable descriptor-table vectors; pool staging buffers up to 64 MiB within the existing 256 MiB total cap. - Add mapping-guarded x64 reads behind VICTORY_FAST_COPY=1, with checked VEH installation and clean failure for access violations, guard-page exceptions and in-page errors. The separate upstream VICTORY_COPY_PLAIN path remains available. - Preserve opt-in rollout defaults and disable windows when upstream driver-watch trips. - Keep the budget test's saturation/source/padding checks while accepting either GPU-group scheduling order, following #849. - Remove/gate unused diagnostic items and fix the sorting and new is_multiple_of lint so both Clippy configurations pass. Validation on the synchronized tree, Windows/Rust 1.98.1, synthetic data: - cargo clippy --workspace --all-targets --locked -- -D warnings: passes. - cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passes. - cargo xtask policy: 179 files pass. - Diagnostics victory-gpu: 191 passed, 6 ignored, 1 excluded, with WARP and D3D12 debug enabled on the current synchronized tree. - Earlier victory-hle validation: 98 unit tests and one integration test passed before the latest upstream affinity changes; current workspace Clippy also checks those changes. - Published branch tree is identical to the locally tested merge; upstream 0b0074e is an ancestor. The excluded depth_bounds_pipeline_loads_and_filters_draws test has an inherited E_INVALIDARG failure at root-signature creation on this machine. The full workspace suite was not rerun for this sync: its GPU shader tests require Shader Model 6.6, unavailable here. No scene/visual/FPS benchmark was performed, so the PR remains a draft. The former 6.0 -> 8.9 FPS upstream window comparison was withdrawn in 0b0074e because draw counts differed. This PR claims no game/FPS improvement. Related overlapping proposals: #71, #154 and #867. AI-assisted code and review; validation ran locally. No game files or derived fixtures are included.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:53:15 +00:00
github-bot closed this pull request 2026-11-26 03:53:15 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.