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

Closed
Demon12377 wants to merge 7 commits from upstream-pr/889 into main
Demon12377 commented 2026-11-25 11:57:25 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Demon12377 on 2026-11-25T11:57:25Z.


Superseded by https://github.com/fxceless/victory-fork/pull/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.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6603936298 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/889). Originally posted by [Demon12377](https://github.com/Demon12377) on 2026-11-25T11:57:25Z. --- Superseded by https://github.com/fxceless/victory-fork/pull/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&#39;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.

Pull request closed

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!888
No description provided.