gpu: scale the page budgets with the card's memory #78

Manually merged
github merged 1 commit from github-bot/gh-77 into main 2026-12-05 00:30:42 +00:00 AGit
Owner

@⁠SovietBearz0r on GitHub · 2026-12-05 00:11 UTC · original
SovietBearz0r:vram-headroom → main · +115 −9 · 1 files · 1 commits · merged 2026-12-05 00:27 UTC

Scales the address-indexed memory budgets with the card, ported from MiniVI's most_pages_for / spare_pages_for / fault_pages_for.

Before, three page budgets were fixed at a big card's limits; on a small card that is memory the title's ray-traced structures take from everything else:

budget ≤ 6 GiB card ≤ 9 GiB card above 9 GiB
pages of title memory held (was 3 GiB always) 512 MiB 1,024 MiB 3 GiB
free pages a recorded list needs (was 1,024) 256 256 1,024
pages the arena holds from faults (was 128 MiB always) 128 MiB 256 MiB 512 MiB

Overrides: VICTORY_RT_MEMORY_MB (256–3,072 MiB) for the held pages, VICTORY_BVH_FAULTS_ALL (pages) for the fault budget. Above 9 GiB the fault budget is now 512 MiB rather than 128 MiB, as in the fork — the switch takes it back if unwanted.

The render-target side needed nothing: resource::targets_room_kept already keeps at most a quarter of the card's budget for render targets and settles it down (targets_kept), which is the other half of MiniVI's change.

Verified

  • Unit tests for the tiers and edges (6 GiB and 9 GiB are in the small tier; an unknown card keeps the old limits; overrides clamp to 256–3,072 MiB for the held pages and to the 3 GiB maximum for faults).
  • cargo test -p victory-gpu --lib -- --test-threads=1: 700 passed, 21 ignored.
  • Clippy -D warnings clean for victory-gpu and victory; cargo xtask policy ok.
  • Branched from current origin/main.

Not exercised in-game: the machine here has a 16 GiB card, whose tiers are the old limits (bar the fault budget); small-card behaviour is unit-tested.

**@⁠SovietBearz0r** on GitHub · 2026-12-05 00:11 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/77) `SovietBearz0r:vram-headroom` → `main` · +115 −9 · 1 files · 1 commits · merged 2026-12-05 00:27 UTC Scales the address-indexed memory budgets with the card, ported from MiniVI's `most_pages_for` / `spare_pages_for` / `fault_pages_for`. Before, three page budgets were fixed at a big card's limits; on a small card that is memory the title's ray-traced structures take from everything else: | budget | ≤ 6 GiB card | ≤ 9 GiB card | above 9 GiB | |---|---|---|---| | pages of title memory held (was 3 GiB always) | 512 MiB | 1,024 MiB | 3 GiB | | free pages a recorded list needs (was 1,024) | 256 | 256 | 1,024 | | pages the arena holds from faults (was 128 MiB always) | 128 MiB | 256 MiB | 512 MiB | Overrides: `VICTORY_RT_MEMORY_MB` (256–3,072 MiB) for the held pages, `VICTORY_BVH_FAULTS_ALL` (pages) for the fault budget. Above 9 GiB the fault budget is now 512 MiB rather than 128 MiB, as in the fork — the switch takes it back if unwanted. The render-target side needed nothing: `resource::targets_room_kept` already keeps at most a quarter of the card's budget for render targets and settles it down (`targets_kept`), which is the other half of MiniVI's change. **Verified** - Unit tests for the tiers and edges (6 GiB and 9 GiB are in the small tier; an unknown card keeps the old limits; overrides clamp to 256–3,072 MiB for the held pages and to the 3 GiB maximum for faults). - `cargo test -p victory-gpu --lib -- --test-threads=1`: **700 passed, 21 ignored**. - Clippy `-D warnings` clean for `victory-gpu` and `victory`; `cargo xtask policy` ok. - Branched from current `origin/main`. Not exercised in-game: the machine here has a 16 GiB card, whose tiers are the old limits (bar the fault budget); small-card behaviour is unit-tested.
The pages of title memory by address, the free pages a list needs, and
the pages the arena holds from faults were fixed at a big card's limits
(3 GiB, 1,024 pages, 128 MiB). They now follow the card, as MiniVI
found for 8 GiB cards:

- pages held: 512 MiB up to 6 GiB of card memory, 1,024 MiB up to
  9 GiB, else 3 GiB (VICTORY_RT_MEMORY_MB overrides, 256-3,072 MiB);
- free pages for a list: 256 up to 9 GiB, else 1,024;
- pages held from faults: 128 MiB up to 6 GiB, 256 MiB up to 9 GiB,
  else 512 MiB (VICTORY_BVH_FAULTS_ALL overrides). On a card above
  9 GiB that is more than the 128 MiB it was, as in the fork: the
  switch takes it back.

The render targets' kept room was already the card's budget over four
(resource.rs targets_room_kept), with the settle decay, so that half of
the fork's change was in main.

Ported from MiniVI's most_pages_for / spare_pages_for / fault_pages_for.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 00:14:21 +00:00
github-bot force-pushed github-bot/gh-77 from ac5c8e16b4 to 6261a707b7 2026-12-05 00:30:41 +00:00 Compare
github manually merged commit 8f78f14a7b into main 2026-12-05 00:30:41 +00:00
Author
Owner

@⁠ReTerryDavis on GitHub · 2026-12-05 00:27 UTC · original

Fixed two literal \n escapes in doc comments in crates/victory-gpu/src/memory.rs, verified with cargo clippy -p victory-gpu -p victory --all-targets (default + --all-features), cargo test -p victory-gpu --lib headroom_tests, and cargo run -p xtask -- policy. Merging now — thanks!

**@⁠ReTerryDavis** on GitHub · 2026-12-05 00:27 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/77#issuecomment-7428270388) Fixed two literal `\n` escapes in doc comments in `crates/victory-gpu/src/memory.rs`, verified with `cargo clippy -p victory-gpu -p victory --all-targets` (default + `--all-features`), `cargo test -p victory-gpu --lib headroom_tests`, and `cargo run -p xtask -- policy`. Merging now — thanks!
This discussion has been locked. Commenting is limited to contributors.
No description provided.