app: one name for the wave-size override, read in one place #120

Open
xiaotu030202 wants to merge 2 commits from upstream-pr/120 into main
xiaotu030202 commented 2026-11-25 13:06:12 +00:00 (Migrated from github.com)
First-time contributor

Imported from Zettrox/ztrx. Originally posted by xiaotu030202 on 2026-11-25T12:52:35Z.


What this fixes

VICTORY_HOST_MAX_WAVE translates as for a host whose waves have at most that many lanes — the switch that makes an NVIDIA card's refused wave-64 compute programs visible without running the game, as #37 documents in detail. It was read in two places, under two names:

translate.rs   VICTORY_HOST_MAX_WAVE    // #37's, and the one that parses the value
main.rs        VICTORY_HOST_WAVE        // a second spelling, run first

Both ran before any translation, so setting either worked, and setting both let the second overwrite the first. Neither was in the README, so which name to use was only discoverable by reading the source — and the documented one was not the one the command's own pre-pass looked at.

Now there is one name, read where the translation happens. main.rs no longer does it at all, and the comment there says why, so the second spelling does not come back.

Also

translate.rs gained host_max_wave_from_env, and the value handling is tested now. Before, "lots".parse().ok() would silently fall through and "0" would have been accepted — a wave of zero lanes, which is not a wave:

assert_eq!(host_max_wave_from_env(Some("32".into())), Some(32));
assert_eq!(host_max_wave_from_env(Some(" 32 ".into())), Some(32));
assert_eq!(host_max_wave_from_env(None), None);
assert_eq!(host_max_wave_from_env(Some("lots".into())), None);
assert_eq!(host_max_wave_from_env(Some("0".into())), None);
assert_eq!(host_max_wave_from_env(Some("-32".into())), None);

0 reaching set_host_max_wave would have made every wave-64 program look narrowable to 32 lanes, which is worse than the typo it comes from.

README — the switch and VICTORY_WAVE_WHY are now in the debugging table. #37 tells people to use both and the table listed neither.

Verification

Windows 11, RTX 5070 Ti, Rust 1.98.1 (pinned), MSVC 14.44.35207. No game files.

$ cargo test -p victory
test result: ok. 2 passed; 0 failed

$ cargo clippy -p victory --all-targets
clean

$ cargo xtask policy
asset policy: 172 files ok

I did not re-run --workspace to completion for this one: the change is three files in the CLI crate, nothing compiled by the shader or GPU crates is touched, and cargo test -p victory covers it. The earlier workspace runs in this session were 0 failures.

Not changed

victory run does not read the override, and should not: the wave size there comes from the host GPU's own WaveLaneCountMax (host::create), which is the real value. The override exists for victory translate, where no device is created and the card's answer has to be stated.

If #37's author would rather the name were VICTORY_HOST_WAVE (shorter, and what main.rs had), say so and I will flip it — but one of the two had to go, and this kept the one that was written down.


Added: the other two switches the issues point at

VICTORY_TRANSLATE_ONLY and VICTORY_VIEW_LIMIT were not in the README either, and both are switches issue reports tell people to use. They are in the table now, and both value parsers are tested — neither was:

host_max_wave_from_env(Some("32"))   == Some(32)     // and " 32 "
host_max_wave_from_env(Some("lots")) == None
host_max_wave_from_env(Some("0"))    == None         // was accepted

0 used to reach set_host_max_wave(0), where a wave of no lanes reads as every wave-64 program being narrowable to 32 — worse than the typo it comes from, and silent.

translate_only_from_env(Some("2CC4C197, 02384a60")) == ["2cc4c197", "02384a60"]
translate_only_from_env(Some("2cc4c197,"))          == ["2cc4c197"]   // no empty prefix
translate_only_from_env(Some(" , ,"))               == []             // translates everything

The trailing-comma case matters: an empty prefix matches every hash and translates the whole pack while looking like a filter.

Of 138 VICTORY_* names, 125 are undocumented

Most are experiment switches for one code path and listing them all would make the table useless. These three were chosen because issue reports already tell people to use them. If a wider set is worth writing down, that is a judgement about which experiments outlived their experiment.


Added: the memory and texture switches the log points at

shadow.rs builds its per-frame hint from the variable it actually reads:

... of them {n} MB in copies of 1 MiB or more
    (VICTORY_CARD_BUFFERS_MIN_MB=1 would have the card look there)

The message is right, and it is the only place the name appears. #143 read it, set VICTORY_CARD_BUFFERS_MIN=1 — without the _MB — and reported that it made no difference. It could not have.

Four switches are in the table now:

switch what it is
VICTORY_CARD_BUFFERS_MIN_MB (16) copies smaller than this stay on the CPU; 1 sends everything ≥ 1 MiB to the card
VICTORY_CARD_BUFFERS_MB (512) the total those copies may hold
VICTORY_TEXTURE_BUDGET_MB a limit on the bytes of texture copies, instead of the default rule (a floor, then nine tenths of what the system gives the process)
VICTORY_TEXTURE_GUARD=0 hash view-memory textures every check instead of every eighth frame

The first row says in as many words that VICTORY_CARD_BUFFERS_MIN is not a variable this build reads, because that is exactly the mistake a reader of that log line makes. Documenting the right name without naming the wrong one would leave the same trap.

cargo xtask policy is 172 files ok — the asset policy covers README.md too, so this is checked rather than assumed.

Where this sits

Same PR as the VICTORY_HOST_MAX_WAVE fix, because both are the same failure mode: a switch people are told to use by a log line, that the README does not list. The wave one had two spellings in the code; this one had none in the documentation. Splitting them into two PRs would separate two halves of one problem.

Still not documenting all of them: 125 of 138 VICTORY_* names in the tree are absent from the README, and most are single-path experiment switches. The four here were chosen because a log line or an issue report points a user at them.

<!-- greyfinch-sync:Zettrox/ztrx:issue:6604912250 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/120). Originally posted by [xiaotu030202](https://github.com/xiaotu030202) on 2026-11-25T12:52:35Z. --- ## What this fixes `VICTORY_HOST_MAX_WAVE` translates as for a host whose waves have at most that many lanes — the switch that makes an NVIDIA card's refused wave-64 compute programs visible **without running the game**, as #37 documents in detail. It was read in two places, under two names: ```rust translate.rs VICTORY_HOST_MAX_WAVE // #37's, and the one that parses the value main.rs VICTORY_HOST_WAVE // a second spelling, run first ``` Both ran before any translation, so setting either worked, and setting both let the second overwrite the first. **Neither was in the README**, so which name to use was only discoverable by reading the source — and the documented one was not the one the command's own pre-pass looked at. Now there is one name, read where the translation happens. `main.rs` no longer does it at all, and the comment there says why, so the second spelling does not come back. ## Also `translate.rs` gained `host_max_wave_from_env`, and the value handling is tested now. Before, `"lots".parse().ok()` would silently fall through and `"0"` would have been accepted — a wave of zero lanes, which is not a wave: ```rust assert_eq!(host_max_wave_from_env(Some("32".into())), Some(32)); assert_eq!(host_max_wave_from_env(Some(" 32 ".into())), Some(32)); assert_eq!(host_max_wave_from_env(None), None); assert_eq!(host_max_wave_from_env(Some("lots".into())), None); assert_eq!(host_max_wave_from_env(Some("0".into())), None); assert_eq!(host_max_wave_from_env(Some("-32".into())), None); ``` `0` reaching `set_host_max_wave` would have made every wave-64 program look narrowable to 32 lanes, which is worse than the typo it comes from. **README** — the switch and `VICTORY_WAVE_WHY` are now in the debugging table. #37 tells people to use both and the table listed neither. ## Verification Windows 11, RTX 5070 Ti, Rust 1.98.1 (pinned), MSVC 14.44.35207. **No game files.** ``` $ cargo test -p victory test result: ok. 2 passed; 0 failed $ cargo clippy -p victory --all-targets clean $ cargo xtask policy asset policy: 172 files ok ``` I did not re-run `--workspace` to completion for this one: the change is three files in the CLI crate, nothing compiled by the shader or GPU crates is touched, and `cargo test -p victory` covers it. The earlier workspace runs in this session were 0 failures. ## Not changed `victory run` does not read the override, and should not: the wave size there comes from the host GPU's own `WaveLaneCountMax` (`host::create`), which is the real value. The override exists for `victory translate`, where no device is created and the card's answer has to be stated. If #37's author would rather the name were `VICTORY_HOST_WAVE` (shorter, and what `main.rs` had), say so and I will flip it — but one of the two had to go, and this kept the one that was written down. --- ## Added: the other two switches the issues point at `VICTORY_TRANSLATE_ONLY` and `VICTORY_VIEW_LIMIT` were not in the README either, and both are switches issue reports tell people to use. They are in the table now, and both value parsers are tested — neither was: ```rust host_max_wave_from_env(Some("32")) == Some(32) // and " 32 " host_max_wave_from_env(Some("lots")) == None host_max_wave_from_env(Some("0")) == None // was accepted ``` `0` used to reach `set_host_max_wave(0)`, where a wave of no lanes reads as every wave-64 program being narrowable to 32 — worse than the typo it comes from, and silent. ```rust translate_only_from_env(Some("2CC4C197, 02384a60")) == ["2cc4c197", "02384a60"] translate_only_from_env(Some("2cc4c197,")) == ["2cc4c197"] // no empty prefix translate_only_from_env(Some(" , ,")) == [] // translates everything ``` The trailing-comma case matters: an empty prefix matches every hash and translates the whole pack while looking like a filter. ## Of 138 `VICTORY_*` names, 125 are undocumented Most are experiment switches for one code path and listing them all would make the table useless. These three were chosen because issue reports already tell people to use them. If a wider set is worth writing down, that is a judgement about which experiments outlived their experiment. --- ## Added: the memory and texture switches the log points at `shadow.rs` builds its per-frame hint from the variable it actually reads: ``` ... of them {n} MB in copies of 1 MiB or more (VICTORY_CARD_BUFFERS_MIN_MB=1 would have the card look there) ``` The message is right, and it is the **only** place the name appears. #143 read it, set `VICTORY_CARD_BUFFERS_MIN=1` — without the `_MB` — and reported that it made no difference. It could not have. Four switches are in the table now: | switch | what it is | |---|---| | `VICTORY_CARD_BUFFERS_MIN_MB` (16) | copies smaller than this stay on the CPU; `1` sends everything ≥ 1 MiB to the card | | `VICTORY_CARD_BUFFERS_MB` (512) | the total those copies may hold | | `VICTORY_TEXTURE_BUDGET_MB` | a limit on the bytes of texture copies, instead of the default rule (a floor, then nine tenths of what the system gives the process) | | `VICTORY_TEXTURE_GUARD=0` | hash view-memory textures every check instead of every eighth frame | The first row says in as many words that **`VICTORY_CARD_BUFFERS_MIN` is not a variable this build reads**, because that is exactly the mistake a reader of that log line makes. Documenting the right name without naming the wrong one would leave the same trap. `cargo xtask policy` is 172 files ok — the asset policy covers `README.md` too, so this is checked rather than assumed. ## Where this sits Same PR as the `VICTORY_HOST_MAX_WAVE` fix, because both are the same failure mode: **a switch people are told to use by a log line, that the README does not list**. The wave one had two spellings in the code; this one had none in the documentation. Splitting them into two PRs would separate two halves of one problem. Still not documenting all of them: 125 of 138 `VICTORY_*` names in the tree are absent from the README, and most are single-path experiment switches. The four here were chosen because a log line or an issue report points a user at them.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/120:upstream-pr/120'
git switch 'upstream-pr/120'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/120'
git switch 'upstream-pr/120'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/120'
git switch 'upstream-pr/120'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/120'
git switch 'main'
git merge --squash 'upstream-pr/120'
git switch 'main'
git merge --ff-only 'upstream-pr/120'
git switch 'main'
git merge 'upstream-pr/120'
git push origin 'main'
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
Zettrox/ztrx!120
No description provided.