VICTORY_HOT_AB: switches that flip while the title runs, driven by a file, with per-segment frame times (off by default) #1619

Manually merged
github merged 1 commit from github-bot/gh-1619 into main 2026-11-29 08:21:48 +00:00 AGit
Owner

@⁠Jesper-Andersson on GitHub · 2026-11-28 22:25 UTC · original
Jesper-Andersson:pr/hot-ab → main · +278 −5 · 6 files · 1 commits · merged 2026-11-29 08:16 UTC

Fixes: no open issue (this PR is the claim).

Tested in game: I used VICTORY_HOT_AB in several in-run A/B runs on 2026-11-29, on our fork (not on this PR branch). The log shows the switches flipping as the file says. In one run, victory-nvidia-20261129-013535.log, the file set VICTORY_SUBMIT_DELAY_US to 0, 1000, 1000, 0, 0, 1000, 1000, 0 over eight segments of about 45 s, with the per-segment median and p90 lines. One caveat: a doubled write of the file can give an extra segment starts line about 1 s after the real one, with the same settings (seen there: segment 2 has 0 frames, and segment 3 starts the same settings 1 s later). A tool that reads the log should key segments by their settings, not by their number.

What it changes

Comparing two settings today means two runs, each with its own start, loading and pipeline state, so a few-percent difference drowns in run-to-run noise. This PR adds a diagnostics switch that flips settings inside one run, so an A/B/A/B comparison runs on the same scene and the same process.

  • VICTORY_HOT_AB=<file> (off by default; unset costs one atomic load per present). The file holds VICTORY_NAME=value lines (only VICTORY_* names; # comments and blank lines are skipped). Once a second, at a present, the file's modified time is checked. When it changes, the file's lines replace a process-wide override table (a name that leaves the file goes back to the environment) and a new segment begins. An empty file means defaults. The file is only read, never written.
  • New module crates/victory-gpu/src/hot.rs: hot::over(name) (table only) and hot::var(name) (table, then environment), with unit tests for parsing and the change detection.
  • Switches read through the table where they are used: VICTORY_CARD_WINDOWS_MB (new placements only), VICTORY_POOL_SMALL (new textures only) and VICTORY_CARD_AWAKE (per submission). shadow.rs and pool.rs get one guarded read each; in host/awake.rs the mode match moves into a small local of helper so the read can go through the table (a 17-line refactor, same behaviour when unset). Switches that are read once into a cache, or that change compiled shaders or pipelines, are not hot and are not changed.
  • Log lines: hot-ab: segment <n> starts: NAME=value ... (frame <f>) and hot-ab: segment <n> (<settings>) frames <k> median <ms> p90 <ms>, written every 5 s and when the next segment begins. The first second of a segment is left out.
  • To drive a run: write file A, wait 30 s, write file B, wait 30 s, and so on.

No behaviour changes while the variable is unset.

How this differs from the existing VICTORY_AB (crates/victory-gpu/src/ab.rs, VICTORY_AB=<seconds>,<switch>..., diagnostics feature), which already flips switches on a timer and logs per-phase frame times: VICTORY_HOT_AB is driven by a file written from outside (by hand or a script, at any moment), takes arbitrary values per switch rather than on/off phases, works in release builds (not feature-gated), and replaces a whole set of overrides at once. If the maintainer prefers one mechanism, VICTORY_AB could read the same table instead.

How it was tested

  • GPU and profile: RTX 2070 SUPER 8 GB, Windows 11, Series S, 1080p output, DLSS Performance, no ray tracing.
  • Before: one setting per run.
  • After: unit tests cover the file parser (comments, blanks, non-VICTORY_ names, last value wins, empty values), the mtime-driven reload and var falling back to the environment. The tests write only to the system temp folder. A release build passes. In game: see the "Tested in game" paragraph above.
  • For shader changes, the wave sizes tested: N/A (no translator changes).
  • cargo test passed for the crates it touches: yes (victory-gpu: 554 passed, 43 ignored)
  • cargo clippy --no-deps -p victory-gpu: no new warnings. With -D warnings, clippy stops only on lints that are already on main (victory-gpu host.rs, host/send.rs, pool.rs, resource.rs, streamline.rs, streamline/fsr.rs; victory-shader emit/lower.rs). The warning set is the same as on main (the open #1527 fixes them).
  • cargo xtask policy: fails on upstream main's own crates/victory-shader/src/emit/lower.rs (667,523 bytes, over the 640 KiB limit; #1429; the open #1493 and #1527 fix it). Nothing this PR adds trips it, and the pre-commit asset check passed for every file it changes.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: the existing VICTORY_AB (see above), #1155, #825, #1543, #1544, #1491, #1560, #1564
    • #1560 (per-frame CSV capture) and #1564 (submission/retirement stall tracing) are other measurement aids; they combine with segment-wise A/B.
    • #1155 (title image words held at given values, a fixed world clock for A/B runs) has the same goal of steadier A/B runs, from the title's side. It complements this PR and has no file overlap.
    • #825 (card awake only through frames of many submissions) edits host/awake.rs's mode logic. This PR only wraps the VICTORY_CARD_AWAKE read, so a small textual conflict is possible.
    • #1543, #1544 and #1491 (pool placement) edit pool.rs. This PR adds one guarded line in the VICTORY_POOL_SMALL read. Textual overlap at most.

This was written with AI assistance (Claude Code).

**@⁠Jesper-Andersson** on GitHub · 2026-11-28 22:25 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1619) `Jesper-Andersson:pr/hot-ab` → `main` · +278 −5 · 6 files · 1 commits · merged 2026-11-29 08:16 UTC <!-- Labels: pr-diagnostics, performance (in the title, as the template asks). --> Fixes: no open issue (this PR is the claim). Tested in game: I used `VICTORY_HOT_AB` in several in-run A/B runs on 2026-11-29, on our fork (not on this PR branch). The log shows the switches flipping as the file says. In one run, `victory-nvidia-20261129-013535.log`, the file set `VICTORY_SUBMIT_DELAY_US` to 0, 1000, 1000, 0, 0, 1000, 1000, 0 over eight segments of about 45 s, with the per-segment median and p90 lines. One caveat: a doubled write of the file can give an extra `segment starts` line about 1 s after the real one, with the same settings (seen there: segment 2 has 0 frames, and segment 3 starts the same settings 1 s later). A tool that reads the log should key segments by their settings, not by their number. ## What it changes Comparing two settings today means two runs, each with its own start, loading and pipeline state, so a few-percent difference drowns in run-to-run noise. This PR adds a diagnostics switch that flips settings inside one run, so an A/B/A/B comparison runs on the same scene and the same process. - `VICTORY_HOT_AB=<file>` (off by default; unset costs one atomic load per present). The file holds `VICTORY_NAME=value` lines (only `VICTORY_*` names; `#` comments and blank lines are skipped). Once a second, at a present, the file's modified time is checked. When it changes, the file's lines replace a process-wide override table (a name that leaves the file goes back to the environment) and a new segment begins. An empty file means defaults. The file is only read, never written. - New module `crates/victory-gpu/src/hot.rs`: `hot::over(name)` (table only) and `hot::var(name)` (table, then environment), with unit tests for parsing and the change detection. - Switches read through the table where they are used: `VICTORY_CARD_WINDOWS_MB` (new placements only), `VICTORY_POOL_SMALL` (new textures only) and `VICTORY_CARD_AWAKE` (per submission). `shadow.rs` and `pool.rs` get one guarded read each; in `host/awake.rs` the mode match moves into a small local `of` helper so the read can go through the table (a 17-line refactor, same behaviour when unset). Switches that are read once into a cache, or that change compiled shaders or pipelines, are not hot and are not changed. - Log lines: `hot-ab: segment <n> starts: NAME=value ... (frame <f>)` and `hot-ab: segment <n> (<settings>) frames <k> median <ms> p90 <ms>`, written every 5 s and when the next segment begins. The first second of a segment is left out. - To drive a run: write file A, wait 30 s, write file B, wait 30 s, and so on. No behaviour changes while the variable is unset. How this differs from the existing `VICTORY_AB` (`crates/victory-gpu/src/ab.rs`, `VICTORY_AB=<seconds>,<switch>...`, diagnostics feature), which already flips switches on a timer and logs per-phase frame times: `VICTORY_HOT_AB` is driven by a file written from outside (by hand or a script, at any moment), takes arbitrary values per switch rather than on/off phases, works in release builds (not feature-gated), and replaces a whole set of overrides at once. If the maintainer prefers one mechanism, `VICTORY_AB` could read the same table instead. ## How it was tested - GPU and profile: RTX 2070 SUPER 8 GB, Windows 11, Series S, 1080p output, DLSS Performance, no ray tracing. - Before: one setting per run. - After: unit tests cover the file parser (comments, blanks, non-`VICTORY_` names, last value wins, empty values), the mtime-driven reload and `var` falling back to the environment. The tests write only to the system temp folder. A release build passes. In game: see the "Tested in game" paragraph above. - For shader changes, the wave sizes tested: N/A (no translator changes). - `cargo test` passed for the crates it touches: yes (victory-gpu: 554 passed, 43 ignored) - `cargo clippy --no-deps -p victory-gpu`: no new warnings. With `-D warnings`, clippy stops only on lints that are already on main (victory-gpu `host.rs`, `host/send.rs`, `pool.rs`, `resource.rs`, `streamline.rs`, `streamline/fsr.rs`; victory-shader `emit/lower.rs`). The warning set is the same as on main (the open #1527 fixes them). - `cargo xtask policy`: fails on upstream main's own `crates/victory-shader/src/emit/lower.rs` (667,523 bytes, over the 640 KiB limit; #1429; the open #1493 and #1527 fix it). Nothing this PR adds trips it, and the pre-commit asset check passed for every file it changes. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: the existing `VICTORY_AB` (see above), #1155, #825, #1543, #1544, #1491, #1560, #1564 - #1560 (per-frame CSV capture) and #1564 (submission/retirement stall tracing) are other measurement aids; they combine with segment-wise A/B. - #1155 (title image words held at given values, a fixed world clock for A/B runs) has the same goal of steadier A/B runs, from the title's side. It complements this PR and has no file overlap. - #825 (card awake only through frames of many submissions) edits `host/awake.rs`'s mode logic. This PR only wraps the `VICTORY_CARD_AWAKE` read, so a small textual conflict is possible. - #1543, #1544 and #1491 (pool placement) edit `pool.rs`. This PR adds one guarded line in the `VICTORY_POOL_SMALL` read. Textual overlap at most. This was written with AI assistance (Claude Code).
VICTORY_HOT_AB=<file> (off by default; unset costs one atomic load per present).
The file holds lines NAME=value (VICTORY_* only; # comments, blanks skipped).
At a present, once a second, its mtime is checked; on change the lines replace
a process-wide override table and a new segment begins. New module hot.rs:
hot::over(name) (table only) and hot::var(name) (table, then environment).

Read through the table at use time: VICTORY_CARD_WINDOWS_MB (new placements
only), VICTORY_POOL_SMALL (new textures only), VICTORY_CARD_AWAKE (per
submission). Not hot: VICTORY_INDIRECT_CARD_BUDGET (card buffer made once),
VICTORY_WATER_LIGHT (pipeline creation), VICTORY_NARROW_BARRIERS (read at
several points within one list), translation-key switches. CARD_COMPARE_BATCH
and AMBIENT_LEAN do not exist in this base.

Log lines:
  hot-ab: segment <n> starts: NAME=value ... (frame <f>)
  hot-ab: segment <n> (<settings>) frames <k> median <ms> p90 <ms>
(at segment start+5 s steps, and when the next segment begins; the first
second of a segment is left out).

Drive an ABAB run: write file A, wait 30 s, write file B, wait 30 s, ...
(each write must change the mtime; an empty file means defaults).

This change was made with AI assistance (Claude Code).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 22:30:11 +00:00
github manually merged commit 7edf6b7a52 into main 2026-11-29 08:21:48 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!1619
No description provided.