GPU: one aligned copy per unaligned SRV range per list (follow-up to #986) #1260

Closed
DaemonSimon wants to merge 2 commits from upstream-pr/1260 into main
DaemonSimon commented 2026-11-24 16:52:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DaemonSimon on 2026-11-24T16:52:43Z.


Depends on: #986 (this branch is #986 plus one commit; only the last commit is new).

What

#986 copies an unaligned buffer SRV's bytes into fresh scratch memory for every draw that reads it. In the world that adds up fast: about 286k copies (35 GB) within a few minutes. GTT filled to 15 GB, RADV refused further submissions ("not enough memory") and the device was removed.

This commit makes draws of one command list that read the same unaligned range share a single aligned copy, kept until the list is reset. The fix #986 brings (no shader reading address 0 through an empty view) is unchanged.

Result

  • Without #986: the hit-detection compute pass read an empty view and page-faulted the GPU about 80 s into the world.
  • #986 alone: no page fault, but GPU memory ran out after a few minutes (device removed).
  • #986 + this commit: 6.4 minutes in the world with no page fault and no device removal; GTT stays at about 4.6 GB. Frame rate is close to the baseline (3.4 vs 4.0 fps).

Testing

  • Linux, AMD RX 9070 XT (RADV), Wine 11 with Proton Experimental's vkd3d-proton and DXVK's dxgi, on top of #994. Retail boot through the start screen into the first mission.
  • cargo check -p victory-gpu --target x86_64-pc-windows-msvc on this branch (#986 + this commit) is clean.
  • No game data, logs or captures are included.

AI-assisted: written and tested with Claude Code.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6586962198 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1260). Originally posted by [DaemonSimon](https://github.com/DaemonSimon) on 2026-11-24T16:52:43Z. --- Depends on: #986 (this branch is #986 plus one commit; only the last commit is new). ## What #986 copies an unaligned buffer SRV's bytes into fresh scratch memory for every draw that reads it. In the world that adds up fast: about 286k copies (35 GB) within a few minutes. GTT filled to 15 GB, RADV refused further submissions ("not enough memory") and the device was removed. This commit makes draws of one command list that read the same unaligned range share a single aligned copy, kept until the list is reset. The fix #986 brings (no shader reading address 0 through an empty view) is unchanged. ## Result - Without #986: the hit-detection compute pass read an empty view and page-faulted the GPU about 80 s into the world. - #986 alone: no page fault, but GPU memory ran out after a few minutes (device removed). - #986 + this commit: 6.4 minutes in the world with no page fault and no device removal; GTT stays at about 4.6 GB. Frame rate is close to the baseline (3.4 vs 4.0 fps). ## Testing - Linux, AMD RX 9070 XT (RADV), Wine 11 with Proton Experimental's vkd3d-proton and DXVK's dxgi, on top of #994. Retail boot through the start screen into the first mission. - `cargo check -p victory-gpu --target x86_64-pc-windows-msvc` on this branch (#986 + this commit) is clean. - No game data, logs or captures are included. AI-assisted: written and tested with Claude Code. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
justlovett0 commented 2026-11-24 18:05:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by justlovett0 on 2026-11-24T17:32:39Z.


Verified on Win10 21H2 / RTX 3080 (driver 621.24) stacked with #986 and #1267: world went ~1 fps → 20 fps, copies 270–400 MB/frame → 0.4 MB, and the ~2–3 min device removal disappeared (0 in a ~2.3 min world run). Combined result and setup detailed on #986. AI use: Qwen Code (model name not disclosed); user-confirmed.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7139352520 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1260#issuecomment-7139352520). Originally posted by [justlovett0](https://github.com/justlovett0) on 2026-11-24T17:32:39Z. --- Verified on Win10 21H2 / RTX 3080 (driver 621.24) stacked with #986 and #1267: world went ~1 fps → 20 fps, copies 270–400 MB/frame → 0.4 MB, and the ~2–3 min device removal disappeared (0 in a ~2.3 min world run). Combined result and setup detailed on #986. AI use: Qwen Code (model name not disclosed); user-confirmed.
BitWuehler commented 2026-11-24 21:03:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BitWuehler on 2026-11-24T20:06:35Z.


Confirmed on Linux (GE-Proton11-14 via umu-run) + NVIDIA RTX 5080 (driver 620.73.04, CachyOS 7.3.6-1-cachyos, retail 1.0.2.1, diag build):

  • Merged cleanly with #994 + #177 + #454 + #1267 (plus a local MIN_DYNAMIC = 1 << 18 #747 test).
  • The buffer view not on an element of its host copy warning (offset=10561216 element=12) seen on our earlier #206 run dropped to 0.
  • 0 GPU faults, 0 device removals (0x887A0006), and 0 kernel Xids/OOMs over ~4.5 min of active world rendering (up to frame=1443, median 2,076 draws/frame, before a silent title hang with VICTORY_NO_WATCHDOG=1).

(Detailed A/B metrics posted in #1267 and #747. AI-assisted log summary; own retail copy, no game files or raw logs attached.)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7143053325 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1260#issuecomment-7143053325). Originally posted by [BitWuehler](https://github.com/BitWuehler) on 2026-11-24T20:06:35Z. --- Confirmed on **Linux (`GE-Proton11-14` via `umu-run`) + NVIDIA RTX 5080** (`driver 620.73.04`, CachyOS `7.3.6-1-cachyos`, retail `1.0.2.1`, `diag` build): - Merged cleanly with `#994 + #177 + #454 + #1267` (plus a local `MIN_DYNAMIC = 1 << 18` #747 test). - The `buffer view not on an element of its host copy` warning (`offset=10561216 element=12`) seen on our earlier `#206` run dropped to **`0`**. - **0** GPU faults, **0** device removals (`0x887A0006`), and **0** kernel Xids/OOMs over ~4.5 min of active world rendering (up to `frame=1443`, median `2,076` draws/frame, before a silent title hang with `VICTORY_NO_WATCHDOG=1`). *(Detailed A/B metrics posted in #1267 and #747. AI-assisted log summary; own retail copy, no game files or raw logs attached.)*
upstream-sync closed this pull request 2026-11-25 01:06:04 +00:00
Marvisak commented 2026-11-25 01:08:06 +00:00 (Migrated from github.com)

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


Automated triage for the maintainers. Closing because this change is already in main, or main has since replaced the code it patches.

Follow-up to #986 (one aligned copy per range per list); main keeps one copy per view range held by its slot (shadow::exact).

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148678857 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1260#issuecomment-7148678857). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:35:55Z. --- Automated triage for the maintainers. Closing because this change is already in `main`, or `main` has since replaced the code it patches. Follow-up to #986 (one aligned copy per range per list); main keeps one copy per view range held by its slot (shadow::exact). If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

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
Marvisak/VIctory!1260
No description provided.