GPU: log the host's video-memory use and its budget #952

Open
EgoraWyn wants to merge 1 commit from upstream-pr/952 into main
EgoraWyn commented 2026-11-24 14:26:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by EgoraWyn on 2026-11-24T14:26:38Z.


The runtime never asks the host how much video memory it may use or does use, so on a small card nothing in the log shows that the world is over the card. This PR (one file, 83 added lines, no behaviour change) adds three log lines; below is what they show on a 6 GB card.

Machine: NVIDIA RTX 3060 Laptop 6 GB (Ampere), driver 596.21 (32.0.15.9621), Windows 11 build 26300, 32 GB RAM, title 1.0.2.1 (own copy), diag build.

What it logs

  • once, when the host device is made: host adapter name=NVIDIA GeForce RTX 3060 Laptop GPU dedicated_mb=5994
  • every 5 seconds, after the fps line: video memory: 4518 MB of a 5226 MB budget on the adapter, 639 MB in system memory (DXGI's local use and budget of the process, and its non-local use)
  • once, the first time the use passes the budget: a warning with both numbers.

What it shows here (times are seconds after the process starts; the scripted first-run setup ends at 64 s, then loading)

local use budget non-local use
Series X, main ffe310e + patch, first prompt 4518 MB 5226 MB 639 MB
Series X, set A, in the first-run setup (59 s) 4563 MB 5226 MB 770 MB
loading, 84 s: first sample over the budget (the warning) 5398 MB 5226 MB 733 MB
loading, 130 s 6168 MB 5226 MB 749 MB
156 s to the end (world frames from about 240 s) 8485–9082 MB 5226 MB 749 MB until 212 s, then 3.4–5.1 GB
Series S, set B, in the first-run setup (61 s) 2554 MB 5226 MB 784 MB
loading, 160 s: first sample over the budget 6099 MB 5226 MB 769 MB
world, 230 s to the end 6350–7148 MB 5226 MB 2.8–4.7 GB

Set A = 8e79c80 + #493 (c48b240) + #206 (05981dd) + #189 (d0fd9bf) + #454 (d2c93fa) + #211 (24a387d) + #492 (b57e10d) + MIN_DYNAMIC = 1 << 18 (#747). Set B = the same PRs on main ffe310e, with #189 at b472733. Both with VICTORY_NO_WATCHDOG=1 VICTORY_SHADER_LOOP_LIMIT=32 VICTORY_D3D12_DRED=1, 420 s, no device removal.

  • Windows gives the process a budget of 5226 MB on a card with 5994 MB.
  • Series X mode uses 4.5 GB of it before any loading and passes it 20 s into loading. In the world the process holds 8.6–9.1 GB of local video memory, 3.4–3.9 GB over its budget. Windows' per-process GPU counters show 5.8–5.9 GB of dedicated memory at the same time, so about 2.7–3.2 GB of it is kept in system memory.
  • Series S mode starts at 2.5 GB and still passes the budget during loading: 6.4–7.1 GB in the world, 1.1–1.9 GB over, with 5.1–5.6 GB dedicated.
  • Most draws are still dropped in the world on this card (wave64 mesh programs, untranslated shaders), so these are lower bounds.

Notes

  • #130 (the opt-in profiler) reads the same DXGI budget as one of its counters. This is the small always-on version for the normal log; if #130 goes in, only the adapter line and the one warning are new.
  • If the adapter cannot be found or a query fails, the lines are skipped; device creation is untouched and the existing host D3D12 device ready line is not changed (other open PRs edit it).
  • Checked: cargo clippy -p victory-gpu --all-targets --locked -- -D warnings with and without --all-features; the new unit test (video_memory_units_and_budget); cargo fmt --check reports nothing in host.rs; run on main ffe310e and on both sets above.
  • Not covered: any limit or eviction (nothing acts on the numbers), adapters with more than one node (node 0 only).

The change is my own work under the repository's licence and contains nothing from the title.

AI use: Claude Code (Claude Fable 5.2 as orchestrator, a Claude Sonnet sub-agent for the first version of the patch) wrote the patch and this report and ran the builds and runs; a second tool (Codex) checked the numbers against the logs. The hardware, the title copy and the runs are the user's.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5474045211 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/952). Originally posted by [EgoraWyn](https://github.com/EgoraWyn) on 2026-11-24T14:26:38Z. --- The runtime never asks the host how much video memory it may use or does use, so on a small card nothing in the log shows that the world is over the card. This PR (one file, 83 added lines, no behaviour change) adds three log lines; below is what they show on a 6 GB card. **Machine:** NVIDIA RTX 3060 Laptop 6 GB (Ampere), driver 596.21 (32.0.15.9621), Windows 11 build 26300, 32 GB RAM, title 1.0.2.1 (own copy), diag build. **What it logs** - once, when the host device is made: `host adapter name=NVIDIA GeForce RTX 3060 Laptop GPU dedicated_mb=5994` - every 5 seconds, after the fps line: `video memory: 4518 MB of a 5226 MB budget on the adapter, 639 MB in system memory` (DXGI's local use and budget of the process, and its non-local use) - once, the first time the use passes the budget: a warning with both numbers. **What it shows here** (times are seconds after the process starts; the scripted first-run setup ends at 64 s, then loading) | | local use | budget | non-local use | |---|---|---|---| | **Series X**, `main` `ffe310e` + patch, first prompt | 4518 MB | 5226 MB | 639 MB | | Series X, set A, in the first-run setup (59 s) | 4563 MB | 5226 MB | 770 MB | | loading, 84 s: first sample over the budget (the warning) | 5398 MB | 5226 MB | 733 MB | | loading, 130 s | 6168 MB | 5226 MB | 749 MB | | 156 s to the end (world frames from about 240 s) | 8485–9082 MB | 5226 MB | 749 MB until 212 s, then 3.4–5.1 GB | | **Series S**, set B, in the first-run setup (61 s) | 2554 MB | 5226 MB | 784 MB | | loading, 160 s: first sample over the budget | 6099 MB | 5226 MB | 769 MB | | world, 230 s to the end | 6350–7148 MB | 5226 MB | 2.8–4.7 GB | Set A = `8e79c80` + #493 (`c48b240`) + #206 (`05981dd`) + #189 (`d0fd9bf`) + #454 (`d2c93fa`) + #211 (`24a387d`) + #492 (`b57e10d`) + `MIN_DYNAMIC = 1 << 18` (#747). Set B = the same PRs on `main` `ffe310e`, with #189 at `b472733`. Both with `VICTORY_NO_WATCHDOG=1 VICTORY_SHADER_LOOP_LIMIT=32 VICTORY_D3D12_DRED=1`, 420 s, no device removal. - Windows gives the process a budget of 5226 MB on a card with 5994 MB. - Series X mode uses 4.5 GB of it before any loading and passes it 20 s into loading. In the world the process holds **8.6–9.1 GB of local video memory, 3.4–3.9 GB over its budget.** Windows' per-process GPU counters show 5.8–5.9 GB of dedicated memory at the same time, so about 2.7–3.2 GB of it is kept in system memory. - Series S mode starts at 2.5 GB and still passes the budget during loading: **6.4–7.1 GB in the world, 1.1–1.9 GB over**, with 5.1–5.6 GB dedicated. - Most draws are still dropped in the world on this card (wave64 mesh programs, untranslated shaders), so these are lower bounds. **Notes** - #130 (the opt-in profiler) reads the same DXGI budget as one of its counters. This is the small always-on version for the normal log; if #130 goes in, only the adapter line and the one warning are new. - If the adapter cannot be found or a query fails, the lines are skipped; device creation is untouched and the existing `host D3D12 device ready` line is not changed (other open PRs edit it). - Checked: `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` with and without `--all-features`; the new unit test (`video_memory_units_and_budget`); `cargo fmt --check` reports nothing in `host.rs`; run on `main` `ffe310e` and on both sets above. - Not covered: any limit or eviction (nothing acts on the numbers), adapters with more than one node (node 0 only). The change is my own work under the repository's licence and contains nothing from the title. *AI use: Claude Code (Claude Fable 5.2 as orchestrator, a Claude Sonnet sub-agent for the first version of the patch) wrote the patch and this report and ran the builds and runs; a second tool (Codex) checked the numbers against the logs. The hardware, the title copy and the runs are the user's.*
mercuryVM commented 2026-11-24 14:46:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T14:46:08Z.

Review: APPROVED


Tested faccc4ef on Windows 11, RTX 5070, MSVC: cargo test -p victory-gpu -- --test-threads=1 51 passed, and with --features diagnostics 54 passed. cargo clippy -p victory-gpu --all-targets is clean. Logging only; the title wasn't run here.

  • Resolving the adapter with EnumAdapterByLuid(device.GetAdapterLuid()) gets the one the device actually sits on, which matters on multi-GPU hosts (#967 picks adapters explicitly). Every failure path just drops the report.
  • over_budget treating a zero budget as "not reported" avoids a spurious warning on drivers that don't fill it, and warning once keeps the log readable.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6041408401 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/952#pullrequestreview-6041408401). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T14:46:08Z. **Review:** APPROVED --- Tested faccc4ef on Windows 11, RTX 5070, MSVC: `cargo test -p victory-gpu -- --test-threads=1` 51 passed, and with `--features diagnostics` 54 passed. `cargo clippy -p victory-gpu --all-targets` is clean. Logging only; the title wasn't run here. - Resolving the adapter with `EnumAdapterByLuid(device.GetAdapterLuid())` gets the one the device actually sits on, which matters on multi-GPU hosts (#967 picks adapters explicitly). Every failure path just drops the report. - `over_budget` treating a zero budget as "not reported" avoids a spurious warning on drivers that don't fill it, and warning once keeps the log readable. AI-assisted (Claude Code).
MichaelSmithAI commented 2026-11-24 15:04:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by MichaelSmithAI on 2026-11-24T14:38:47Z.


An independent renderer-device check passed on an RTX 4090 under Wine/vkd3d-proton 3.2. The DXGI adapter used by the logger had the same LUID as the live D3D12 device. Both node-0 segment queries succeeded. In the test process, DXGI reported local and non-local budgets of 20,825 MiB and 24,004 MiB respectively (whole MiB). The fixture also called the production logger.

Both focused tests passed. This checks adapter selection and query availability on this backend. These budgets were sampled without the title running, so they provide no measurement of world-frame memory pressure or resource residency.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7134715430 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/952#issuecomment-7134715430). Originally posted by [MichaelSmithAI](https://github.com/MichaelSmithAI) on 2026-11-24T14:38:47Z. --- An independent renderer-device check passed on an RTX 4090 under Wine/vkd3d-proton 3.2. The DXGI adapter used by the logger had the same LUID as the live D3D12 device. Both node-0 segment queries succeeded. In the test process, DXGI reported local and non-local budgets of 20,825 MiB and 24,004 MiB respectively (whole MiB). The fixture also called the production logger. Both focused tests passed. This checks adapter selection and query availability on this backend. These budgets were sampled without the title running, so they provide no measurement of world-frame memory pressure or resource residency.
Zipettte commented 2026-11-24 16:05:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T15:40:36Z.


Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at faccc4e: cargo test -p victory-gpu passes, 51 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7136425730 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/952#issuecomment-7136425730). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T15:40:36Z. --- Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at faccc4e: `cargo test -p victory-gpu` passes, 51 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Marvisak commented 2026-11-25 01:07:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:29:07Z.


Automated triage for the maintainers.

Needs rebase. This PR does not merge cleanly into current main (ac2525d). Conflicting files: crates/victory-gpu/src/host.rs.

The content has not been reviewed yet; it will be once the branch is rebased onto main.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148557429 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/952#issuecomment-7148557429). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:29:07Z. --- <!-- victory-triage v1 head=faccc4ef5645cf51c1e12df409842089e7fe1d5c verdict=needs-rebase at=2026-11-25T00:13:20Z --> Automated triage for the maintainers. **Needs rebase.** This PR does not merge cleanly into current `main` (ac2525d). Conflicting files: `crates/victory-gpu/src/host.rs`. The content has not been reviewed yet; it will be once the branch is rebased onto `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
andrewpozdnakov7-jpg commented 2026-11-28 15:13:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T15:13:03Z.


I resolved the host.rs conflict for your exact faccc4e in 7fd6e25, with #3753 370adb0 as the other direct parent on current main. The combined tree keeps your adapter identity and first local-over-budget warning. It shares the cached DXGI adapter between the current frame report and #3753's failure snapshot. The regular build logs a short memory line, and the diagnostic build uses the existing detailed line.

With Windows WARP 1.0.22 and Agility 1.620.2, the cached adapter LUID matched the D3D12 device. The test captured one adapter identity event, one local-over-budget warning for the first overage and one rate-limited failure snapshot with both segment replies. The zero and equal-budget cases stayed below the warning threshold. Your updated unit test, both strict GPU Clippy configurations and the asset policy passed.

@EgoraWyn, the fork commit is available for the rebased review. Please retain the Git authors on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding my change into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7241294284 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/952#issuecomment-7241294284). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T15:13:03Z. --- I resolved the `host.rs` conflict for your exact `faccc4e` in [`7fd6e25`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/7fd6e2599b8b40cff748f1160e1e70dc39359c8a), with #3753 `370adb0` as the other direct parent on current `main`. The combined tree keeps your adapter identity and first local-over-budget warning. It shares the cached DXGI adapter between the current frame report and #3753's failure snapshot. The regular build logs a short memory line, and the diagnostic build uses the existing detailed line. With Windows WARP 1.0.22 and Agility 1.620.2, the cached adapter LUID matched the D3D12 device. The test captured one adapter identity event, one local-over-budget warning for the first overage and one rate-limited failure snapshot with both segment replies. The zero and equal-budget cases stayed below the warning threshold. Your updated unit test, both strict GPU Clippy configurations and the asset policy passed. @EgoraWyn, the fork commit is available for the rebased review. Please retain the Git authors on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding my change into another commit. AI-assisted with OpenAI Codex.
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/952:upstream-pr/952'
git switch 'upstream-pr/952'

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/952'
git switch 'upstream-pr/952'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/952'
git switch 'upstream-pr/952'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/952'
git switch 'main'
git merge --squash 'upstream-pr/952'
git switch 'main'
git merge --ff-only 'upstream-pr/952'
git switch 'main'
git merge 'upstream-pr/952'
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
Marvisak/VIctory!952
No description provided.