Title memory is copied, not used in place, past half of the host GPU's system-memory budget (#147) #161

Open
github-bot wants to merge 2 commits from github-bot/gh-161 into main AGit
Owner

@⁠RodrigoTorreao on GitHub · 2026-11-25 17:57 UTC · original
RodrigoTorreao:nonlocal-budget → main · +51 −3 · 2 files · 2 commits · open

On a machine with 16 GB of RAM, the driver's system-memory segment (DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL, about half of RAM) fills up seconds into the world and host allocations then fail with 0x8007000E (#147). Title memory used in place is the biggest part of it (3.4 GB of about 7.7 GB on 01aadd1), and nothing looks at that segment's budget: only video memory's is checked.

What

  • shadow::over_system_budget: before a window of title memory is opened in place (direct, and through_another_view on current main), the segment's use plus the window's length is compared with VICTORY_IN_PLACE_SYSTEM_PERCENT of its budget (50 by default; 100 turns the check off). Past that, the window is copied, as memory the host GPU cannot use in place already is. Logged at most a few times.
  • The memory line shows the segment's budget: system X of Y MiB (it was system X MiB).

Machines with 32 GB or more should not be affected: the segment is about 16 GB there, and half of it is more than the in-place windows I saw.

Tested

RX 6750 XT 12 GB, i5-14600KF, 16 GB RAM, Windows 11 26200, diagnostics build, README settings, --console series-x, Enter every 5 s. The A and B runs are the same executable: the share is set by the variable. One run per row; this machine is noisy.

On 01aadd1:

Run Share VICTORY_GPU_UPLOAD Frames in the world End
control 100 (off) – about 2 149 s, +0x23cf683 after allocation failures from 120 s
this PR 50 – about 26 311 s, allocation failures from 291 s
this PR 50 1 about 178 697 s, the DualSense crash that #40 fixes

On a59f3e5 (current main), with #40 cherry-picked in every run so that crash does not end them:

Run Share VICTORY_GPU_UPLOAD Frames in the world End
control 100 (off) 1 about 4 device reset (0x887A0007) at 100 s
this PR 50 1 about 30 device reset (0x887A0007) at 148 s
this PR 50 1 about 84 device hung (0x887A0006) at 378 s

So it delays the failure; it does not remove it. Upload buffers and copies still grow into the segment, and on current main the runs end in a device removal with video memory above 90%, in both arms.

  • cargo test -p victory-gpu --lib on a59f3e5 + this change: 112 passed, 0 failed, 4 ignored.
  • cargo clippy -p victory-gpu --lib and rustfmt --check: nothing on the changed lines.

Not tested: any machine with more RAM (the check should stay quiet there), NVIDIA, Intel.

AI-assisted (Claude Code): the change, the runs and this text. No game data.

🤖 Generated with Claude Code

**@⁠RodrigoTorreao** on GitHub · 2026-11-25 17:57 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/161) `RodrigoTorreao:nonlocal-budget` → `main` · +51 −3 · 2 files · 2 commits · open On a machine with 16 GB of RAM, the driver's system-memory segment (`DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL`, about half of RAM) fills up seconds into the world and host allocations then fail with `0x8007000E` (#147). Title memory used in place is the biggest part of it (3.4 GB of about 7.7 GB on `01aadd1`), and nothing looks at that segment's budget: only video memory's is checked. ## What - `shadow::over_system_budget`: before a window of title memory is opened in place (`direct`, and `through_another_view` on current `main`), the segment's use plus the window's length is compared with `VICTORY_IN_PLACE_SYSTEM_PERCENT` of its budget (50 by default; 100 turns the check off). Past that, the window is copied, as memory the host GPU cannot use in place already is. Logged at most a few times. - The memory line shows the segment's budget: `system X of Y MiB` (it was `system X MiB`). Machines with 32 GB or more should not be affected: the segment is about 16 GB there, and half of it is more than the in-place windows I saw. ## Tested RX 6750 XT 12 GB, i5-14600KF, 16 GB RAM, Windows 11 26200, diagnostics build, README settings, `--console series-x`, Enter every 5 s. The A and B runs are the same executable: the share is set by the variable. One run per row; this machine is noisy. On `01aadd1`: | Run | Share | `VICTORY_GPU_UPLOAD` | Frames in the world | End | |---|---|---|---|---| | control | 100 (off) | – | about 2 | 149 s, `+0x23cf683` after allocation failures from 120 s | | this PR | 50 | – | about 26 | 311 s, allocation failures from 291 s | | this PR | 50 | 1 | about 178 | 697 s, the DualSense crash that #40 fixes | On `a59f3e5` (current `main`), with #40 cherry-picked in every run so that crash does not end them: | Run | Share | `VICTORY_GPU_UPLOAD` | Frames in the world | End | |---|---|---|---|---| | control | 100 (off) | 1 | about 4 | device reset (`0x887A0007`) at 100 s | | this PR | 50 | 1 | about 30 | device reset (`0x887A0007`) at 148 s | | this PR | 50 | 1 | about 84 | device hung (`0x887A0006`) at 378 s | So it delays the failure; it does not remove it. Upload buffers and copies still grow into the segment, and on current `main` the runs end in a device removal with video memory above 90%, in both arms. - `cargo test -p victory-gpu --lib` on `a59f3e5` + this change: 112 passed, 0 failed, 4 ignored. - `cargo clippy -p victory-gpu --lib` and `rustfmt --check`: nothing on the changed lines. Not tested: any machine with more RAM (the check should stay quiet there), NVIDIA, Intel. AI-assisted (Claude Code): the change, the runs and this text. No game data. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Title memory used in place counts against the driver's NON_LOCAL
budget, which Windows sizes at about half of RAM. On a machine with
16 GB it ran out seconds into the world and every host allocation
after it failed (#147). A window that would take that segment past
VICTORY_IN_PLACE_SYSTEM_PERCENT of its budget (50 by default, 100
turns the check off) is copied, as memory that cannot be used in place
is. The memory line shows the segment's budget beside its use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With VICTORY_IN_PLACE_SYSTEM_PERCENT=100 the check returns before
video_memory(), so a run with it off makes no new driver queries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:36:57 +00:00
Author
Owner

@⁠KernelSmoker on GitHub · 2026-11-25 18:01 UTC · original

Checked 9f6973e. For the 100% control run, could the early return in over_system_budget move before the call to video_memory()? With a live adapter, video_memory() calls QueryVideoMemoryInfo for both LOCAL and NON_LOCAL on each invocation, including when the budget check is disabled. Returning first would let 100% serve as a control without the new driver queries. This is from reading the call path. I haven't measured their cost.

**@⁠KernelSmoker** on GitHub · 2026-11-25 18:01 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/161#issuecomment-7170335371) Checked 9f6973e. For the 100% control run, could the early return in over_system_budget move before the call to video_memory()? With a live adapter, video_memory() calls QueryVideoMemoryInfo for both LOCAL and NON_LOCAL on each invocation, including when the budget check is disabled. Returning first would let 100% serve as a control without the new driver queries. This is from reading the call path. I haven't measured their cost.
Author
Owner

@⁠RodrigoTorreao on GitHub · 2026-11-25 18:06 UTC · original

Thanks, done in 2f0ac1f: with VICTORY_IN_PLACE_SYSTEM_PERCENT=100 the function now returns before video_memory(), so the control asks the driver nothing new.

The control runs in the description were made before this. I don't expect it to change them, though I haven't measured it either: over_system_budget runs only when a new window of title memory is about to be opened, not per frame, and video_memory() is already called more often elsewhere (card.rs for each card buffer, resource.rs up to every 50 ms).

cargo test -p victory-gpu --lib: 112 passed, 0 failed, 4 ignored; clippy and rustfmt clean on the changed lines.

**@⁠RodrigoTorreao** on GitHub · 2026-11-25 18:06 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/161#issuecomment-7170441039) Thanks, done in `2f0ac1f`: with `VICTORY_IN_PLACE_SYSTEM_PERCENT=100` the function now returns before `video_memory()`, so the control asks the driver nothing new. The control runs in the description were made before this. I don't expect it to change them, though I haven't measured it either: `over_system_budget` runs only when a new window of title memory is about to be opened, not per frame, and `video_memory()` is already called more often elsewhere (`card.rs` for each card buffer, `resource.rs` up to every 50 ms). `cargo test -p victory-gpu --lib`: 112 passed, 0 failed, 4 ignored; clippy and rustfmt clean on the changed lines.
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-161'
git switch 'github-bot/gh-161'

Merge

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