Reduce write tracking and parallel refresh overhead #3694

Closed
edge2labs wants to merge 1 commit from upstream-pr/3694 into main
edge2labs commented 2026-11-30 04:12:29 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by edge2labs on 2026-11-30T04:12:29Z.


Following your feedback, Phase 2 focuses on the submitting thread's write tracking bottleneck.

Two opt-in optimizations:

  • VICTORY_REFRESH_GRAIN=16
  • VICTORY_ASK_ONCE_GAP_MIB=0

Synthetic benchmark results on i9-14900K:

  • Kernel query time reduced by 56.29%.
  • Memory refresh time reduced by up to 27.57%.
  • Total workload time reduced by 17.86% without CPU load and 20.32% under load.
  • Up to 4.58 ms recovered.
  • All 12 paired comparisons improved.

Validation: 340 correctness test executions passed, 24 benchmarks passed, and Release and Diagnostics builds succeeded.

Default behavior remains unchanged. The previously acknowledged asset-policy issue remains unrelated to this PR.

These are synthetic results, not measured FPS gains. Please test both flags enabled in-game without frame generation and report FPS and write tracking costs.

Thank you for your feedback.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5558839867 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3694). Originally posted by [edge2labs](https://github.com/edge2labs) on 2026-11-30T04:12:29Z. --- Following your feedback, Phase 2 focuses on the submitting thread's write tracking bottleneck. Two opt-in optimizations: - VICTORY_REFRESH_GRAIN=16 - VICTORY_ASK_ONCE_GAP_MIB=0 Synthetic benchmark results on i9-14900K: - Kernel query time reduced by 56.29%. - Memory refresh time reduced by up to 27.57%. - Total workload time reduced by 17.86% without CPU load and 20.32% under load. - Up to 4.58 ms recovered. - All 12 paired comparisons improved. Validation: 340 correctness test executions passed, 24 benchmarks passed, and Release and Diagnostics builds succeeded. Default behavior remains unchanged. The previously acknowledged asset-policy issue remains unrelated to this PR. These are synthetic results, not measured FPS gains. Please test both flags enabled in-game without frame generation and report FPS and write tracking costs. Thank you for your feedback.
davemathews12 commented 2026-11-30 05:26:55 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by davemathews12 on 2026-11-30T05:26:55Z.


I read through it and the changes look correct:

  • VICTORY_ASK_ONCE_GAP_MIB uses the same units as AHEAD_GAP: (mib << 20) / PAGE, where PAGE is 64 KiB here. Unset or out-of-range values keep the 8 MiB default, and 0 merges only touching ranges, as the doc says.
  • VICTORY_REFRESH_GRAIN is bounded to 1..=256, and when it is unset the old 8/1 grains are kept.
  • The rest is test-only (benchmark harness, profiling hooks behind cfg(test) / cfg(all(test, feature = "diagnostics"))).

One thing worth adding: with both knobs unset, the runtime behaves exactly as on main, so the PR doesn't reduce overhead for anyone yet. If you have numbers from the new harness showing which gap and grain values help (and on which CPU), posting them here would let a better default ship.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7269677810 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3694#issuecomment-7269677810). Originally posted by [davemathews12](https://github.com/davemathews12) on 2026-11-30T05:26:55Z. --- I read through it and the changes look correct: - `VICTORY_ASK_ONCE_GAP_MIB` uses the same units as `AHEAD_GAP`: `(mib << 20) / PAGE`, where `PAGE` is 64 KiB here. Unset or out-of-range values keep the 8 MiB default, and 0 merges only touching ranges, as the doc says. - `VICTORY_REFRESH_GRAIN` is bounded to 1..=256, and when it is unset the old 8/1 grains are kept. - The rest is test-only (benchmark harness, profiling hooks behind `cfg(test)` / `cfg(all(test, feature = "diagnostics"))`). One thing worth adding: with both knobs unset, the runtime behaves exactly as on `main`, so the PR doesn't reduce overhead for anyone yet. If you have numbers from the new harness showing which gap and grain values help (and on which CPU), posting them here would let a better default ship.
edge2labs commented 2026-11-30 06:24:07 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by edge2labs on 2026-11-30T06:24:07Z.


Thanks for reviewing the changes!

You’re absolutely right. I intentionally preserved the existing defaults until we had enough evidence to justify changing them.

I tested both parameters extensively on the following system:

  • Intel Core i9-14900K (24 cores, 32 threads)
  • RTX 4080 Super
  • 64 GB RAM
  • Windows
  • Baseline: v2026.11.29.05 (41adb551)

Refresh grain sweep — median refresh time:

Grain Time
Original 16.87 ms
1 16.91 ms
4 15.98 ms
8 12.79 ms
16 12.45 ms
32 12.55 ms

Ask-once gap sweep — median refresh time:

Gap Time
0 MiB 10.11 ms
4 MiB 11.13 ms
8 MiB 12.38 ms
16 MiB 15.32 ms
32 MiB 19.29 ms
64 MiB 22.47 ms

The initial gap sweep improved refresh time but did not consistently improve total wall time because of the landing workload.

After refining the harness to use the existing persistent landing worker and pool, I validated the combined configuration:

VICTORY_REFRESH_GRAIN=16
VICTORY_ASK_ONCE_GAP_MIB=0

Final synthetic wall-time results:

CPU load threads Holes Baseline Optimized Reduction
0 No 20.0678 ms 16.4844 ms 17.86%
0 Yes 19.6773 ms 16.2449 ms 17.44%
12 No 23.1163 ms 18.6761 ms 19.21%
12 Yes 22.5487 ms 17.9678 ms 20.32%

Validation:

  • 24/24 final benchmark runs passed.
  • 12/12 paired comparisons favored the optimized configuration.
  • All landing bytes matched.
  • 340 passing correctness test executions, zero failures, 12 ignored, across four parameter configurations.
  • Release and diagnostics builds succeeded.
  • Up to 56.29% reduction in submit-thread kernel query time.

These are synthetic measurements, not in-game FPS results.

Based on this evidence, grain 16 and gap 0 are my preferred candidates for new defaults. However, I would like to confirm their behavior on other CPU architectures and in actual gameplay before making them universal.

Would you recommend an in-game A/B validation first, or would you prefer that I update the PR with these defaults?

I can also provide the detailed benchmark logs.

Thanks again for the technical review!

— Edge2Labs

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7270610763 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3694#issuecomment-7270610763). Originally posted by [edge2labs](https://github.com/edge2labs) on 2026-11-30T06:24:07Z. --- Thanks for reviewing the changes! You’re absolutely right. I intentionally preserved the existing defaults until we had enough evidence to justify changing them. I tested both parameters extensively on the following system: * Intel Core i9-14900K (24 cores, 32 threads) * RTX 4080 Super * 64 GB RAM * Windows * Baseline: v2026.11.29.05 (41adb551) Refresh grain sweep — median refresh time: Grain Time Original 16.87 ms 1 16.91 ms 4 15.98 ms 8 12.79 ms 16 12.45 ms 32 12.55 ms Ask-once gap sweep — median refresh time: Gap Time 0 MiB 10.11 ms 4 MiB 11.13 ms 8 MiB 12.38 ms 16 MiB 15.32 ms 32 MiB 19.29 ms 64 MiB 22.47 ms The initial gap sweep improved refresh time but did not consistently improve total wall time because of the landing workload. After refining the harness to use the existing persistent landing worker and pool, I validated the combined configuration: VICTORY_REFRESH_GRAIN=16 VICTORY_ASK_ONCE_GAP_MIB=0 Final synthetic wall-time results: CPU load threads Holes Baseline Optimized Reduction 0 No 20.0678 ms 16.4844 ms 17.86% 0 Yes 19.6773 ms 16.2449 ms 17.44% 12 No 23.1163 ms 18.6761 ms 19.21% 12 Yes 22.5487 ms 17.9678 ms 20.32% Validation: * 24/24 final benchmark runs passed. * 12/12 paired comparisons favored the optimized configuration. * All landing bytes matched. * 340 passing correctness test executions, zero failures, 12 ignored, across four parameter configurations. * Release and diagnostics builds succeeded. * Up to 56.29% reduction in submit-thread kernel query time. These are synthetic measurements, not in-game FPS results. Based on this evidence, grain 16 and gap 0 are my preferred candidates for new defaults. However, I would like to confirm their behavior on other CPU architectures and in actual gameplay before making them universal. Would you recommend an in-game A/B validation first, or would you prefer that I update the PR with these defaults? I can also provide the detailed benchmark logs. Thanks again for the technical review! — Edge2Labs
davemathews12 commented 2026-11-30 15:45:23 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by davemathews12 on 2026-11-30T15:45:23Z.


Thanks for the numbers. Grain 16 taking the refresh from 16.87 to 12.45 ms is a clear signal. I'd do the in-game A/B first, before changing the defaults: the defaults apply to everyone, and the numbers so far are synthetic. DoubleD17's method on #3524 is a good template. Several 150 s runs of the PR and main in ABBA order on a fixed CPU-bound view, comparing CPU preparation time, fps, and a quick look for visual glitches. With VICTORY_REFRESH_GRAIN=16 VICTORY_ASK_ONCE_GAP_MIB=0 against unset, on your 14900K plus one other CPU (ideally one with 6–8 cores), that would make the case for new defaults hard to argue with.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7283529199 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3694#issuecomment-7283529199). Originally posted by [davemathews12](https://github.com/davemathews12) on 2026-11-30T15:45:23Z. --- Thanks for the numbers. Grain 16 taking the refresh from 16.87 to 12.45 ms is a clear signal. I'd do the in-game A/B first, before changing the defaults: the defaults apply to everyone, and the numbers so far are synthetic. DoubleD17's method on #3524 is a good template. Several 150 s runs of the PR and `main` in ABBA order on a fixed CPU-bound view, comparing CPU preparation time, fps, and a quick look for visual glitches. With `VICTORY_REFRESH_GRAIN=16 VICTORY_ASK_ONCE_GAP_MIB=0` against unset, on your 14900K plus one other CPU (ideally one with 6–8 cores), that would make the case for new defaults hard to argue with.
trustno1-coder commented 2026-12-01 18:49:50 +00:00 (Migrated from github.com)

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


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:7321629504 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3694#issuecomment-7321629504). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:49:50Z. --- 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!3694
No description provided.