One shared DXGI reading of the card's memory (VICTORY_CARD_OWNER=read, off by default) #4744

Closed
Jesper-Andersson wants to merge 6 commits from upstream-pr/4744 into main
Jesper-Andersson commented 2026-12-01 04:44:56 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Jesper-Andersson on 2026-12-01T04:44:56Z.


Refs #4462 (step 1 of the plan there; it doesn't fix the issue on its own).

What it changes

Every room test asks DXGI for the card's budget and use on its own (Host::video_memory), up to every 32 MiB of upload and per buffer made, and each sees a slightly different number. Step 1 of #4462 is one reading that every caller shares, so later steps have one budget and one use to work from.

New switch VICTORY_CARD_OWNER (off by default; read, or 1/all for every part merged so far). Unset, nothing changes: video_memory asks DXGI on every call, as now. With read (new crates/victory-gpu/src/card.rs):

  • DXGI is asked at most once a frame, and not again within 16 ms. An extra reading is taken when the budget-change event fired (at most once a frame and not within 250 ms of the last such reading), when the reading is over 250 ms old, or when the estimate crosses the hard line.
  • Between readings the use is estimated as D3D12MA and VMA do: the last reading plus the texture blocks and committed textures made or let go since. Frees of committed textures show only at the next reading, so they make the estimate err high; memory it doesn't count (buffers, other heaps) makes it err low until then.
  • Budget moves under 128 MiB are ignored; falls past that are taken at once, rises at 256 MiB at once or at 128 MiB after 3 s.
  • Lines: target T = B − max(512 MiB, B/16), drain-to L = T − 256 MiB, hard H = B − 256 MiB (VICTORY_CARD_OWNER_KEEP_MB replaces the margin). Nothing acts on them yet; later steps would.
  • A card owner: line once a second with the lines, the reading, the estimate, the error at the last reading with its sign (+ = the estimate was high), event wake-ups against budget moves, and DXGI queries against asks.

With read, the existing video_memory() call sites on main (about 34: the room checks for uploads and card copies, the read-ahead thread, the sweep, the shadow copies, the F3 panel and others) all get this shared reading, with the budget held through moves under 128 MiB and the estimated use (which can be off either way until the next reading), instead of a fresh DXGI reading each time. Their decisions can therefore change with the switch on. Frame time and distance past the budget have been compared with and without it on one card (@kraiy404, below); the decisions themselves have not been logged side by side.

The pools mark their texture blocks as card memory (Pool::on_card) so the estimate sees them. Unit tests cover the dead band, the lines, the state changes and when a reading is taken again. Line in docs/findings.md.

How it was tested

  • GPU and profile: RTX 2070 SUPER 8 GB, driver 621.40, Windows 11, Ryzen 7 5800X, 32 GB RAM, ReBAR off, Series S, DLSS Performance; FSR 3 frame generation x2 in the two fork runs below, none in the branch-only run.
  • Before (our fork with the shared reading but without the debounce, ~28 minutes in the world): DXGI queries a median of 24 a second in minutes 3 to 16 (p95 153, max 496); the budget-change event fired about 90 times a second, and each fire forced a reading.
  • After (our fork with the debounce, dead band and lines, ~25 minutes in the world, 2026-12-01): about one reading a frame in the world (median 15 a second, max 18); 113,686 event wake-ups against 19 budget moves past the dead band; estimate at most 31 MB off at a reading. On a loading screen running at 260 to 1,324 fps it was still one reading a frame, up to 1,491 a second; the 16 ms floor is for that. These two runs were on our fork's build with other changes in it.
  • This branch on its own (main 5fabb46ea + this change, diag build, VICTORY_CARD_OWNER=read with the switch set of our usual runs (listed in the log header; all present on main), no frame generation, GPU clocks not locked; one run, 2026-12-01, an 81 s load then ~7 minutes in the world): at most 63 readings a second on the loading screen for up to 2,349 asks a second; in the world a median of 17.6 a second at 18.3 fps (one a frame); estimate off at a reading by 1 MB or less in 95 % of the card owner: lines (316 lines over ~8 minutes; max 67 MB); 6,267 event wake-ups against 2 budget moves; card use peaked at 6,749 MB against a 6,826 MB budget. No panic, no device removal, picture normal in four shots. Not compared with the switch off, so whether callers decide differently with it on is not shown. Results in #4462 (comments of 2026-12-01). Split by phase: the large errors all came at the start and while the world loaded in (use rising by up to 1.26 GB between two card owner: lines, which are about a second apart); once in the world the error at a reading stayed within 20 MB, and within 25 MB inside a period.
  • By @kraiy404 on an RTX 4060 Ti 8 GB (i5-13400F, 32 GB, 2560x1440, Series S and Series X, DLSS Quality, DLSS frame generation 2x, v2026.11.30.03 + this PR's first three commits; their comment): four runs, no removed device (a fifth run, switch unset, texture room 88 %, lost the device after 12 minutes; the switch was unset, so not from it); with read, about one DXGI query a frame (median 19 and 16.6 a second); the state was hard in 83 % (Series S) and 92 % (Series X) of the lines; 261,928 and 91,430 event wake-ups against 2 budget moves each. Their extracts show the same phase split as ours: up to 175 MB at a reading and 364 MB inside a period during load-in; in the world within 16 MB at a reading and 64 MB inside a period. Frame time: Series S about the same (57.9 ms median with it, 60.0 without); Series X 69.0 ms with it and 88.9 ms without, one pair on a card that varies a lot between runs, so not shown to be the switch.
  • Last two commits (f279fe874: the error's sign in the line, a corrected doc comment, a findings line; 74977c768: a wording fix in that findings line): cargo test --locked -p victory-gpu --lib card:: 9 passed, including a new test for the sign; not run in the game (it changes the log line only).
  • For shader changes, the wave sizes tested: no shader changes.
  • cargo test passed for the crates it touches: yes, cargo test --locked -p victory-gpu --lib on this branch, five full runs: 1,103 passed in four; in one, watch::tests::ask_rest_falls_back_per_piece_when_touching_unwatched_neighbour failed (a test this change doesn't touch; it passed alone and in the other four runs).
  • CI: cargo clippy -p victory-gpu --all-targets --locked -- -D warnings stops on 5 errors that main 5fabb46ea already has (host/font.rs 213 and 260, host/menu.rs 667, host/panel.rs 602 and 668), none in this change; the check job fails on main 5fabb46ea (still the head of main on 2026-12-01) the same way, and on this PR's head 74977c768.

Spec dependence

  • Likely general: sharing one reading and debouncing the budget-change event (any card, any driver that fires the event often).
  • May depend on our setup: the 128 MiB dead band and the target margin were sized from our card (8 GB, Series S, DLSS Performance); on 12 to 16 GB cards the margin is B/16.
  • Tested by another user: RTX 4060 Ti 8 GB at Series S and Series X with DLSS frame generation (above).
  • Untested elsewhere: AMD, 12 to 16 GB cards, ray tracing on.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #2910 (@Remorce's card memory ledger, the count step 0 reads from), #3602 and #3634 (other users of the card reading), #4462 (the plan). None shares one reading between callers. host.rs, resource.rs and pool.rs are touched by many open PRs; the changes here are a few lines each.

Drafted with AI assistance (Claude Code).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5579204835 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4744). Originally posted by [Jesper-Andersson](https://github.com/Jesper-Andersson) on 2026-12-01T04:44:56Z. --- Refs #4462 (step 1 of the plan there; it doesn't fix the issue on its own). ## What it changes Every room test asks DXGI for the card's budget and use on its own (`Host::video_memory`), up to every 32 MiB of upload and per buffer made, and each sees a slightly different number. Step 1 of #4462 is one reading that every caller shares, so later steps have one budget and one use to work from. New switch `VICTORY_CARD_OWNER` (off by default; `read`, or `1`/`all` for every part merged so far). Unset, nothing changes: `video_memory` asks DXGI on every call, as now. With `read` (new `crates/victory-gpu/src/card.rs`): - DXGI is asked at most once a frame, and not again within 16 ms. An extra reading is taken when the budget-change event fired (at most once a frame and not within 250 ms of the last such reading), when the reading is over 250 ms old, or when the estimate crosses the hard line. - Between readings the use is estimated as D3D12MA and VMA do: the last reading plus the texture blocks and committed textures made or let go since. Frees of committed textures show only at the next reading, so they make the estimate err high; memory it doesn't count (buffers, other heaps) makes it err low until then. - Budget moves under 128 MiB are ignored; falls past that are taken at once, rises at 256 MiB at once or at 128 MiB after 3 s. - Lines: target T = B − max(512 MiB, B/16), drain-to L = T − 256 MiB, hard H = B − 256 MiB (`VICTORY_CARD_OWNER_KEEP_MB` replaces the margin). **Nothing acts on them yet**; later steps would. - A `card owner:` line once a second with the lines, the reading, the estimate, the error at the last reading with its sign (+ = the estimate was high), event wake-ups against budget moves, and DXGI queries against asks. With `read`, the existing `video_memory()` call sites on `main` (about 34: the room checks for uploads and card copies, the read-ahead thread, the sweep, the shadow copies, the F3 panel and others) all get this shared reading, with the budget held through moves under 128 MiB and the estimated use (which can be off either way until the next reading), instead of a fresh DXGI reading each time. Their decisions can therefore change with the switch on. Frame time and distance past the budget have been compared with and without it on one card (@kraiy404, below); the decisions themselves have not been logged side by side. The pools mark their texture blocks as card memory (`Pool::on_card`) so the estimate sees them. Unit tests cover the dead band, the lines, the state changes and when a reading is taken again. Line in `docs/findings.md`. ## How it was tested - GPU and profile: RTX 2070 SUPER 8 GB, driver 621.40, Windows 11, Ryzen 7 5800X, 32 GB RAM, ReBAR off, Series S, DLSS Performance; FSR 3 frame generation x2 in the two fork runs below, none in the branch-only run. - Before (our fork with the shared reading but without the debounce, ~28 minutes in the world): DXGI queries a median of 24 a second in minutes 3 to 16 (p95 153, max 496); the budget-change event fired about 90 times a second, and each fire forced a reading. - After (our fork with the debounce, dead band and lines, ~25 minutes in the world, 2026-12-01): about one reading a frame in the world (median 15 a second, max 18); 113,686 event wake-ups against 19 budget moves past the dead band; estimate at most 31 MB off at a reading. On a loading screen running at 260 to 1,324 fps it was still one reading a frame, up to 1,491 a second; the 16 ms floor is for that. These two runs were on our fork's build with other changes in it. - This branch on its own (`main` 5fabb46ea + this change, diag build, `VICTORY_CARD_OWNER=read` with the switch set of our usual runs (listed in the log header; all present on `main`), no frame generation, GPU clocks not locked; one run, 2026-12-01, an 81 s load then ~7 minutes in the world): at most 63 readings a second on the loading screen for up to 2,349 asks a second; in the world a median of 17.6 a second at 18.3 fps (one a frame); estimate off at a reading by 1 MB or less in 95 % of the `card owner:` lines (316 lines over ~8 minutes; max 67 MB); 6,267 event wake-ups against 2 budget moves; card use peaked at 6,749 MB against a 6,826 MB budget. No panic, no device removal, picture normal in four shots. Not compared with the switch off, so whether callers decide differently with it on is not shown. Results in #4462 (comments of 2026-12-01). Split by phase: the large errors all came at the start and while the world loaded in (use rising by up to 1.26 GB between two `card owner:` lines, which are about a second apart); once in the world the error at a reading stayed within 20 MB, and within 25 MB inside a period. - By @kraiy404 on an RTX 4060 Ti 8 GB (i5-13400F, 32 GB, 2560x1440, Series S and Series X, DLSS Quality, DLSS frame generation 2x, `v2026.11.30.03` + this PR's first three commits; [their comment](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4744#issuecomment-7308129064)): four runs, no removed device (a fifth run, switch unset, texture room 88 %, lost the device after 12 minutes; the switch was unset, so not from it); with `read`, about one DXGI query a frame (median 19 and 16.6 a second); the state was hard in 83 % (Series S) and 92 % (Series X) of the lines; 261,928 and 91,430 event wake-ups against 2 budget moves each. Their extracts show the same phase split as ours: up to 175 MB at a reading and 364 MB inside a period during load-in; in the world within 16 MB at a reading and 64 MB inside a period. Frame time: Series S about the same (57.9 ms median with it, 60.0 without); Series X 69.0 ms with it and 88.9 ms without, one pair on a card that varies a lot between runs, so not shown to be the switch. - Last two commits (f279fe874: the error's sign in the line, a corrected doc comment, a findings line; 74977c768: a wording fix in that findings line): `cargo test --locked -p victory-gpu --lib card::` 9 passed, including a new test for the sign; not run in the game (it changes the log line only). - For shader changes, the wave sizes tested: no shader changes. - `cargo test` passed for the crates it touches: yes, `cargo test --locked -p victory-gpu --lib` on this branch, five full runs: 1,103 passed in four; in one, `watch::tests::ask_rest_falls_back_per_piece_when_touching_unwatched_neighbour` failed (a test this change doesn't touch; it passed alone and in the other four runs). - CI: `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` stops on 5 errors that `main` 5fabb46ea already has (`host/font.rs` 213 and 260, `host/menu.rs` 667, `host/panel.rs` 602 and 668), none in this change; the `check` job fails on `main` 5fabb46ea (still the head of `main` on 2026-12-01) the same way, and on this PR's head 74977c768. ## Spec dependence - Likely general: sharing one reading and debouncing the budget-change event (any card, any driver that fires the event often). - May depend on our setup: the 128 MiB dead band and the target margin were sized from our card (8 GB, Series S, DLSS Performance); on 12 to 16 GB cards the margin is B/16. - Tested by another user: RTX 4060 Ti 8 GB at Series S and Series X with DLSS frame generation (above). - Untested elsewhere: AMD, 12 to 16 GB cards, ray tracing on. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #2910 (@Remorce's card memory ledger, the count step 0 reads from), #3602 and #3634 (other users of the card reading), #4462 (the plan). None shares one reading between callers. `host.rs`, `resource.rs` and `pool.rs` are touched by many open PRs; the changes here are a few lines each. Drafted with AI assistance (Claude Code).
rahmondg45 commented 2026-12-01 04:51:03 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by rahmondg45 on 2026-12-01T04:51:03Z.


yes please fix vram overload on 8gb cards also using 29gb of regular ram as well

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7301166158 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4744#issuecomment-7301166158). Originally posted by [rahmondg45](https://github.com/rahmondg45) on 2026-12-01T04:51:03Z. --- yes please fix vram overload on 8gb cards also using 29gb of regular ram as well
kraiy404 commented 2026-12-01 10:23:52 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by kraiy404 on 2026-12-01T10:23:52Z.


Tested #4744 on an 8 GB card with the settings the PR lists as untested (Series X, DLSS frame generation), and compared with the switch off, which the PR says has not been done.

Setup

  • RTX 4060 Ti 8 GB, driver 621.40, i5-13400F, 32 GB, Windows 11 Enterprise 26H2, build 26300.9974, 2560x1440 full screen.
  • Build: v2026.11.30.03 (e1251c31) + only this PR's three commits (52a0dbe1, 5e0533a2, 69de6017). Release build, no other changes. Shaders preloaded before every run (1,664 of 1,664 pipelines in the library).
  • Mouse and keyboard with native mouse, texture room 72 %, DLSS Quality, DLSS frame generation 2x. Series S = 1280x720 scene into 1920x1080; Series X = quality scene (1707x960) into 2560x1440.

Runs (no removed device in any of them)

Run Profile VICTORY_CARD_OWNER World samples frame median p90 p95 p99 max fps median card over budget (median / max) first-upload refusals Streamline over-VRAM warnings
A Series S unset 170 s 60.0 ms 75.4 172.5 648.8 753 16.7 +65 / +257 MB 142,344 8,671
B Series S read 183 s 57.9 ms 67.0 73.3 691.3 1202 17.3 +12 / +263 MB 176,914 7,684
C Series X read 131 s 69.0 ms 80.3 100.8 706.5 1091 14.5 +412 / +812 MB 128,513 9,243
D Series X unset 187 s 88.9 ms 114.8 328.3 7297.2 10453 11.2 +864 / +1319 MB 129,390 10,704

Series X is where it shows. Same profile, same route: 88.9 ms a frame at the median without the switch, 69.0 ms with it; the card sat 864 MB past its budget instead of 412 MB; 50 of 187 sampled seconds were over 100 ms without it, 7 of 131 with it. I would not call that proof — this card varies a lot between runs — but it is the one pair where frame time and over-budget distance moved the same way.

Series S does not show it: 60.0 against 57.9 ms, p99 in the same range. A second run of the Series S setting of A measured p99 113.8 ms instead of 648.8 ms, so run-to-run variance there is larger than any difference between the arms.

card owner: lines

Series S, run B (723 lines): DXGI queries median 19.0 a second (p95 31.5, max 62, about one a frame); estimate error at a reading median 0 MB, p95 1 MB, max 175 MB, worst in a period 211 MB; budget wake-ups 261,928 against 2 moves; state hard in 598 of 723 lines (83 %), soft 85, under 40; B 6,954 MB, T 6,442, L 6,186, H 6,698; DXGI used median 6,966 MB, max 7,217 MB.

Series X, run C (473 lines): DXGI queries median 16.6 a second (p95 52.8, max 61); estimate error median 0, p95 1, max 80 MB, worst in a period 364 MB; wake-ups 91,430 against 2 moves; state hard in 436 of 473 lines (92 %); DXGI used median 7,342 MB, max 7,742 MB a gainst the same 6,954 MB budget.

So on this class of card the state sits in hard 83 to 92 % of the time, the budget event fires 90,000 to 260,000 times while the budget itself moves twice, and the estimate is usually exact but once reached 364 MB in a period. That may be worth knowing for #4462's next steps.

One crash, not from the switch: with frame generation 2x and texture room 88 % (Series X, switch unset) the device was removed after 12 minutes (0x887A0005, 0x887A0007): 32 of 129 sampled seconds over 100 ms, p99 10,206 ms, longest frame 12,192 ms, 7,305 over-VRAM warnings, card 286 MB over budget at the median (754 MB worst). With the room back to 72 % the same profile ran 187 s (run D) with no removed device.

cardowner-A1-off-extract.log
cardowner-A2-read-extract.log
cardowner-B1-read-X-extract.log
cardowner-B2-off-X-extract.log

Available if you want them untrimmed.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7308129064 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4744#issuecomment-7308129064). Originally posted by [kraiy404](https://github.com/kraiy404) on 2026-12-01T10:23:52Z. --- Tested #4744 on an 8 GB card with the settings the PR lists as untested (Series X, DLSS frame generation), and compared with the switch off, which the PR says has not been done. **Setup** - RTX 4060 Ti 8 GB, driver 621.40, i5-13400F, 32 GB, Windows 11 Enterprise 26H2, build 26300.9974, 2560x1440 full screen. - Build: `v2026.11.30.03` (e1251c31) + **only this PR's three commits** (52a0dbe1, 5e0533a2, 69de6017). Release build, no other changes. Shaders preloaded before every run (1,664 of 1,664 pipelines in the library). - Mouse and keyboard with native mouse, texture room 72 %, DLSS Quality, DLSS frame generation 2x. Series S = 1280x720 scene into 1920x1080; Series X = quality scene (1707x960) into 2560x1440. **Runs** (no removed device in any of them) | Run | Profile | `VICTORY_CARD_OWNER` | World samples | frame median | p90 | p95 | p99 | max | fps median | card over budget (median / max) | first-upload refusals | Streamline over-VRAM warnings | |---|---|---|---|---|---|---|---|---|---|---|---|---| | A | Series S | unset | 170 s | 60.0 ms | 75.4 | 172.5 | 648.8 | 753 | 16.7 | +65 / +257 MB | 142,344 | 8,671 | | B | Series S | read | 183 s | 57.9 ms | 67.0 | 73.3 | 691.3 | 1202 | 17.3 | +12 / +263 MB | 176,914 | 7,684 | | C | Series X | read | 131 s | **69.0 ms** | 80.3 | 100.8 | **706.5** | **1091** | **14.5** | **+412 / +812 MB** | 128,513 | 9,243 | | D | Series X | unset | 187 s | **88.9 ms** | 114.8 | **328.3** | **7297.2** | **10453** | **11.2** | **+864 / +1319 MB** | 129,390 | 10,704 | **Series X is where it shows.** Same profile, same route: 88.9 ms a frame at the median without the switch, 69.0 ms with it; the card sat 864 MB past its budget instead of 412 MB; 50 of 187 sampled seconds were over 100 ms without it, 7 of 131 with it. I would not call that proof — this card varies a lot between runs — but it is the one pair where frame time and over-budget distance moved the same way. **Series S does not show it:** 60.0 against 57.9 ms, p99 in the same range. A second run of the Series S setting of A measured p99 113.8 ms instead of 648.8 ms, so run-to-run variance there is larger than any difference between the arms. **`card owner:` lines** Series S, run B (723 lines): DXGI queries **median 19.0 a second** (p95 31.5, max 62, about one a frame); estimate error at a reading median 0 MB, p95 1 MB, **max 175 MB, worst in a period 211 MB**; **budget wake-ups 261,928 against 2 moves**; state `hard` in **598 of 723 lines (83 %)**, `soft` 85, `under` 40; B 6,954 MB, T 6,442, L 6,186, H 6,698; DXGI used median 6,966 MB, max 7,217 MB. Series X, run C (473 lines): DXGI queries median 16.6 a second (p95 52.8, max 61); estimate error median 0, p95 1, **max 80 MB, worst in a period 364 MB**; **wake-ups 91,430 against 2 moves**; state `hard` in **436 of 473 lines (92 %)**; DXGI used median 7,342 MB, max 7,742 MB a gainst the same 6,954 MB budget. So on this class of card the state sits in `hard` 83 to 92 % of the time, the budget event fires 90,000 to 260,000 times while the budget itself moves twice, and the estimate is usually exact but once reached 364 MB in a period. That may be worth knowing for #4462's next steps. **One crash, not from the switch:** with frame generation 2x and texture room 88 % (Series X, switch unset) the device was removed after 12 minutes (`0x887A0005`, `0x887A0007`): 32 of 129 sampled seconds over 100 ms, p99 10,206 ms, longest frame 12,192 ms, 7,305 over-VRAM warnings, card 286 MB over budget at the median (754 MB worst). With the room back to 72 % the same profile ran 187 s (run D) with no removed device. [cardowner-A1-off-extract.log](https://github.com/user-attachments/files/35675976/cardowner-A1-off-extract.log) [cardowner-A2-read-extract.log](https://github.com/user-attachments/files/35675980/cardowner-A2-read-extract.log) [cardowner-B1-read-X-extract.log](https://github.com/user-attachments/files/35675981/cardowner-B1-read-X-extract.log) [cardowner-B2-off-X-extract.log](https://github.com/user-attachments/files/35675984/cardowner-B2-off-X-extract.log) Available if you want them untrimmed.
Jesper-Andersson commented 2026-12-01 13:38:56 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Jesper-Andersson on 2026-12-01T13:38:56Z.


@kraiy404 thank you, this covers Series X and DLSS frame generation, which we hadn't run, and the switch-off pair we hadn't done.

The estimate error is a load-in effect. In your two read extracts every line with 20 MB or more at a reading comes in the first ~35 lines, at the start and while the world loads in (DXGI use climbing up to about 1.2 GB a second, for example 3,797 → 4,981 → 5,522 → 5,879 → 6,486 MB in five lines at Series X). After that:

Run World lines Error at a reading, max (p99) Most inside a period
B, Series S 686 15 MB (2 MB) 64 MB
C, Series X 439 16 MB (3 MB) 64 MB

Our run on this branch split the same way: up to 67 MB at a reading and 219 MB inside a period during load-in, then within 20 MB at a reading and 25 MB inside a period in the world. So it doesn't look like the error grows with frees during play.

Which way it was off the line didn't say: it printed only the size. Frees of committed textures make the estimate high until the next reading, and memory it doesn't count (buffers, other heaps) makes it low. f279fe874, now on this PR, prints the error with its sign (+ = the estimate was high); it changes the log line only (unit tests pass; not run in the game). During load-in the sign would show which of the two it is.

The Series X pair. In the world your callers asked a median of 109 (Series S) and 98 (Series X) times a second against 19 and 16.6 DXGI queries. On our card one query took about 0.55 µs (idle desktop), so the CPU time saved is well under 0.1 ms a second, far too little for 20 ms a frame. What does change is the number the callers see: one reading a frame plus our own deltas instead of a fresh reading each time, so their decisions could differ. With one pair, and your Series S repeat moving p99 from 648.8 to 113.8 ms, I can't tell that apart from run-to-run spread. If you have time for more, another Series X pair each way would help the most.

Noted on the 12-minute device removal at texture room 88 % with the switch unset.

Drafted with AI assistance (Claude Code).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7312954338 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4744#issuecomment-7312954338). Originally posted by [Jesper-Andersson](https://github.com/Jesper-Andersson) on 2026-12-01T13:38:56Z. --- @kraiy404 thank you, this covers Series X and DLSS frame generation, which we hadn't run, and the switch-off pair we hadn't done. **The estimate error is a load-in effect.** In your two `read` extracts every line with 20 MB or more at a reading comes in the first ~35 lines, at the start and while the world loads in (DXGI use climbing up to about 1.2 GB a second, for example 3,797 → 4,981 → 5,522 → 5,879 → 6,486 MB in five lines at Series X). After that: | Run | World lines | Error at a reading, max (p99) | Most inside a period | |---|---|---|---| | B, Series S | 686 | 15 MB (2 MB) | 64 MB | | C, Series X | 439 | 16 MB (3 MB) | 64 MB | Our run on this branch split the same way: up to 67 MB at a reading and 219 MB inside a period during load-in, then within 20 MB at a reading and 25 MB inside a period in the world. So it doesn't look like the error grows with frees during play. **Which way it was off** the line didn't say: it printed only the size. Frees of committed textures make the estimate high until the next reading, and memory it doesn't count (buffers, other heaps) makes it low. f279fe874, now on this PR, prints the error with its sign (+ = the estimate was high); it changes the log line only (unit tests pass; not run in the game). During load-in the sign would show which of the two it is. **The Series X pair.** In the world your callers asked a median of 109 (Series S) and 98 (Series X) times a second against 19 and 16.6 DXGI queries. On our card one query took about 0.55 µs (idle desktop), so the CPU time saved is well under 0.1 ms a second, far too little for 20 ms a frame. What does change is the number the callers see: one reading a frame plus our own deltas instead of a fresh reading each time, so their decisions could differ. With one pair, and your Series S repeat moving p99 from 648.8 to 113.8 ms, I can't tell that apart from run-to-run spread. If you have time for more, another Series X pair each way would help the most. Noted on the 12-minute device removal at texture room 88 % with the switch unset. Drafted with AI assistance (Claude Code).
kraiy404 commented 2026-12-01 15:59:56 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by kraiy404 on 2026-12-01T15:59:56Z.


谢谢,这里涵盖了Series X和DLSS帧生成,我们之前没运行过,还有那对开关对我们没做过。

**估计误差是加载效应。**在你的两个摘录中,每行读数20 MB或以上的行都会出现在前~35行、开头以及世界加载时(DXGI的使用速度可攀升至约每秒1.2 GB,例如在Series X的五行中,3,797→4,981→5,522→5,879→6,486 MB)。之后:read

快跑 世界线 读数误差,最大值(第99页) 大多数时间内
B,系列 S 686 15 MB(2 MB) 64 MB
C,X系列 439 16 MB(3 MB) 64 MB
我们在这条分支上的运行方式也差不多:加载时读取时最多 67 MB,加载时某段时间内 219 MB,然后每次读数时 20 MB 以内,在世界范围内 25 MB。所以看起来这个误差不会随着比赛中的任意球而增加。

出线时并没有说是哪个方向:它只打印了尺寸。提交纹理的空缺会使估计值在下一次读取前偏高,而不计入的内存(缓冲区或其他堆)则使估计值较低。f279fe8 现在出现在该 PR 上,会用符号打印误差(+ = 估计值很高);它只改变日志行(单元测试通过;不在游戏中运行)。装载时,标牌会显示是哪种。

**Series X 系列。**在世界中,来电者每秒询问的中位数为109次(系列S)和98次(系列X),而DXGI查询分别为19次和16.6次。在我们的显卡上,一次查询大约耗时0.55微秒(空闲桌面),所以节省的CPU时间远低于每秒0.1毫秒,对于每帧20毫秒来说远远不足。真正变化的是来电者看到的数字:每次都是读取一个帧加上我们自己的 delta,而不是每次新的读数,所以他们的判断可能不同。用一对,加上你的Series S回信把p99从648.8毫秒推到113.8毫秒,除了跑对盘价差,我无法判断。如果有时间,再买一双 Series X 双向会最有帮助。

在纹理室拆除设备12分钟时,已记录为88%,开关未开启。

在 AI 辅助下起草(Claude Code)。

As you asked, I ran a few more tests at Series X. The settings and the build are the same as before; only the switch changed.

Three more Series X runs (2026-12-01 evening)

Same save, same route, same build (.03 + only this PR), same settings, Series X at 2560x1440 with DLSS Quality and frame generation 2x. Run order: on, off, off.

Run VICTORY_CARD_OWNER World samples frame median p95 p99 max fps median card over budget (median / max) Streamline over-VRAM warnings Outcome
1 read 95 s 78.5 ms 103.6 249.8 250 12.7 +506 / +981 MB 5,745 finished
2 unset 29 s 69.4 ms 77.7 80.1 80 14.4 +41 / +571 MB 1,552 device removed, about 3 min in
3 unset 77 s 70.3 ms 102.5 492.3 492 14.2 +204 / +647 MB 4,780 device hung, about 5 min in

The crash is the part worth your attention: with the switch off, both of this evening's runs ended in 0x887A0005 with reason 0x887A0007 (device hung, at about 3 and 5 minutes); with it on, the run finished. An earlier off run on the same profile went 187 s without trouble, so I am not calling this proof of anything — two crashes against one clean run is a small sample, and I have no mechanism to offer for why a shared reading would change it. But if you want a direction to look at, this is the only one in my data that is not just the log line.

Frame times do not separate: medians 78.5 on against 69.4 and 70.3 off, with the off runs' p99 anywhere from 80 to 492 ms. The over-budget distance does not separate either (+506 on, +41 and +204 off).

On the estimate error: your load-in split holds in our extracts as well. Outside the first ~35 lines every reading was within 16 MB (Series X) and 15 MB (Series S), and the largest error inside a period was 64 MB, the same as yours. The 175 and 364 MB I reported earlier were all in load-in, so I agree with your reading.

Full play logs for these three runs are available if useful.
xrun-X-1-read.log
xrun-X-2-off-crash3min.log
xrun-X-3-off-crash5min.log

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7316865647 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4744#issuecomment-7316865647). Originally posted by [kraiy404](https://github.com/kraiy404) on 2026-12-01T15:59:56Z. --- > 谢谢,这里涵盖了Series X和DLSS帧生成,我们之前没运行过,还有那对开关对我们没做过。 > > **估计误差是加载效应。**在你的两个摘录中,每行读数20 MB或以上的行都会出现在前~35行、开头以及世界加载时(DXGI的使用速度可攀升至约每秒1.2 GB,例如在Series X的五行中,3,797→4,981→5,522→5,879→6,486 MB)。之后:`read` > > 快跑 世界线 读数误差,最大值(第99页) 大多数时间内 > B,系列 S 686 15 MB(2 MB) 64 MB > C,X系列 439 16 MB(3 MB) 64 MB > 我们在这条分支上的运行方式也差不多:加载时读取时最多 67 MB,加载时某段时间内 219 MB,然后每次读数时 20 MB 以内,在世界范围内 25 MB。所以看起来这个误差不会随着比赛中的任意球而增加。 > > 出线时并没有说**是哪个方向**:它只打印了尺寸。提交纹理的空缺会使估计值在下一次读取前偏高,而不计入的内存(缓冲区或其他堆)则使估计值较低。[f279fe8](https://github.com/trustno1-coder/VIctory-NVIDIA/commit/f279fe874beea01dcc1cc476f3760fa93a7522b3) 现在出现在该 PR 上,会用符号打印误差(+ = 估计值很高);它只改变日志行(单元测试通过;不在游戏中运行)。装载时,标牌会显示是哪种。 > > **Series X 系列。**在世界中,来电者每秒询问的中位数为109次(系列S)和98次(系列X),而DXGI查询分别为19次和16.6次。在我们的显卡上,一次查询大约耗时0.55微秒(空闲桌面),所以节省的CPU时间远低于每秒0.1毫秒,对于每帧20毫秒来说远远不足。真正变化的是来电者看到的数字:每次都是读取一个帧加上我们自己的 delta,而不是每次新的读数,所以他们的判断可能不同。用一对,加上你的Series S回信把p99从648.8毫秒推到113.8毫秒,除了跑对盘价差,我无法判断。如果有时间,再买一双 Series X 双向会最有帮助。 > > 在纹理室拆除设备12分钟时,已记录为88%,开关未开启。 > > 在 AI 辅助下起草(Claude Code)。 As you asked, I ran a few more tests at Series X. The settings and the build are the same as before; only the switch changed. ## Three more Series X runs (2026-12-01 evening) Same save, same route, same build (`.03` + only this PR), same settings, Series X at 2560x1440 with DLSS Quality and frame generation 2x. Run order: on, off, off. | Run | `VICTORY_CARD_OWNER` | World samples | frame median | p95 | p99 | max | fps median | card over budget (median / max) | Streamline over-VRAM warnings | Outcome | |---|---|---|---|---|---|---|---|---|---|---| | 1 | read | 95 s | 78.5 ms | 103.6 | 249.8 | 250 | 12.7 | +506 / +981 MB | 5,745 | finished | | 2 | unset | 29 s | 69.4 ms | 77.7 | 80.1 | 80 | 14.4 | +41 / +571 MB | 1,552 | **device removed, about 3 min in** | | 3 | unset | 77 s | 70.3 ms | 102.5 | 492.3 | 492 | 14.2 | +204 / +647 MB | 4,780 | **device hung, about 5 min in** | **The crash is the part worth your attention:** with the switch off, both of this evening's runs ended in `0x887A0005` with reason `0x887A0007` (device hung, at about 3 and 5 minutes); with it on, the run finished. An earlier off run on the same profile went 187 s without trouble, so I am not calling this proof of anything — two crashes against one clean run is a small sample, and I have no mechanism to offer for why a shared reading would change it. But if you want a direction to look at, this is the only one in my data that is not just the log line. **Frame times do not separate:** medians 78.5 on against 69.4 and 70.3 off, with the off runs' p99 anywhere from 80 to 492 ms. The over-budget distance does not separate either (+506 on, +41 and +204 off). **On the estimate error:** your load-in split holds in our extracts as well. Outside the first ~35 lines every reading was within 16 MB (Series X) and 15 MB (Series S), and the largest error inside a period was 64 MB, the same as yours. The 175 and 364 MB I reported earlier were all in load-in, so I agree with your reading. Full play logs for these three runs are available if useful. [xrun-X-1-read.log](https://github.com/user-attachments/files/35691780/xrun-X-1-read.log) [xrun-X-2-off-crash3min.log](https://github.com/user-attachments/files/35691791/xrun-X-2-off-crash3min.log) [xrun-X-3-off-crash5min.log](https://github.com/user-attachments/files/35691800/xrun-X-3-off-crash5min.log)
andrewpozdnakov7-jpg commented 2026-12-01 16:01:17 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by andrewpozdnakov7-jpg on 2026-12-01T16:01:17Z.


On 74977c76, a reader can see the fresh DXGI use while it still sees the preceding allocation baseline. That adds the same allocation twice and can make the estimate cross a budget line during publication.

d68953df makes the DXGI values, allocation baseline and timestamps one snapshot. The lock covers only the snapshot copy. The DXGI query runs outside it. A valid sample at startup also stays valid when the clock reads zero.

A focused Windows fixture paused a synthetic sampler during publication. For a 128 MiB allocation, the author code temporarily reported 1,280 MiB instead of 1,152 MiB. The patch reported 1,152 MiB throughout. Two reads at time zero made one query with this patch. Staged asset policy passed. Driver timing and frame pacing still need a hardware run to quantify.

Please keep the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding the change in.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7316903306 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4744#issuecomment-7316903306). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-12-01T16:01:17Z. --- On `74977c76`, a reader can see the fresh DXGI use while it still sees the preceding allocation baseline. That adds the same allocation twice and can make the estimate cross a budget line during publication. [d68953df](https://github.com/andrewpozdnakov7-jpg/VIctory-NVIDIA/commit/d68953df4c50743e37d1d7fecf74f62cef7156e7) makes the DXGI values, allocation baseline and timestamps one snapshot. The lock covers only the snapshot copy. The DXGI query runs outside it. A valid sample at startup also stays valid when the clock reads zero. A focused Windows fixture paused a synthetic sampler during publication. For a 128 MiB allocation, the author code temporarily reported 1,280 MiB instead of 1,152 MiB. The patch reported 1,152 MiB throughout. Two reads at time zero made one query with this patch. Staged asset policy passed. Driver timing and frame pacing still need a hardware run to quantify. Please keep the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding the change in. AI-assisted with OpenAI Codex.
Jesper-Andersson commented 2026-12-01 16:31:52 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Jesper-Andersson on 2026-12-01T16:31:52Z.


@andrewpozdnakov7-jpg thank you, the race is real and your fix is in.

The race. On 74977c76 the thread taking a reading stored the four DXGI values (card.rs:240-242) before the allocation baseline (MADE_THEN, card.rs:243). A caller reading at card.rs:253-254 in that gap gets the fresh used, which already holds what we allocated since the last reading, plus MADE - MADE_THEN against the old baseline, which counts the same bytes again. say() (card.rs:269-271) could log the same mix.

What I checked in d68953df. All of a reading (DXGI values, baseline, frame, time, up_since) is now copied together under one Mutex. The lock is held only for that copy, and the DXGI query and the bookkeeping run outside it. With now_ms() counting from its first call, a reading taken at 0 ms used to look like "no reading yet" and was taken again; now.max(1) keeps it. The card owner: line prints the same fields as before, now from one consistent copy.

One small thing, log only: the copy is taken before the thread wins the query flag, so a thread that wins it right after another one finished settles from the older budget and could count one budget move twice in moves. Re-reading the copy after the flag is won would close it. I left it as is.

Folded in as dde8eb24 on this PR, with your Git author kept.

Tests (dde8eb24, Windows 11, toolchain 1.98.1 from rust-toolchain.toml):

  • cargo test --locked -p victory-gpu --lib card: 76 passed, 0 failed, 8 ignored.
  • cargo clippy --workspace --all-targets --locked -- -D warnings: fails only on five lints in host/font.rs, host/menu.rs and host/panel.rs, which come from main (3bde49236) and are the same five that failed the check job on the previous commit (the run for dde8eb24 is still pending). Nothing in card.rs.
  • Not run in the game yet: no frame times or crash behaviour with this change.

@kraiy404 thank you for the three extra Series X runs. Two hangs with the switch off against one clean run with it on is worth keeping in mind. Like you, I don't see how a shared reading would cause or prevent a device hang, so I'm not drawing a conclusion from it yet.

Drafted with AI assistance (Claude Code).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7317759863 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4744#issuecomment-7317759863). Originally posted by [Jesper-Andersson](https://github.com/Jesper-Andersson) on 2026-12-01T16:31:52Z. --- @andrewpozdnakov7-jpg thank you, the race is real and your fix is in. **The race.** On 74977c76 the thread taking a reading stored the four DXGI values (`card.rs:240-242`) before the allocation baseline (`MADE_THEN`, `card.rs:243`). A caller reading at `card.rs:253-254` in that gap gets the fresh `used`, which already holds what we allocated since the last reading, plus `MADE - MADE_THEN` against the old baseline, which counts the same bytes again. `say()` (`card.rs:269-271`) could log the same mix. **What I checked in d68953df.** All of a reading (DXGI values, baseline, frame, time, `up_since`) is now copied together under one `Mutex`. The lock is held only for that copy, and the DXGI query and the bookkeeping run outside it. With `now_ms()` counting from its first call, a reading taken at 0 ms used to look like "no reading yet" and was taken again; `now.max(1)` keeps it. The `card owner:` line prints the same fields as before, now from one consistent copy. One small thing, log only: the copy is taken before the thread wins the query flag, so a thread that wins it right after another one finished settles from the older budget and could count one budget move twice in `moves`. Re-reading the copy after the flag is won would close it. I left it as is. **Folded in** as dde8eb24 on this PR, with your Git author kept. **Tests** (dde8eb24, Windows 11, toolchain 1.98.1 from `rust-toolchain.toml`): - `cargo test --locked -p victory-gpu --lib card`: 76 passed, 0 failed, 8 ignored. - `cargo clippy --workspace --all-targets --locked -- -D warnings`: fails only on five lints in `host/font.rs`, `host/menu.rs` and `host/panel.rs`, which come from main (3bde49236) and are the same five that failed the `check` job on the previous commit (the run for dde8eb24 is still pending). Nothing in `card.rs`. - Not run in the game yet: no frame times or crash behaviour with this change. @kraiy404 thank you for the three extra Series X runs. Two hangs with the switch off against one clean run with it on is worth keeping in mind. Like you, I don't see how a shared reading would cause or prevent a device hang, so I'm not drawing a conclusion from it yet. Drafted with AI assistance (Claude Code).
andrewpozdnakov7-jpg commented 2026-12-01 16:39:13 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by andrewpozdnakov7-jpg on 2026-12-01T16:39:13Z.


Thanks for taking the snapshot fix. I followed up on the stale copy you spotted at dde8eb24.

820c696f rechecks the snapshot, frame and event after winning the query flag. If another caller already refreshed it, this caller uses the new reading. A query that is still due starts from the latest budget and allocation baseline.

In a focused Windows fixture with a stub DXGI query, a caller paused between reading the snapshot and acquiring the flag. For startup plus one frame with a budget drop, the author head made three queries and counted two moves. With the patch it made two queries and counted one move. Event-triggered refresh and retry after a failed query still worked. Staged asset policy passed.

Please keep the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding the change in.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7317969143 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4744#issuecomment-7317969143). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-12-01T16:39:13Z. --- Thanks for taking the snapshot fix. I followed up on the stale copy you spotted at `dde8eb24`. [820c696f](https://github.com/andrewpozdnakov7-jpg/VIctory-NVIDIA/commit/820c696f903cd3904dd32c647074ba568d2e3044) rechecks the snapshot, frame and event after winning the query flag. If another caller already refreshed it, this caller uses the new reading. A query that is still due starts from the latest budget and allocation baseline. In a focused Windows fixture with a stub DXGI query, a caller paused between reading the snapshot and acquiring the flag. For startup plus one frame with a budget drop, the author head made three queries and counted two moves. With the patch it made two queries and counted one move. Event-triggered refresh and retry after a failed query still worked. Staged asset policy passed. Please keep the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding the change in. AI-assisted with OpenAI Codex.
trustno1-coder commented 2026-12-01 18:33:42 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:33:42Z.


Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7321141077 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4744#issuecomment-7321141077). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:33:42Z. --- Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

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
trustno1-coder/VIctory-NVIDIA!4744
No description provided.