gpu: opt-in shared-memory pressure reaction (VICTORY_SEGMENT_TIGHT, review fixes) #161

Open
github-bot wants to merge 1 commit from github-bot/gh-160 into main AGit
Owner

@⁠SovietBearz0r on GitHub · 2026-12-05 18:27 UTC · original
SovietBearz0r:razda-segment-tight → main · +266 −1 · 2 files · 1 commits · open

Replaces the closed #103 with the review fixed: strictly off by default, and the hot-submit synchronous-drain problem removed.

Maintainer points addressed

  • Default-ON → strictly off: only an explicit VICTORY_SEGMENT_TIGHT=1..=100 arms it (unwrap_or(92) gone); unset/0/invalid are off, and when off the function returns before any clock read or DXGI video_memory() query. README: off by default, 92 design point, 85 for the 8 GB safe preset, 0 disables, frame-time data on a spilling GPU is the gate.
  • settle on every send_late removed: while latched tight the settle happens at most once per 250 ms and never twice for one submission; other submissions trim idle lists/preludes (no GPU wait) and pipeline normally. One-per-crossing log line kept (with shared MB/budget and threshold).
  • Hot path: DXGI query only when armed and the 100 ms window elapsed; hysteresis kept (armed at pct, recovered below pct−10; zero budget cannot falsely recover). Sampling + rate limit are a pure, unit-tested state machine (pct, sample, react).
  • BOM restored on host.rs (no reformat otherwise).

Verification

  • cargo test -p victory-gpu --lib: 719 passed, 0 failed, 21 ignored (+3: default-off, hysteresis, rate-limit incl. 10 submissions in one window → 1 settle); clippy -D warnings default and --all-features clean; cargo xtask policy 442 files; cargo test -p xtask 9; git diff --check.
  • Still the gate: no in-game soak on a spilling 8–12 GB card. Request: A/B frame times unset vs =92 vs =85, watch the two crossing lines and settle counts. If you'd rather keep it out of tree until such a run exists, the branch is ready.
  • Risks: up to 4 synchronous drains/s while latched tight (250 ms is a compromise pending soak data); the tight settle is accounted as WHY_MOST in LATE_STATS; armed sampling still queries video_memory() at ≤10 Hz on the submitting thread; zero shared budget keeps it conservatively latched.

Supersedes #103 (closed); branch force-pushed 6096c210.

**@⁠SovietBearz0r** on GitHub · 2026-12-05 18:27 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/160) `SovietBearz0r:razda-segment-tight` → `main` · +266 −1 · 2 files · 1 commits · open Replaces the closed #103 with the review fixed: strictly off by default, and the hot-submit synchronous-drain problem removed. ## Maintainer points addressed - **Default-ON → strictly off:** only an explicit `VICTORY_SEGMENT_TIGHT=1..=100` arms it (`unwrap_or(92)` gone); unset/`0`/invalid are off, and when off the function returns before any clock read or DXGI `video_memory()` query. README: off by default, 92 design point, 85 for the 8 GB safe preset, `0` disables, frame-time data on a spilling GPU is the gate. - **`settle` on every `send_late` removed:** while latched tight the settle happens at most once per 250 ms and never twice for one submission; other submissions trim idle lists/preludes (no GPU wait) and pipeline normally. One-per-crossing log line kept (with shared MB/budget and threshold). - **Hot path:** DXGI query only when armed and the 100 ms window elapsed; hysteresis kept (armed at pct, recovered below pct−10; zero budget cannot falsely recover). Sampling + rate limit are a pure, unit-tested state machine (`pct`, `sample`, `react`). - **BOM restored** on `host.rs` (no reformat otherwise). ## Verification - `cargo test -p victory-gpu --lib`: **719 passed, 0 failed, 21 ignored** (+3: default-off, hysteresis, rate-limit incl. 10 submissions in one window → 1 settle); clippy `-D warnings` default and `--all-features` clean; `cargo xtask policy` 442 files; `cargo test -p xtask` 9; `git diff --check`. - **Still the gate:** no in-game soak on a spilling 8–12 GB card. Request: A/B frame times unset vs `=92` vs `=85`, watch the two crossing lines and settle counts. If you'd rather keep it out of tree until such a run exists, the branch is ready. - Risks: up to 4 synchronous drains/s while latched tight (250 ms is a compromise pending soak data); the tight settle is accounted as `WHY_MOST` in `LATE_STATS`; armed sampling still queries `video_memory()` at ≤10 Hz on the submitting thread; zero shared budget keeps it conservatively latched. Supersedes #103 (closed); branch force-pushed `6096c210`.
A card whose own memory is oversubscribed spills into the PC's shared
(NON_LOCAL) aperture; submissions sent ahead then hold command allocators
and intermediate allocations that the title's own allocations need.

Strictly opt-in, and off unless VICTORY_SEGMENT_TIGHT names a percent
(1..=100): unset or 0 leaves it off and nothing is sampled -- no clock is
read and no DXGI query is made. Armed, the adapter's shared budget/use is
sampled at most every 100 ms; above that percent of the budget it says
tight, and it stays tight until use falls below pct - 10 (hysteresis), so
one sample either way cannot flap it. A crossing either way is logged once
with the shared MB and budget. 92 is the design point and 85 the value of
the 8 GB safe preset; real frame-time data on a card that spills to
NON_LOCAL is still the gate before this ships on by default.

While tight, send_late trims the idle lists and preludes, and settles the
flights in the air so the title's next allocations are not held up behind
command allocators of work sent ahead. The settle is rate-limited: at
most once per 250 ms and never twice for one submission, so submissions
between drains still build up in the air and pipelining is not drained on
every submit (which is what a settle for every send did).

The policy is a pure state machine: the sampling function takes the four
video-memory numbers and the moment (100 ms gate, hysteresis), and the
reaction takes the moment and the submission number (250 ms window, once
per submission), with unit tests for default off/parsing, hysteresis,
sampling and the rate limit. Also restores the UTF-8 BOM on host.rs; the
file is otherwise untouched byte for byte beyond this feature.

From crossducking/RAZDA4A-ENGINE (Wave 14, host.rs shared_tight).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 18:30:20 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/161/head:github-bot/gh-160'
git switch 'github-bot/gh-160'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-160'
git switch 'github-bot/gh-160'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-160'
git switch 'github-bot/gh-160'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-160'
git switch 'main'
git merge --squash 'github-bot/gh-160'
git switch 'main'
git merge --ff-only 'github-bot/gh-160'
git switch 'main'
git merge 'github-bot/gh-160'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.