Add opt-in native gathers for card-step reads #3614

Closed
masteraapjes wants to merge 1 commit from upstream-pr/3614 into main
masteraapjes commented 2026-11-30 01:43:11 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by masteraapjes on 2026-11-30T01:43:11Z.


What it changes

Add experimental VICTORY_CARD_GATHER=1 to replace eligible read-side card-step copies with a native compute gather into the existing intermediate buffer. Preserve copy-outs, dependency levels, current upstream scoped UAV barriers and fallback copies. The switch remains off by default.

Admission checks resource capabilities, alignment, bounds, aliasing and destination overlap, plus the 32-reads-per-source threshold and early source-count budget. Hold uploads and sources through the recording list’s flight. Retain later mixed-level WARP/debug parity coverage.

Rebuilt independently on upstream main 5fabb46eaf6ed8771321787f8871051abde69b9b to resolve the conflict after upstream history changed. Obsolete shared CI commits have been removed from the PR diff. Current upstream changes are retained.

How it was tested

Windows, pinned Rust 1.98.1. Tested head: a2b9a2d31bf4b24a59ab56d89db79bf93f6bb166.

  • With VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1, cargo test --locked -j 2 -p victory-gpu --lib --features diagnostics host::card_steps::gather:: -- --test-threads=1 --nocapture: 8 passed, 2 ignored benchmarks.
  • With the same WARP/debug environment, cargo test --locked -j 2 -p victory-gpu --lib --features diagnostics native_card_gather_preserves -- --test-threads=1 --nocapture: 2 passed. Confirmed software WARP adapter and active debug queue.
  • Both scoped strict GPU Clippy commands ran and stopped solely on the five unchanged upstream errors listed below:
    • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings
    • cargo clippy --locked -p victory-gpu --all-targets --all-features -- -D warnings
  • cargo run --locked --package xtask -- policy: 467 files passed. git diff --check passed.

Current upstream CI blocker, independently reproduced on unmodified main 5fabb46e: both cargo clippy --workspace --all-targets --locked -- -D warnings and cargo clippy --workspace --all-targets --all-features --locked -- -D warnings exit 101 with five errors in host/font.rs:213/260, host/menu.rs:667 and host/panel.rs:602/668. Existing #4679 addresses these. No unrelated fixes or lint suppressions are carried here. This is not a claim that the latest CI check job passed.

Authored synthetic fixtures only. No fresh timing benchmarks or controlled gather-only gameplay comparison were run; net gameplay benefit remains unestablished. The HLSL helper uses 64 threads per group without assuming hardware wave width. The full workspace test suite was not rerun for this conflict-resolution update. No game data is included.

Checked for overlap

  • Rechecked current main and targeted open-PR searches alongside the earlier overlap review. Related #2606 scopes UAV barriers (its current-main policy is retained) and #2812 changes dependency planning. Shader texture-gather #3369 concerns a different operation.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5557483843 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3614). Originally posted by [masteraapjes](https://github.com/masteraapjes) on 2026-11-30T01:43:11Z. --- ## What it changes Add experimental `VICTORY_CARD_GATHER=1` to replace eligible read-side card-step copies with a native compute gather into the existing intermediate buffer. Preserve copy-outs, dependency levels, current upstream scoped UAV barriers and fallback copies. The switch remains off by default. Admission checks resource capabilities, alignment, bounds, aliasing and destination overlap, plus the 32-reads-per-source threshold and early source-count budget. Hold uploads and sources through the recording list’s flight. Retain later mixed-level WARP/debug parity coverage. Rebuilt independently on upstream main `5fabb46eaf6ed8771321787f8871051abde69b9b` to resolve the conflict after upstream history changed. Obsolete shared CI commits have been removed from the PR diff. Current upstream changes are retained. ## How it was tested Windows, pinned Rust 1.98.1. Tested head: `a2b9a2d31bf4b24a59ab56d89db79bf93f6bb166`. - With `VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1`, `cargo test --locked -j 2 -p victory-gpu --lib --features diagnostics host::card_steps::gather:: -- --test-threads=1 --nocapture`: 8 passed, 2 ignored benchmarks. - With the same WARP/debug environment, `cargo test --locked -j 2 -p victory-gpu --lib --features diagnostics native_card_gather_preserves -- --test-threads=1 --nocapture`: 2 passed. Confirmed software WARP adapter and active debug queue. - Both scoped strict GPU Clippy commands ran and stopped solely on the five unchanged upstream errors listed below: - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` - `cargo clippy --locked -p victory-gpu --all-targets --all-features -- -D warnings` - `cargo run --locked --package xtask -- policy`: 467 files passed. `git diff --check` passed. Current upstream CI blocker, independently reproduced on unmodified main `5fabb46e`: both `cargo clippy --workspace --all-targets --locked -- -D warnings` and `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` exit 101 with five errors in `host/font.rs:213/260`, `host/menu.rs:667` and `host/panel.rs:602/668`. Existing [#4679](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4679) addresses these. No unrelated fixes or lint suppressions are carried here. This is not a claim that the latest CI `check` job passed. Authored synthetic fixtures only. No fresh timing benchmarks or controlled gather-only gameplay comparison were run; net gameplay benefit remains unestablished. The HLSL helper uses 64 threads per group without assuming hardware wave width. The full workspace test suite was not rerun for this conflict-resolution update. No game data is included. ## Checked for overlap - [x] Rechecked current main and targeted open-PR searches alongside the earlier overlap review. Related #2606 scopes UAV barriers (its current-main policy is retained) and #2812 changes dependency planning. Shader texture-gather #3369 concerns a different operation.
nicolasabosch commented 2026-11-30 23:19:19 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nicolasabosch on 2026-11-30T23:19:19Z.


Tested on an RTX 4070 Laptop 8 GB with VICTORY_CARD_GATHER=1: no measurable fps difference in this scene (2 runs).

What was built

  • Main e1251c31 with four opt-in PRs merged together and nothing else changed: #4069, #3757, #3614 and #4206. This PR's head was f377fe31.
  • Release build, same profile as main.
  • Every switch was off except the one under test. The combined build with all switches off is the control.

Setup

  • PC: RTX 4070 Laptop 8 GB, i9-14900HX, 32 GB RAM, Windows 11.
  • Command: victory play --series-s --dlss performance --framegen 2, with no fps cap and the window minimized.
  • Route: scripted Enter presses into the world from a fixed copy of a save, then the character idles there for 300 s.
  • fps is the mean of the last 40 host: reports, about 200 s. These are real frames, not generated ones.
run fps ms/frame submit thread ms refreshes ms
main, 5 runs 15.94 – 16.41 61.0 – 62.8 38.4 – 40.5 14.2 – 15.2
combined build, switches off, run 1 16.45 60.8 35.4 12.4
combined build, switches off, run 2 16.93 59.2 37.3 13.9
VICTORY_CARD_GATHER=1, run 1 16.41 66.4 42.5 13.3
VICTORY_CARD_GATHER=1, run 2 16.39 61.1 35.1 12.6

On this laptop, identical runs differ by about 0.5–1 fps, so only an effect of roughly 1.5 fps or more would show.

In this scene the frame (~60 ms) is longer than the submit thread's own work (~33–40 ms), so a gain on the submit thread alone may not reach the fps here. Run 1 had a rougher stretch: the spread between reports was 2.2 fps, against about 0.6 in the other runs, and the mean frame time was 66 ms. Its fps mean did not change, and run 2 was smooth.

Not tested: driving, camera turns, interiors, an image comparison, other GPUs.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7294978825 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3614#issuecomment-7294978825). Originally posted by [nicolasabosch](https://github.com/nicolasabosch) on 2026-11-30T23:19:19Z. --- **Tested on an RTX 4070 Laptop 8 GB with `VICTORY_CARD_GATHER=1`: no measurable fps difference in this scene (2 runs).** **What was built** - Main `e1251c31` with four opt-in PRs merged together and nothing else changed: #4069, #3757, #3614 and #4206. This PR's head was `f377fe31`. - Release build, same profile as main. - Every switch was off except the one under test. The combined build with all switches off is the control. **Setup** - PC: RTX 4070 Laptop 8 GB, i9-14900HX, 32 GB RAM, Windows 11. - Command: `victory play --series-s --dlss performance --framegen 2`, with no fps cap and the window minimized. - Route: scripted Enter presses into the world from a fixed copy of a save, then the character idles there for 300 s. - fps is the mean of the last 40 `host:` reports, about 200 s. These are real frames, not generated ones. | run | fps | ms/frame | submit thread ms | refreshes ms | |---|---|---|---|---| | main, 5 runs | 15.94 – 16.41 | 61.0 – 62.8 | 38.4 – 40.5 | 14.2 – 15.2 | | combined build, switches off, run 1 | 16.45 | 60.8 | 35.4 | 12.4 | | combined build, switches off, run 2 | 16.93 | 59.2 | 37.3 | 13.9 | | VICTORY_CARD_GATHER=1, run 1 | 16.41 | 66.4 | 42.5 | 13.3 | | VICTORY_CARD_GATHER=1, run 2 | 16.39 | 61.1 | 35.1 | 12.6 | On this laptop, identical runs differ by about 0.5–1 fps, so only an effect of roughly 1.5 fps or more would show. In this scene the frame (~60 ms) is longer than the submit thread's own work (~33–40 ms), so a gain on the submit thread alone may not reach the fps here. Run 1 had a rougher stretch: the spread between reports was 2.2 fps, against about 0.6 in the other runs, and the mean frame time was 66 ms. Its fps mean did not change, and run 2 was smooth. **Not tested:** driving, camera turns, interiors, an image comparison, other GPUs.
trustno1-coder commented 2026-12-01 18:50:29 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:50:29Z.


Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7321650823 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3614#issuecomment-7321650823). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:50:29Z. --- Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

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
trustno1-coder/VIctory-NVIDIA!3614
No description provided.