Stop the placed-view leak; fixes from other forks #27

Merged
TaynanGT merged 0 commits from upstream-pr/27 into main 2026-11-26 12:37:16 +00:00
TaynanGT commented 2026-11-26 12:31:59 +00:00 (Migrated from git.gtahub.st)

Imported from TaynanGT/Vice-Tay-v2. Originally posted by TaynanGT on 2026-11-26T12:31:59Z.


@⁠TaynanGT on GitHub · 2026-11-26 12:28 UTC · original
TaynanGT:fix/placed-view-leak → main · +656 −68 · 13 files · 14 commits · merged 2026-11-26 12:32 UTC

Stops the placed-view memory leak and brings in fixes from other forks.

The leak

Placed views (device methods 0x230/0x238) are keyed by address plus a shape number. The title leaves padding words unwritten, so the same view kept arriving with different garbage in them and minted a new shape each time. After about 30 minutes the shape space (2^22) filled up and every further view became a permanent view-table entry: 34.9 million entries and 16.7 GB after 70 minutes, private memory past physical RAM, frame preparation doubled, fps fell from ~20 to ~8–10.

A diagnostic build counted distinct values per word over the first million shapes. The noisy ones were all padding:

word distinct values
resource desc word 1 (padding after Dimension) 33,403
resource desc word 13 (padding after Flags) 12,846
SRV word 3 (padding after Shader4ComponentMapping) 131,392
view word 9 (unused tail of the union) 36,413

Fixes:

  • f07e54a2 zeroes resource-description words 1 and 13 before keying (same finding as avatarmanz PR #206).
  • ce914907 zeroes the union words each SRV/UAV dimension doesn't use, and SRV word 3; unknown dimensions keep every word.
  • d3626d25 caps view-table entries no resource releases at 1M (VICTORY_OWNERLESS_VIEWS, 0 keeps all), oldest first.
  • 40e9ea19 keeps per-kind counts so the periodic memory line no longer walks the whole table (it took up to 49 ms at 30M entries).
  • e7dee0fc logs the per-word counts at 1K/16K/128K/1M shapes (diagnostics builds only).

Other fixes

  • 31e8d23c, b883e5e0: dynamic descriptor slots go back to the pool when their flight lands (the pool of 2^18 ran dry under load and the picture turned white); the frame line reports slots taken.
  • d15d8e7b: BC7 dictionary entry 0 reads all 32 indices.
  • b7a99ac4 (Senchsus, upstream #682): v_mul_legacy_f32 treats denormal operands as zero.
  • d8247162 (PastiiJay): optional NaN guard on colour exports and typed stores (VICTORY_NAN_GUARD, part of the shader cache key).
  • 1bf62e10 (beloooo): magenta left in the ambient probes is not treated as light.
  • dbfb5a97 (Flare, upstream #2031): heap samplers keep point mips when anisotropic.
  • d8f70e3b, f1f52219: build and test follow-ups.

Measured

RTX 4090, Ryzen 9 9950X3D, Series S profile, 30 minutes in the world, compared with the 70-minute run on main:

main (70 min) this branch (30 min)
private memory, median / max 39.4 / 52.3 GB 27.2 / 27.4 GB
card memory max 18.4 GB 12.5 GB
placed-view shapes kept 4,194,304 (full) ~69,000
fps median / p10 / 1% low 12.9 / 8.3 / 5.0 20.5 / 17.6 / 11.2

Over the same first 30 minutes the median went from 18.1 fps on main to 20.6 here, and this branch no longer degrades with time. Square blocks in clouds are still there.

Checks

ci-local.ps1: clippy with and without all features, workspace tests.

🤖 Generated with Claude Code

<!-- greyfinch-sync:TaynanGT/Vice-Tay-v2:issue:12665 --> Imported from [TaynanGT/Vice-Tay-v2](https://git.gtahub.st/github/TaynanGT--Vice-Tay-v2/pulls/27). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-26T12:31:59Z. --- **@⁠TaynanGT** on GitHub · 2026-11-26 12:28 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/27) `TaynanGT:fix/placed-view-leak` → `main` · +656 −68 · 13 files · 14 commits · merged 2026-11-26 12:32 UTC Stops the placed-view memory leak and brings in fixes from other forks. ## The leak Placed views (device methods 0x230/0x238) are keyed by address plus a shape number. The title leaves padding words unwritten, so the same view kept arriving with different garbage in them and minted a new shape each time. After about 30 minutes the shape space (2^22) filled up and every further view became a permanent view-table entry: 34.9 million entries and 16.7 GB after 70 minutes, private memory past physical RAM, frame preparation doubled, fps fell from ~20 to ~8–10. A diagnostic build counted distinct values per word over the first million shapes. The noisy ones were all padding: | word | distinct values | |---|---| | resource desc word 1 (padding after Dimension) | 33,403 | | resource desc word 13 (padding after Flags) | 12,846 | | SRV word 3 (padding after Shader4ComponentMapping) | 131,392 | | view word 9 (unused tail of the union) | 36,413 | Fixes: - `f07e54a2` zeroes resource-description words 1 and 13 before keying (same finding as avatarmanz PR #206). - `ce914907` zeroes the union words each SRV/UAV dimension doesn't use, and SRV word 3; unknown dimensions keep every word. - `d3626d25` caps view-table entries no resource releases at 1M (`VICTORY_OWNERLESS_VIEWS`, 0 keeps all), oldest first. - `40e9ea19` keeps per-kind counts so the periodic memory line no longer walks the whole table (it took up to 49 ms at 30M entries). - `e7dee0fc` logs the per-word counts at 1K/16K/128K/1M shapes (diagnostics builds only). ## Other fixes - `31e8d23c`, `b883e5e0`: dynamic descriptor slots go back to the pool when their flight lands (the pool of 2^18 ran dry under load and the picture turned white); the frame line reports slots taken. - `d15d8e7b`: BC7 dictionary entry 0 reads all 32 indices. - `b7a99ac4` (Senchsus, upstream #682): `v_mul_legacy_f32` treats denormal operands as zero. - `d8247162` (PastiiJay): optional NaN guard on colour exports and typed stores (`VICTORY_NAN_GUARD`, part of the shader cache key). - `1bf62e10` (beloooo): magenta left in the ambient probes is not treated as light. - `dbfb5a97` (Flare, upstream #2031): heap samplers keep point mips when anisotropic. - `d8f70e3b`, `f1f52219`: build and test follow-ups. ## Measured RTX 4090, Ryzen 9 9950X3D, Series S profile, 30 minutes in the world, compared with the 70-minute run on main: | | main (70 min) | this branch (30 min) | |---|---|---| | private memory, median / max | 39.4 / 52.3 GB | 27.2 / 27.4 GB | | card memory max | 18.4 GB | 12.5 GB | | placed-view shapes kept | 4,194,304 (full) | ~69,000 | | fps median / p10 / 1% low | 12.9 / 8.3 / 5.0 | 20.5 / 17.6 / 11.2 | Over the same first 30 minutes the median went from 18.1 fps on main to 20.6 here, and this branch no longer degrades with time. Square blocks in clouds are still there. ## Checks `ci-local.ps1`: clippy with and without all features, workspace tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chatgpt-codex-connector[bot] commented 2026-11-26 12:32:01 +00:00 (Migrated from git.gtahub.st)

Imported from TaynanGT/Vice-Tay-v2. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T12:32:01Z.


@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-26 12:28 UTC · original · edited 2026-11-26 12:32 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T12:31:17.494287Z f1f5221 PR opened
🔒 Security Review ✅ Completed 2026-11-26T12:32:12.346198Z f1f5221 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:TaynanGT/Vice-Tay-v2:comment:187944 --> Imported from [TaynanGT/Vice-Tay-v2](https://git.gtahub.st/github/TaynanGT--Vice-Tay-v2/pulls/27#issuecomment-187944). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-26T12:32:01Z. --- **@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-26 12:28 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/27#issuecomment-7192052876) · edited 2026-11-26 12:32 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"f1f52219ecbc1ed6750661871f7aab33f7d41b74","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":"f1f52219ecbc1ed6750661871f7aab33f7d41b74","has_any_findings":null,"has_unresolved_findings":null,"status":"completed"}} --> <!-- codex-security-review:v1 {"blockingSeverityThreshold":"P0","headSha":"f1f52219ecbc1ed6750661871f7aab33f7d41b74","mergeGateEnabled":false,"pullRequestNumber":27,"repository":"TaynanGT/Vice-Tay","status":"completed"} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-26T12:31:17.494287Z">2026-11-26T12:31:17.494287Z</relative-time> | `f1f5221` | PR opened | | 🔒 **Security Review** | ✅ **Completed** <relative-time datetime="2026-11-26T12:32:12.346198Z">2026-11-26T12:32:12.346198Z</relative-time> | `f1f5221` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
chatgpt-codex-connector[bot] commented 2026-11-26 12:32:01 +00:00 (Migrated from git.gtahub.st)

Imported from TaynanGT/Vice-Tay-v2. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T12:32:01Z.


@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-26 12:31 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f1f52219ec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback".

<!-- greyfinch-sync:TaynanGT/Vice-Tay-v2:comment:187945 --> Imported from [TaynanGT/Vice-Tay-v2](https://git.gtahub.st/github/TaynanGT--Vice-Tay-v2/pulls/27#issuecomment-187945). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-26T12:32:01Z. --- **@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-26 12:31 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/27#pullrequestreview-6074160059) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `f1f52219ec` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback". </details>
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
TaynanGT/Vice-Tay-v2!27
No description provided.