descriptor: placed views ignore padding words (views leak, confetti on faces) #58

Manually merged
github merged 4 commits from github-bot/gh-58 into main 2026-11-27 20:09:57 +00:00 AGit
Owner

@⁠regiumlepidi on GitHub · 2026-11-27 15:27 UTC · original
regiumlepidi:pr-t1-views → main · +231 −4 · 2 files · 4 commits · merged 2026-11-27 20:07 UTC

What this fixes

The title sometimes leaves words 1 and 13 of the 56-byte resource description unwritten when it creates placed views (device methods 0x230/0x238). Those two words are padding, but the view table keys on the whole description, so the same view arrives with different bytes and becomes a new entry every time. Nothing ever releases those entries.

On my machine, at 1440p on the Series X profile:

  • the table reached 2.3 million kept views (about 2.1 GB) in a 15-minute session and kept growing;
  • free PC memory fell to 1.3 GB, Windows started paging, and the late part of the session dropped to 17-20 fps;
  • faces in the opening cutscene showed coloured squares ("confetti") in 3 of 5 captured frames.

With these commits, on the same build and settings:

Before After
Memory held by the layer 3.8 GB 1.5 GB
Free PC memory at the end of the session 1.6-2 GB 3.7-4 GB
Confetti on the faces in the opening cutscene 3 of 5 frames 0 of 8 frames

I can't give a clean fps number yet: the two sessions ended in different scenes (about 7,500 draws against 4,300), and frame time here follows draw count.

The commits

  1. Placed views ignore the padding words. Only the named fields of the resource description are copied, and the padding is zero. Const asserts check the D3D12 offsets: alignment at 8, flags at 48, size 56.
  2. At most a million table entries of views that no resource releases.
  3. Placed views leave out the view words their kind does not use.
  4. Test fix. views_at_new_addresses_add_no_entries built its resource description with non-zero padding words, which commit 1 now zeroes on purpose. The test now keeps words 1 and 13 at zero.

The first three come from JMAN730/project-flamingo (b1e0cd1d, merged there through PR #620) by way of Vice-Tay's fork (f07e54a, d3626d2, ce91490). I left out a fourth commit from that fork (18bc367, which keys the index by hash) because it conflicted here and I didn't want to resolve it blind.

Tests

cargo test -p victory-gpu --lib descriptor passes on this branch.

Setup

RTX 5070 Ti 16 GB, driver 617.42, Ryzen 7 9800X3D, 48 GB, Windows 11. Series X profile, 2560x1440, DLSS Quality. My own dump: <game dir>. No game files are attached or quoted.

This change and its testing were done with an AI assistant (Claude Code), and I checked the results on my machine.

🤖 Generated with Claude Code

**@⁠regiumlepidi** on GitHub · 2026-11-27 15:27 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/58) `regiumlepidi:pr-t1-views` → `main` · +231 −4 · 2 files · 4 commits · merged 2026-11-27 20:07 UTC ## What this fixes The title sometimes leaves words 1 and 13 of the 56-byte resource description unwritten when it creates placed views (device methods 0x230/0x238). Those two words are padding, but the view table keys on the whole description, so the same view arrives with different bytes and becomes a new entry every time. Nothing ever releases those entries. On my machine, at 1440p on the Series X profile: - the table reached 2.3 million kept views (about 2.1 GB) in a 15-minute session and kept growing; - free PC memory fell to 1.3 GB, Windows started paging, and the late part of the session dropped to 17-20 fps; - faces in the opening cutscene showed coloured squares ("confetti") in 3 of 5 captured frames. With these commits, on the same build and settings: | | Before | After | |---|---|---| | Memory held by the layer | 3.8 GB | 1.5 GB | | Free PC memory at the end of the session | 1.6-2 GB | 3.7-4 GB | | Confetti on the faces in the opening cutscene | 3 of 5 frames | 0 of 8 frames | I can't give a clean fps number yet: the two sessions ended in different scenes (about 7,500 draws against 4,300), and frame time here follows draw count. ## The commits 1. **Placed views ignore the padding words.** Only the named fields of the resource description are copied, and the padding is zero. Const asserts check the D3D12 offsets: alignment at 8, flags at 48, size 56. 2. **At most a million table entries** of views that no resource releases. 3. **Placed views leave out the view words their kind does not use.** 4. **Test fix.** `views_at_new_addresses_add_no_entries` built its resource description with non-zero padding words, which commit 1 now zeroes on purpose. The test now keeps words 1 and 13 at zero. The first three come from JMAN730/project-flamingo (b1e0cd1d, merged there through PR #620) by way of Vice-Tay's fork (f07e54a, d3626d2, ce91490). I left out a fourth commit from that fork (18bc367, which keys the index by hash) because it conflicted here and I didn't want to resolve it blind. ## Tests `cargo test -p victory-gpu --lib descriptor` passes on this branch. ## Setup RTX 5070 Ti 16 GB, driver 617.42, Ryzen 7 9800X3D, 48 GB, Windows 11. Series X profile, 2560x1440, DLSS Quality. My own dump: `<game dir>`. No game files are attached or quoted. This change and its testing were done with an AI assistant (Claude Code), and I checked the results on my machine. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The title may leave words 1 and 13 of the 56-byte resource description it passes to device methods 0x230/0x238 unwritten, so the same view came in with different bytes there and every one was a new shape: the 2^22 shapes were full after half an hour, after which each placed view was a table entry kept for the run (34.9 million, 16.7 GB after 70 minutes on Series S). Only the named fields are copied now; the padding is zero.

From JMAN730/project-flamingo b1e0cd1d (merged there through PR #620), with its test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit f07e54a2bf2a6d925a7c535c2b5ee24d07b5872c)
Once the shapes of placed views are full (4,194,304 after half an hour of play), every placed view the title writes became a table entry kept for the run: 34.9 million entries and 16.7 GB after 70 minutes on Series S, with the frame rate halved as memory went past physical RAM. Such entries now sit in a queue, oldest first; past VICTORY_OWNERLESS_VIEWS (default 1,048,576; 0 keeps all) the oldest is freed under a new generation, so a descriptor still naming it reads as stale, as one naming a released resource's view does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit d3626d257d19ac0d00440ea5efd061a0006521d0)
Run vt-shapes logged which words tell placed-view shapes apart. Past the resource description's padding (words 1 and 13), the view description's padding word 3 (shader resource views: the union starts on 8 bytes) took 131,392 values and word 9 (the union's unused tail) 36,413 in a million shapes: the title leaves them unwritten, so the same view was a new shape each time. Those words are now zero for each dimension (D3D12_BUFFER_SRV, D3D12_TEX2D_SRV and the like say which words of the union are used); an unknown dimension keeps every word.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit ce914907fbbe4eada57cf430e0da54ae48b4be47)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 15:36:37 +00:00
Author
Owner

@⁠CuteBooty on GitHub · 2026-11-27 16:03 UTC · original

Independent confirmation from different hardware, in case it helps the review. I had arrived at the same cause separately and was about to open a PR for it when I saw this one, so I'm adding the numbers here instead.

Important: these numbers are from my own local patch of the same idea, not from this branch. Mine zeroes resource words 1 and 13, word 3 of SRV descriptions and word 9 of buffer views before the placed-view shape is looked up. It has no cap on ownerless entries. I have not built or run this PR's code.

Setup: RTX 3070 8 GB (driver 621.24), Ryzen 5 3600, 32 GB, Windows 11. Series S profile, 1920x1080, no DLSS, built from source. Ordinary open-world play from a story save, driving and flying.

Without (1010e023 + diagnostics, 30 min) With (d12eb1b2 + the patch, 37 min)
Placed-view shapes kept 4,188,419 of 4,194,304 (table full inside 30 min) 121,022
Placed views that fell through to table entries after the table filled 246,627 0
Process private memory at 10 / 20 / 30 min 21.4 / 23.0 / 23.4 GB 20.7 / 20.7 / 20.9 GB

What a per-word counter showed here before the fix: buffer views fill the table, not texture views, and the words carrying full-range garbage were resource words 1 and 13 and description words 3 (SRV) and 9. Zeroing the first element as well merged nothing further, so the padding is the whole story on this title. That matches what this PR's commits 1 and 3 zero.

No new picture fault in the 37 minutes with the padding zeroed. One session each, on different routes and different base commits, so read the memory row as indicative only; the shape counts are the solid part. Private memory still rose about 2 GB in the last six minutes of the second session with the shape table small, so there is some other grower that this does not address; I have not found its cause.

Not tested here: this PR's ownerless cap, Series X, AMD or Intel cards.

Measurements and this note were prepared with an AI assistant (Claude Code); the runs were played on my machine.

**@⁠CuteBooty** on GitHub · 2026-11-27 16:03 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/58#issuecomment-7222803860) Independent confirmation from different hardware, in case it helps the review. I had arrived at the same cause separately and was about to open a PR for it when I saw this one, so I'm adding the numbers here instead. **Important: these numbers are from my own local patch of the same idea, not from this branch.** Mine zeroes resource words 1 and 13, word 3 of SRV descriptions and word 9 of buffer views before the placed-view shape is looked up. It has no cap on ownerless entries. I have not built or run this PR's code. Setup: RTX 3070 8 GB (driver 621.24), Ryzen 5 3600, 32 GB, Windows 11. Series S profile, 1920x1080, no DLSS, built from source. Ordinary open-world play from a story save, driving and flying. | | Without (1010e023 + diagnostics, 30 min) | With (d12eb1b2 + the patch, 37 min) | |---|---|---| | Placed-view shapes kept | 4,188,419 of 4,194,304 (table full inside 30 min) | 121,022 | | Placed views that fell through to table entries after the table filled | 246,627 | 0 | | Process private memory at 10 / 20 / 30 min | 21.4 / 23.0 / 23.4 GB | 20.7 / 20.7 / 20.9 GB | What a per-word counter showed here before the fix: buffer views fill the table, not texture views, and the words carrying full-range garbage were resource words 1 and 13 and description words 3 (SRV) and 9. Zeroing the first element as well merged nothing further, so the padding is the whole story on this title. That matches what this PR's commits 1 and 3 zero. No new picture fault in the 37 minutes with the padding zeroed. One session each, on different routes and different base commits, so read the memory row as indicative only; the shape counts are the solid part. Private memory still rose about 2 GB in the last six minutes of the second session with the shape table small, so there is some other grower that this does not address; I have not found its cause. Not tested here: this PR's ownerless cap, Series X, AMD or Intel cards. Measurements and this note were prepared with an AI assistant (Claude Code); the runs were played on my machine.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-27 16:32 UTC · original · approved these changes

LGTM — verified on Windows (RTX 5090):

  • Zeroing unused/padding words in placed resource and view descriptions and capping ownerless view entries (VICTORY_OWNERLESS_VIEWS, default 1M) cleanly prevents unbounded table growth while keeping resource-backed views intact
  • cargo test -p victory-gpu --lib descriptor:: passed (61/61, including ownerless_entries_are_capped, placed_views_ignore_unused_view_words, and placed_views_share_resources_across_description_padding)
  • 0 new compiler warnings in touched files
  • cargo xtask policy passed (279 files ok)

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-27 16:32 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/58#pullrequestreview-6091029237) · **approved these changes** LGTM — verified on Windows (RTX 5090): - Zeroing unused/padding words in placed resource and view descriptions and capping ownerless view entries (`VICTORY_OWNERLESS_VIEWS`, default 1M) cleanly prevents unbounded table growth while keeping resource-backed views intact - `cargo test -p victory-gpu --lib descriptor::` passed (61/61, including `ownerless_entries_are_capped`, `placed_views_ignore_unused_view_words`, and `placed_views_share_resources_across_description_padding`) - 0 new compiler warnings in touched files - `cargo xtask policy` passed (`279 files ok`) Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠JohnTitor2003 on GitHub · 2026-11-27 16:47 UTC · original

Independent confirmation on a 32 GB PC, plus the fourth commit resolved.

Setup: RTX 5080 16 GB (driver 617.42), Ryzen 9 7950X, 32 GB RAM, Windows 11. Built from source at d12eb1b2. Series X profile, 2560x1440, DLSS Quality, frame generation off, the launcher's defaults. My own dump; no game files attached.

What I ran: not this branch as it stands, but the same three Vice-Tay commits (d3626d2, f07e54a, ce91490) cherry-picked onto d12eb1b2, plus the fourth one this PR left out (18bc367, the shape index keyed by the shape's hash) and Vice-Tay's test update (f1f5221).

Result (private bytes of the process, sampled every 2 s with typeperf):

Minutes in main (d12eb1b2) with the four commits
4 27.5 GB 28.6 GB
8 27.9 GB 28.3 GB
12 28.8 GB 28.3 GB
16 30.8 GB 29.2 GB
20 35.1 GB 29.3 GB
  • On main the frame rate followed the memory: 28-29 fps for the first ten minutes, 19 at 16 minutes, 14 at 20, with Windows reading about 8,800 pages a second back from disk once the process was at 36 GB. A restart brought both back, and the same climb began again.
  • With the commits the frame rate stayed at 17-19 fps for the whole 20 minutes, and free RAM rose from 0.4 GB to 2.9 GB.
  • Caveat: one run each, and not in the same place (main: the first boat mission, about 3,900 draws a frame; patched: around Jason's house, 7,000-8,000 draws a frame). So the memory curves compare; the fps levels do not, only their shape over time.

On a 32 GB PC this is the difference between about 15 playable minutes and a whole session.

The fourth commit. 18bc367 conflicts here in one hunk only, at the end of Views::shape: main has self.shape_index.insert(shape, at), the commit has insert(key, at) followed by known_shape and a diagnostics-only log_shape_words. Taking the incoming side resolves it; nothing else needed changing. With it cargo test -p victory-gpu --lib descriptor passes (61 tests), and the 20-minute run above includes it. I can open it as a follow-up pull request on top of this one if that is useful.

Two indirect::tests fail on my machine on unmodified main as well as with these commits (host_list_budget_starts_empty_at_each_submission, warp_batch_charges_every_execution); they are unrelated to this change.

The credit for the fix is Vice-Tay's and project-flamingo's, as the description says; what I'm adding is a measurement on 32 GB and the conflict resolution.

Tested and written with an AI assistant (Claude Code); the runs were on my machine.

**@⁠JohnTitor2003** on GitHub · 2026-11-27 16:47 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/58#issuecomment-7223674493) Independent confirmation on a 32 GB PC, plus the fourth commit resolved. **Setup:** RTX 5080 16 GB (driver 617.42), Ryzen 9 7950X, 32 GB RAM, Windows 11. Built from source at d12eb1b2. Series X profile, 2560x1440, DLSS Quality, frame generation off, the launcher's defaults. My own dump; no game files attached. **What I ran:** not this branch as it stands, but the same three Vice-Tay commits (d3626d2, f07e54a, ce91490) cherry-picked onto d12eb1b2, plus the fourth one this PR left out (18bc367, the shape index keyed by the shape's hash) and Vice-Tay's test update (f1f5221). **Result** (private bytes of the process, sampled every 2 s with typeperf): | Minutes in | main (d12eb1b2) | with the four commits | |---|---|---| | 4 | 27.5 GB | 28.6 GB | | 8 | 27.9 GB | 28.3 GB | | 12 | 28.8 GB | 28.3 GB | | 16 | 30.8 GB | 29.2 GB | | 20 | 35.1 GB | 29.3 GB | - On main the frame rate followed the memory: 28-29 fps for the first ten minutes, 19 at 16 minutes, 14 at 20, with Windows reading about 8,800 pages a second back from disk once the process was at 36 GB. A restart brought both back, and the same climb began again. - With the commits the frame rate stayed at 17-19 fps for the whole 20 minutes, and free RAM rose from 0.4 GB to 2.9 GB. - Caveat: one run each, and not in the same place (main: the first boat mission, about 3,900 draws a frame; patched: around Jason's house, 7,000-8,000 draws a frame). So the memory curves compare; the fps levels do not, only their shape over time. On a 32 GB PC this is the difference between about 15 playable minutes and a whole session. **The fourth commit.** 18bc367 conflicts here in one hunk only, at the end of `Views::shape`: main has `self.shape_index.insert(shape, at)`, the commit has `insert(key, at)` followed by `known_shape` and a diagnostics-only `log_shape_words`. Taking the incoming side resolves it; nothing else needed changing. With it `cargo test -p victory-gpu --lib descriptor` passes (61 tests), and the 20-minute run above includes it. I can open it as a follow-up pull request on top of this one if that is useful. Two `indirect::tests` fail on my machine on unmodified main as well as with these commits (`host_list_budget_starts_empty_at_each_submission`, `warp_batch_charges_every_execution`); they are unrelated to this change. The credit for the fix is Vice-Tay's and project-flamingo's, as the description says; what I'm adding is a measurement on 32 GB and the conflict resolution. Tested and written with an AI assistant (Claude Code); the runs were on my machine.
github manually merged commit 502f54ce84 into main 2026-11-27 20:09:57 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.