Skip to content

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

Closed
DaemonSimon wants to merge 2 commits into
Marvisak:mainfrom
DaemonSimon:fix-986-copy-once
Closed

DaemonSimon wants to merge 2 commits into
Marvisak:mainfrom
DaemonSimon:fix-986-copy-once

Conversation

@DaemonSimon

Copy link
Copy Markdown

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

Testing

AI-assisted: written and tested with Claude Code.

🤖 Generated with Claude Code

CitizenCinema and others added 2 commits November 24, 2026 15:36
Placed structured buffer SRVs sub-allocated inside a larger title buffer can land at shadow offsets not divisible by StructureByteStride (e.g. offset % 56 != 0 in GTA VI hit detection). buffer_srv() rejected these views, leaving null_buffer_view (zeros) in the host descriptor slot. Detect unaligned buffer SRVs, promote their descriptor table to fresh dynamic slots, copy their bytes at submission into an element-aligned upload scratch slice, and bind an SRV with FirstElement = at / element.
PR Marvisak#986 copied an unaligned buffer SRV's bytes into fresh scratch memory
for every draw reading it: 286k copies (35 GB) in a few minutes of the
world, GTT filled to 15 GB and RADV refused submissions (not enough
memory, device removed). Draws of one list reading the same range now
share one copy, kept until the list is reset. GTT stays at ~4.6 GB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@justlovett0

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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 NVIDIA capped view heap: 2^16 dynamic slots starve world tables; 2^18 removes the indirect/mesh drops #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.)

@Marvisak

Copy link
Copy Markdown
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants