Skip to content

Draw: a held slot does not walk the pages first (part of #1521) - #1877

Open
unueberlegt wants to merge 1 commit into
trustno1-coder:mainfrom
unueberlegt:perf/1521-first-upload-walk
Open

unueberlegt wants to merge 1 commit into
trustno1-coder:mainfrom
unueberlegt:perf/1521-first-upload-walk

Conversation

@unueberlegt

Copy link
Copy Markdown

What it changes

The pass over the textures picked by index (the heap's buffer views and friends) walked a placed view's pages with mapped_bytes() — VirtualQuery over whole textures — before it asked whether the card's fullness holds the slot. A held slot's answer (nothing mapped, or mapped in part) was thrown away: the slot is told Held and looked at again in about four seconds, or as soon as the card has room.

Now the held decision runs first (it needs only the view and texture_slot_made_from), and a held slot never walks. A counter (HEAP_TEXTURES_HELD_SKIP) in the 5-second line says how many slots skipped the walk:

textures picked by index: … uploaded so far (… MB), … waiting, … passed over unmapped, N held for the card's fullness without a walk of their pages

Behavior delta (said plainly)

Under !room, an ineligible slot that streamed out is now told Held instead of Away — the walk was the only way to see that its memory is gone, and held slots do not walk. texture_slot_gone for such a slot runs on the next pass with room (the slot's tell re-checks then); nothing leaks, the host copy's bytes are still resident.

Why

Point 4 of #1521: on a full card the walks cost 87–281 ms of every 5 s plus recording-thread lock contention behind mapped_bytes. On our machine (RTX 5070 12 GB, Ryzen 9 9950X3D, 31 GB, Series X 2560x1440, prologue) the pass stands under !room almost constantly: 3,716,941 held slots skipped the walk in one ~10-minute run (and 3.4M in a second). The skip is the pass's own answer: its walk exists only for slots that go up.

How it was tested

  • GPU and profile: NVIDIA RTX 5070 12 GB (driver 610.88), AMD Ryzen 9 9950X3D, 31 GB RAM, Windows 11 26300; Series X profile, 2560x1440, prologue runs of ~10 minutes, five runs (baseline + one per change of Reduce lock/atomic contention on the ~88% no-op refresh fast path (21.3 ms/frame on 8-core CPU, GPU 52% busy) #1521's points, steady windows, medians).
  • For shader changes, the wave sizes tested: N/A (no shader changes; the translated DXIL is byte-identical).
  • cargo test passed for the crates it touches: victory-gpu 590 passed / 0 failed (and 644 with --features diagnostics); clippy --all-features at the base's warning count (10, none new).
  • New test: held_for_fullness_with_nothing_going_up_is_said_before_the_walk (the held predicate over a room/made/reupload/first-room/window matrix).

Checked for overlap

The other three points of #1521 are left to those PRs and 0174844; this one takes the fourth.

🤖 Generated with Claude Code

The pass over the textures picked by index walked a placed view's pages
(VirtualQuery, whole textures at a time) before it asked whether the
card's fullness holds the slot: held ones threw the answer away. The
held decision is made first now, and held ones are counted where they
skip the walk (HEAP_TEXTURES_HELD_SKIP, in the 5 s line).

What changes besides the order: a held slot that streamed out is told
Held without the walk (it was told Away), and its host copy is not let
go until a pass with room walks it again — about four seconds, or as
soon as the card has room.

Point 4 of trustno1-coder#1521; the issue's other three are covered by 0174844 (the
shadow copy state lock, merged) and the open trustno1-coder#614, trustno1-coder#1133, trustno1-coder#1556, trustno1-coder#1637.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@github-actions github-actions Bot added NVIDIA pr-fix Pull request: fixes a bug pr-performance Pull request: makes it faster or use less memory labels Nov 29, 2026
@github-actions github-actions Bot changed the title [pr-fix][performance][NVIDIA] Draw: a held slot does not walk the pages first (part of #1521) Draw: a held slot does not walk the pages first (part of #1521) Nov 29, 2026
@unueberlegt unueberlegt changed the title Draw: a held slot does not walk the pages first (part of #1521) [pr-fix][performance][NVIDIA] Draw: a held slot does not walk the pages first (part of #1521) Nov 29, 2026
@github-actions github-actions Bot changed the title [pr-fix][performance][NVIDIA] Draw: a held slot does not walk the pages first (part of #1521) Draw: a held slot does not walk the pages first (part of #1521) Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NVIDIA pr-fix Pull request: fixes a bug pr-performance Pull request: makes it faster or use less memory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant