Skip to content

A capped view heap keeps its null buffer views and pair range - #13

Merged
MagiccConch merged 4 commits into
mainfrom
capped-null-buffer-views
Nov 25, 2026
Merged

MagiccConch merged 4 commits into
mainfrom
capped-null-buffer-views

Conversation

@MagiccConch

Copy link
Copy Markdown
Owner

Run 7's evidence (2026-11-25, RTX 5080)

The run reached world entry at 30 fps but removed the device mid submission (0x887A0006, 7 lists, crashes.log 07:03:52), and the log ended with:

  • no room for the null buffer views (1) — the title heap landed on the PORTABLE_VIEWS cap path, where NULL_BUFFER_VIEW (2,097,150) sits past the 1,000,000-slot heap: the null raw SRV/UAV that computed buffer-view indices read were never made.
  • 187078 × title slot past the host heap in run 6 — the mirror diagnostic floods the log.

What this changes

Translated shaders (victory-shader): buffer_guard clamps computed buffer-view indices below the shader's view limit (view_limit, already carried per Shader) instead of HEAP_VIEWS - 1, and reads the null SRV/UAV at limit-2/limit-3 — inside a capped heap too. heap_handle already clamped; this closes the gap between the two clamps (the direction of upstream PRs Marvisak#2177 and Marvisak#2185, which are not merged upstream yet).

Host heap layout (victory-gpu descriptor::host): a capped heap keeps its last three slots out of title, dynamic and pair views — null SRV, null UAV, then the slot a shader's index clamps to:

  • the exact-fit rungs (cap == count + DYNAMIC / count + MIN_DYNAMIC, run 7's actual path) trim 3 dynamic slots;
  • the deep-cap path reserves CAPPED_PAIRS (1 << 15 slots = 16,384 copy-back view pairs) with the whole MIN_DYNAMIC dynamic range intact (the starved-pairs trap the previous MIN_DYNAMIC - 1 sizing created);
  • the null SRV/UAV are made at min(NULL_BUFFER_VIEW, total-2) and total-3 unconditionally, so the no room for the null buffer views warn cannot fire on a capped heap.

Pipeline library (pipeline/library.rs): the tag now hashes the view-heap cap — a library saved on the other GPU no longer reuses DXIL whose clamps point at the wrong slots (the shader cache already keyed on the cap; the library tag did not).

Diagnostics: the title slot past the host heap warn throttles to once per second carrying the highest slot seen; each new maximum logs at debug.

AMD/uncapped hosts are byte-identical to before: the limit resolves to HEAP_VIEWS, and min(NULL_BUFFER_VIEW, total-2) equals NULL_BUFFER_VIEW on every 2M-slot heap.

Verification

cargo check + cargo clippy (0 warnings) + cargo test --no-run all clean on x86_64-pc-windows-gnu (1.98.1); CI runs the real suite on windows-latest. Hardware runs need the user's 5080.

Run 8 expectations

  • No no room for the null buffer views warn; host view heap capped at 1000000 now logs kept=836157 (title slots) on the deep-cap path, or keeps all title slots with the rung-2 trim.
  • The past-cap flood is one warn line per second at most.
  • Copy-back pairs have a real, recycling pool at the cap.
  • If the null-write 0xc0000005 at image+0x2215c35 persists, the next suspect per the run-6 notes is unmarked GPU writes reaching title memory (twin bridge copies) — that would need the run-8 VICTORY_LOG_FILE trace.

This PR was created by an AI agent (OpenHands) on behalf of the user.

Run 7 (2026-11-25) on the RTX 5080 warned "no room for the null buffer
views": the heap landed on the PORTABLE_VIEWS cap path, where
NULL_BUFFER_VIEW (2,097,150) sat past the 1,000,000-slot heap, so the
null raw SRV/UAV a computed buffer-view index reads were never made, and
`pairs` had no room (a starved pair range never frees its views).

Translated shaders now read their null buffer views at the heap's own
last slots: buffer_guard clamps computed indices below the shader's view
limit and reads the null SRV (UAV below) at limit-2/-3, inside a capped
heap too (the direction of upstream PRs Marvisak#2177 and Marvisak#2185; heap_handle
already clamped).

A capped heap keeps its last three slots out of title, dynamic and pair
views: the null SRV/UAV, then the slot a shader's index clamps to. The
exact-fit rungs trim three dynamic slots for them; the deep-cap path
also reserves a pair range (CAPPED_PAIRS, 16384 pairs) so copy-back view
pairs survive, with the whole MIN_DYNAMIC range intact.

The pipeline library's tag now hashes the view-heap cap with the rest of
the translation settings: a library saved on the other host no longer
reuses DXIL whose clamps do not fit.

The "title slot past the host heap" diagnostic warns at most once a
second with the highest slot seen (187078 lines in run 6); every new
maximum logs at debug.

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
…k its tables

The capped path sized its dynamic range 2^16 (`MIN_DYNAMIC`), the title's
slots keeping their room first. Upstream issue Marvisak#747 measured that trade
on an RTX 4070 Ti: the world's tables starved in seconds, indirect and
mesh draws dropped by the thousand as "no dynamic slots", the G-buffer
about 0.1% covered; 2^18 dynamic slots with fewer title slots mirrored
raised coverage to 60-65% and dropped nothing for lack of slots. This
fork's `DYNAMIC` is already 2^18, so the capped heap takes it too, over
title slots past it (the heap still keeps its pair range and null
buffer views, from PR #13): 934464 title slots, 262144 dynamic, 32768
pair, and 3 null slots make exactly 1,000,000. `MIN_DYNAMIC` and its
duplicate rungs are gone.

A draw or dispatch whose fresh table finds no dynamic slots is dropped,
but the fresh tables the same stage had already made stayed reserved
(their ranges and their dedupe cache entries) until the list was reset
(upstream issue Marvisak#911). They were never recorded into the list — the
draw is dropped before its root arguments are set — so the bind gives
them back at once: released, uncached, and re-made by the next draw
from scratch.

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
@MagiccConch
MagiccConch marked this pull request as ready for review November 25, 2026 08:15
@MagiccConch
MagiccConch merged commit ce512ab into main Nov 25, 2026
1 check passed
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.

2 participants