Skip to content

GPU: page view heaps a host caps below the slots shaders index - #2121

Open
0xkn0wh3r3 wants to merge 16 commits into
Marvisak:mainfrom
0xkn0wh3r3:gpu/view-heap-pages
Open

0xkn0wh3r3 wants to merge 16 commits into
Marvisak:mainfrom
0xkn0wh3r3:gpu/view-heap-pages

Conversation

@0xkn0wh3r3

@0xkn0wh3r3 0xkn0wh3r3 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Towards #1835, #1808 and #1760.

The problem

On NVIDIA, views the title puts in the upper part of its descriptor heap read null. Issue reports put 61,000 to 173,000 live slots past the cap in the world (#1760), and two view-heap unit tests failed on NVIDIA (#1835).

The mechanism: NVIDIA takes shader-visible view heaps of at most 1,000,000 descriptors. The title lays out 1,245,184 slots, and translated shaders index up to HEAP_VIEWS (2^21). The host heap holds title slot i at host slot i, so the capped heap kept 934,464 title slots and left the rest out ("title slot past the host heap").

slots
NVIDIA's cap on a shader-visible view heap 1,000,000
title's heap 1,245,184
indices translated shaders take (HEAP_VIEWS) 2^21
title slots the capped heap kept on main 934,464

The fix

A host that refuses a view heap of every index shaders take plus the dynamic slots (descriptor::host::view_pages, asked once; set VICTORY_VIEW_PAGES=1 to page on any host) keeps the title's order in a virtual heap of 256-slot pages:

  • The host heap is 1,000,000 slots. Host page 0 stays null (where pages with no place read). Page 1 takes writes once there is no room left. The dynamic slots' pages are placed together after them (tables of them are bound as host ranges).
  • Placement: any other page is placed in turn when a slot of it is first written, and entered in the page table: a dword per page past the view-stride table (VIEW_PAGE_TABLE), which shaders already have bound. A null made in a page with no place takes none.
  • Shaders: translated shaders take each view heap index through the table when Options::view_pages is set (Shader::heap_handle: per handle, one table load plus a shift, a multiply and an add to address it and a shift, an and and an or to place the slot; samplers are not paged). The host sets it where it pages (shader_cache::options), and the shader cache key carries it, so a host that does not page translates as before.
  • Draws bind the stride (and page) table of whichever view heap they bind: the title's, else our own (as write marks already do). Before, the stride table was taken from the title's heap only.

Limits:

  • The host has 3,906 pages, of which 1,026 are fixed (null, scratch, dynamic): 2,880 for the title's 4,864 virtual pages, that is 737,280 slots at a time.
  • When they run out and nothing can be taken back (below), further pages read null with a warning. The pages in use are logged at each power of two.
  • A title heap whose slots plus the 2^18 dynamic slots would reach the null buffer views at HEAP_VIEWS - 2 is capped at PAGED_TITLE_VIEWS (NULL_BUFFER_VIEW - 1 - DYNAMIC, 1,835,005 title slots), with the warning paged view heap capped at ... title slots, as the unpaged heap is capped at the host's limit. Title slots past it are left out ("title slot past the host heap"). The title's 1,245,184 slots are well below it.

Reclaiming pages

In-world runs on an RTX 4090 and 5080 filled all 3,906 host pages within minutes. At the overflow, "view heap pages written with no room left" reached pages=1024 with about 231,000 slots written, about 226 of 256 a page, so smaller pages would not fit more. The title writes fresh descriptors over most of its 1,245,184 slots during a run, and placing on first write without ever giving back runs out. Pages not used lately are now taken back.

  • Use. Each virtual page has a last-used stamp (submissions run). A page is used when a slot of it is written, when HostHeap::gpu hands out a handle in it, when a draw binds a slot of it through a table, and when its read mark comes in.
  • Page read marks (shaders). With view pages and marks, every instruction that reads or writes through a view taken from the heap (the heap itself or a table) sets bit VIEW_PAGE_READS + page (VIEW_PAGE_READS = VIEW_READS + HEAP_VIEWS) in the view-writes bitmap, where it is still clear. That is one load, a test and a branch per page and console block (about 10 instructions, the atomic only the first time in a submission). A handle first used inside guarded code that an instruction made is marked there, with the atomic alone. The host bitmap grows by 8,192 bits, and shadow::take_page_reads takes and clears the marks of both bitmaps after each submission. The shader cache key changes with the translator's sources.
  • When. Between submissions (the GPU idle), after the read marks are taken: if fewer than 1/32 of the host pages are free (the free list plus pages never given out), pages are taken back until 1/16 are free, least recently used first. Only pages unused for at least 300 submissions and 10 s qualify (the strict ages). If a write, or a page read again, found no host page since the last pass, that one pass also takes pages unused for more than 32 submissions, with no time minimum, still least recently used first and up to the same mark, so pages old by the strict ages go first (979e3a7, suggested by @kawaii-shakal). 32 is more than a frame's submissions, so pages read every frame stay. Otherwise the strict ages alone apply. Only pages placed on a write that hold title slots only can be taken back. The dynamic slots' pages and the host's own pair and null-view pages never are.
  • Taking back. The page table entry goes to the null page. What the slots viewed is retired (released after the submission, as for any rewritten slot), their write marks are cleared, their read marks are forgotten (a shader's next read of a slot is taken again; a mark cleared so still counts as a read for eviction, since marks are by slot and another heap may have read it), and null views are copied over the host page before it goes on the free list. A heap whose page of null views could not be made takes no page back. Writes take pages from the free list before pages never given out. Slot records stay noted, so heap syncs (which walk every slot of a 64 KiB title page with a write in it) don't re-place the page because a neighbour was written.
  • Placing again. A taken-back page gets a place again when the title changes a record in it, when a draw binds any slot of it, or when its read mark comes in after a submission. In each case its slots are made from the title's records before the next submission, or made null where the title no longer holds a view; slots already made in the page since it was placed (a texture made for the draw) keep their views. After a submission, pages are turned before the textures read are made, so a placed texture read in a page placed again is made there for the next submission; one whose view went to the scratch page (no room) has its read taken again. A page written while there was no room is handled the same way once it gets a place. So a wrong guess costs one submission of null reads, not the rest of the session.
  • Logs (info, at power-of-two totals): view heap pages unused lately taken back (pages, total, free, in_use, and relaxed (whether that pass took pages younger than the strict ages) with relaxed_total) and view heap pages placed again (pages, taken_back, refused, in_use). The placed-again line keeps two counts apart (6f8b588): taken_back is pages taken back by reclaiming and then read, written or drawn through (a wrong guess); refused is pages written when no host page was free that got a place later. A page taken back and then written with no room counts under taken_back. pages is their sum, and the line is logged where either count reaches a power of two. host view heap pages in use, no room left in the host view heap and view heap pages written with no room left keep their meaning: the last two now appear only if nothing old enough can be taken back, and a refusal makes the next pass relaxed. view heap dynamic slots in use (248e4c3, on paged and unpaged hosts) gives peak, the most dynamic slots taken at once since the heap was made, of, the heap's dynamic slots (262,144 = 1,024 host pages on a paged host), and run, the longest run of them a table asked for; it is logged where peak or run reaches a power of two. It measures whether the dynamic region could be smaller on paged hosts to leave the title more of the 3,906 host pages.
  • Shortcut (// shortcut: in take_back_pages): a handle from gpu() for a slot of a page placed on a write, recorded into a list that stays unsubmitted longer than pages are kept unused (32 submissions once a write found no room), would read whatever that host page holds by then. Lists bind title slots through the page table, and gpu() stamps the page. No list of ours bakes a title slot's handle today: the unordered access clear uses a dynamic slot.

The page code moves to descriptor/pages.rs.

Testing

Review fixes (0bc5edb), the full heap and the eviction window (found by @passerbyyhx):

  • draw::tests::a_placed_texture_read_with_no_page_free_is_made_after_one_submission (GPU, through Host::execute): no host page free; page 3's placed texture was taken back and page 2 took its host page since. A shader reads the texture in four submissions: page 2 is taken back in the first pass and page 3 placed in the same host page. Per submission, (texture held, buffer view in the page held): [(true, true); 4], a placed texture not read stays unmade. At fedb38d: [(false, true), (true, true), (true, true), (true, true)], the texture held a submission after its neighbour.
  • draw::tests::a_placed_texture_read_with_no_room_before_is_made_after_one_submission: the texture was read once while its page found no room (made in the scratch page), then read again in four submissions once another page is old enough: [true; 4]. At fedb38d: [false; 4] (its read was already taken, and nothing pressed for room). With the reorder and the read pressure but without re-taking its read: [false, true, true, true].
  • descriptor::pages::tests::a_page_read_again_with_no_room_presses_the_next_pass (no GPU): with no host page free and none old by the strict ages, a pass takes nothing; after a read of a taken-back page, the next pass takes back the page unused longest and the page read is placed in its host page.
  • draw::tests::a_page_taken_back_keeps_another_heaps_read_of_its_slot_for_eviction: two paged heaps with placed textures at the same slot, the second's read (and slot 7's) marked; the first takes back the page with its own record there. reads_since returns both slots and names the second heap's texture. At fedb38d: [7].
  • cargo test -p victory-gpu --lib: 254 passed, 0 failed, 1 ignored (this NVIDIA host pages view heaps). With --features diagnostics: 268 passed; pipeline::placed_uav_tests::placed_uav_dispatch_writes_its_texture fails, as at fedb38d. Clippy with and without --features diagnostics: 0 warnings. cargo xtask policy ok.

Review fixes (fedb38d):

  • draw::tests::a_placed_texture_in_a_page_taken_back_is_made_after_one_submission_reads_it (GPU, through Host::execute): a compute shader sets the slot's and page's read marks in each submission. After the page is taken back, the slot holds its texture again after the first submission that reads it. Before: [false, false, true, true] over four submissions.
  • host::tests::view_heap_pages_placed_by_a_read_keep_the_texture_made_for_it: make_read then turn_pages (the order Host::execute had at fedb38d; a texture made for a draw before the heap sync is in the same place). Before, the remake nulled the texture make_read had just made.
  • host::tests::view_heap_pages_taken_back_make_their_buffer_views_again: a constant buffer, a buffer SRV and a buffer UAV in a page taken back are made again when a read mark places the page (this passed before too), and a draw binding one of them places the page at once (before: it stayed unplaced).
  • host::tests::view_heap_slots_written_with_no_room_are_made_when_their_page_is_placed: a view written to the scratch page holds nothing and is made once its page is placed.
  • cargo test -p victory-gpu --lib: 250 passed, 0 failed, 1 ignored (RTX 5070 Ti, which pages). With --features diagnostics: 263 passed; frame::tests::waits_end_on_ticks_and_count_frames (flaky) and pipeline::placed_uav_tests::placed_uav_dispatch_writes_its_texture fail, and both fail at c23f708 too. Clippy with and without --features diagnostics: 0 warnings. cargo xtask policy ok.

The paged title-heap cap (07a132db):

  • host::tests::a_paged_heap_of_every_slot_shaders_index_is_capped (GPU, paged host): a title heap of HEAP_VIEWS slots is capped at PAGED_TITLE_VIEWS. The first title-or-dynamic page, the last dynamic slot and both null buffer views have their pages placed in the page table, within its 8,192 entries. All dynamic slots can be taken, and a title slot past the cap has no mirror. Without the cap the same test panics in HostHeap::new (index out of bounds: the len is 8192 but the index is 8192, the dynamic slots' pages past the page table).
  • cargo test -p victory-gpu --lib: 241 passed (at 6f8b588), 0 failed, 1 ignored, both with and without VICTORY_VIEW_PAGES=1. At 979e3a7: 244 passed, 1 ignored with VICTORY_VIEW_PAGES=1; without it, 243 passed and views_bound_while_another_slot_gets_its_texture_do_not_wait failed, which fails on main on this card too. Clippy with and without --features diagnostics: 0 warnings. cargo xtask policy ok.

The dynamic-slot peak (248e4c3):

  • host::tests::the_dynamic_peak_follows_takes_and_releases (GPU): three runs taken (10, 30, 20) give a peak of 60; giving back the 30 leaves 30 in use and the peak at 60, and giving them back again changes nothing; taking 25 leaves the peak at 60, then 15 more raises it to 70. The longest run asked for is 30, then the whole region once a request for all of it fails. dynamic_powers_of_two_are_passed_once checks when the line is logged.
  • cargo test -p victory-gpu --lib: 246 passed, 0 failed, 1 ignored, both with and without VICTORY_VIEW_PAGES=1. Clippy with and without --features diagnostics: 0 warnings. cargo xtask policy ok.

Reclaiming (cae596c, a12b972), on an NVIDIA card that pages automatically, and with VICTORY_VIEW_PAGES=1:

  • descriptor::pages unit tests (no GPU):
    • pages unused past the age are taken back oldest first, down to the high-water mark, and only once they are old by both counts;
    • the dynamic pages and the host's own pages never are;
    • a taken-back page's table entry is null and its host page goes to the next page written;
    • recently used pages stay (written, read mark, gpu() handle, draw stamp);
    • taken-back pages read or written are placed again and queued to be remade;
    • a page refused room is placed and remade once there is room;
    • the two placed-again counts move only for their own case: taken-back pages placed again count under taken_back only, pages refused room and placed later under refused only, and a page taken back then refused room under taken_back (6f8b588);
    • under pressure (979e3a7): with no refused write, pages younger than the strict ages stay however few host pages are free; after one, pages unused for more than 32 submissions are taken back oldest first up to the high-water mark though younger than 10 s, while a page used exactly 32 submissions before and one used now stay; a refusal relaxes one pass only, including a pass that had room enough.
  • host::tests::view_heap_pages_taken_back_are_placed_again_when_read (GPU, real paged host heap): a placed texture's slot in page 1 is taken back (table entry null, slot holds nothing, record still noted, a heap sync leaves it). Its page read mark through take_page_reads and turn_pages places it again with the slot made from the title's record, and a read of the slot then makes its texture.
  • emit::stride_tests::views_read_in_a_paged_view_heap_mark_their_pages (hardware and WARP): a program translated with pages and marks reads virtual slot 1,099,777 and writes its table's UAV at slot 0. Exactly bits VIEW_PAGE_READS + 4296 and VIEW_PAGE_READS + 0 are set.
  • cargo test -p victory-gpu --lib: 203 passed, 0 failed, both with and without VICTORY_VIEW_PAGES=1. cargo test -p victory-shader --lib: all pass except a_heap_buffer_read_by_element_takes_the_views_stride and gathers_at_a_level_match_the_hardware, as before. dxil.dll isn't installed here, so the new DXIL was checked by pipeline creation on hardware and WARP, not by the validator.
  • Clippy with and without --features diagnostics: 0 warnings. cargo xtask policy ok.

Earlier:

  • New test descriptor::host::tests::pages_are_placed_once_on_first_write: page placement, its table entries, reads placing none, running out.
  • New test emit::stride_tests::a_heap_index_in_a_paged_view_heap_reads_where_its_page_is: a program translated with pages reads its buffer at virtual slot 1,099,777 through the table exactly as the plain program reads slot 1, on an RTX 5070 Ti (driver 621.24) and WARP.
  • On the RTX 5070 Ti, which pages, dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views now pass (both fail on main there).
  • Upstream's memory::tests::a_submission_that_missed_leaves_the_copies_at_once is paged the same way: its WRITE shader looks its slot up in the page table, and its root layout binds the whole host heap and the view-stride table.
  • emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros now passes on NVIDIA too. The shader test host made a 2^21-slot heap for its null buffer views, which the driver refuses. It now pages them where the device caps the heap, and the test translates with view pages there (Host::null_buffer_page, second commit).
  • cargo test -p victory-gpu and -p victory-shader: all pass on the RTX 5070 Ti except emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride and emit::synthetic_tests::gathers_at_a_level_match_the_hardware, which fail on main there too (the test host's structured views, Shader tests: the test host's structured buffer views are raw (#1835) #1887).

Not verified

  • No title run here with reclaiming. kawaii-shakal's run (RTX 5070 Ti, 0.5–2 fps, about 20 submissions a frame, with GPU: title threads recording lists no longer wait on descriptor and buffer-copy locks #2821) still ran out of host pages about 2 minutes in under the strict ages alone. Their version of the relaxed pass (16 submissions) cut pages written with no room from ≥2048 to ≥512 over similar runs. 979e3a7 (32 submissions) has not been measured in the title yet. Whether the pages a world uses at once fit in 2,880 host pages, and how often a taken-back page is read again, is what view heap pages unused lately taken back, view heap pages placed again (its taken_back= against its refused=) and (if it still appears) no room left in the host view heap will show. Whether the dynamic region can be smaller on paged hosts is what the largest peak= of view heap dynamic slots in use in a title run will show.

Related: how this differs from the open heap PRs

#1751, #1133, #1548, #1777, #1779 and #1349 change how the capped heap is laid out or clamp indices past the cap. None maps title slots past it to host slots, so 300,000+ title slots still have no descriptor under each (measured in #1760). This one keeps every title slot addressable, as long as the pages the title uses within about 10 s and 300 submissions (32 submissions once room runs out) fit in 2,880 host pages (737,280 slots). Older pages are taken back and placed again when used.

Rebased onto 13f91ca

  • Upstream 850b66f makes heap handles per descriptor at a fixed address and per join. All of those paths go through Shader::heap_handle, so they are paged too.
  • Upstream's test a_submission_that_missed_leaves_the_copies_at_once is adjusted for paging, as described under Testing.

Rebased onto 842b0cb

  • Upstream GPU: view addresses for tables made afresh (dynamic slots) #1906 (2bba792) gives the view addresses an entry per dynamic slot. Those entries are indexed by virtual slot, so paging leaves them as they are. Its test view_addresses_cover_tables_made_afresh sits next to the paging tests in descriptor/host.rs (the paging tests move to descriptor/pages.rs in the last commit, as before). It passes on the RTX 5070 Ti, which pages.
  • Upstream's test compute_view_marks_rebind_after_depth_twin_conversion (GPU: rebind compute view-mark root descriptors after depth-twin conversion #2155) translates with shader_cache::options(), which is how the runtime translates, instead of building Options itself. Options now has the view_pages field.
  • No other conflicts. lower.rs is still under the 512 KiB policy limit.

Rebased onto 63bcca4

  • Upstream's only new commit changes README.md. No conflicts.

@DenRakEiw DenRakEiw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):

  • cargo test -p victory-gpu — 144 passed, 0 failed (2 ignored) on NVIDIA RTX 5090! Directly resolves both NVIDIA 1M view-heap cap failures (dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views) on main 940d32f!
  • cargo test -p victory-shader --lib emit::stride_tests:: — 6 passed, 1 failed (directly fixes a_heap_buffer_read_where_no_buffer_view_is_reads_zeros on RTX 5090; the 1 remaining failure, a_heap_buffer_read_by_element_takes_the_views_stride, is the separate NVIDIA structured-view issue covered by #1887)
  • cargo clippy -p victory-gpu -p victory-shader -p victory --all-targets — 0 warnings
  • cargo xtask policy — ok (183 files ok)

Huge NVIDIA/Blackwell compatibility win. Looks great!

AI-assisted (Gemini 4 Neon).

@yualk

yualk commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Independent owned texture check at 442632413ce4 on Windows RTX 5070 Ti (10de:2c05, driver 610.88, auto-paged) and explicit WARP (1414:008c, forced paging). Used the real HostHeap::new(false, 1245184) with a 1,000,000-slot physical heap, and its normal cpu(index) page allocator/write destination. Two same-shaped RGBA8 textures with distinct bit patterns occupied virtual slots 17 and 1,126,417 (same in-page offset). A DXC 6.6 shader read the actual upload-backed page table and echoed the chosen physical slots plus sampled texels in each fence-completed arm. The upper slot returned the correct typed null until publication, then its own texel cb683b2e, with low 617fa5c3 unchanged. After reducing the allocator's remaining capacity to zero (only in the fixture), a real third texture descriptor write went to scratch and the third virtual slot still read zero; neither admitted neighbor changed. This check doesn't fill a title's real page capacity and doesn't measure title frames or use translated shader code.

One source-level failure case: the stride upload returns None on Create/Map failure, but paged initialization substitutes zero for the base and writes at VIEW_PAGE_TABLE. Could reject a paged heap with no mapped stride/page table before publishing its GPU range. I did not induce OOM. Also, the unplaced page is filled with a Texture2D null; my test deliberately used that dimension and doesn't establish safe null fallbacks for other resource kinds (D3D12 null descriptor rules). AI-assisted; no title data or captures used.

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

View heaps paged when a host caps below shader-indexed slots — paging for capped heaps; mixed gpu+shader+apps, Windows-only overall.

@fiestorra

Copy link
Copy Markdown
Contributor

Measured on the card the cap affects: the slots past the heap go from 310,720 to zero, and the cap line disappears

I ran this branch on the machine where the problem reproduces — RTX 4090, driver 32.0.16.2124, session 1, release build, empty cache, 70 s, no other pull request applied:

title slot past the host heap      0        (main: 310,720)
host view heap capped              0        (main: 1)
device removed                     2
no host texture … 2560x1440 …      1
dropping unordered access          0
frame=64 draws=96

So both symptoms the description is about are gone here: no slot is left outside the host heap, and the "capped" line does not appear at all — the heap is not capped from the title's point of view, which is a stronger result than the fix I had measured before (#1779 took the same 310,720 to 0 but still logged the cap).

The remaining lines are the ones this pull request is not about, and I would keep them out of the review: the device removal and the missing 1440p B5G5R5A1_UNORM/format-115 texture are the format ground (#1630 and #1832). Worth knowing when someone measures this branch: on main they hide its value, because the boot dies at frame 64 regardless. With those two applied, the boot reaches 2,048 frames and 13,312 draws in 120 s — which is where this change's effect on the world would actually be visible, and where I would look next.

A few things I checked that are not in the diff:

  • it merges cleanly with the two open changes that touch the same emitter files (Shaders: a vertex shader that declares a UAV says so in its flags and SFI0 (fixes #1987) #2016, the vertex UAV flag; Shaders: a compute shader samples at level 0, not with derivatives (735 programs) #2027, sampling in compute) — I merged both orders, they apply and build. That matters because this change adds to emit/host.rs, emit/mod.rs and emit/shader.rs, which is the same corner, and a conflict there would be a reason to sequence the three.
  • the fixed 256-slot page and the emitter's baked page maths are the risk I would want stated: an index computed a page wrong reads null silently, and the symptom of a wrong page is "some views read zero", which is exactly what the cap looked like before. If there is a log line or counter that says the heap is paged (and how many pages are placed), it did not appear at info on this run — view pages was 0 matches. I would ask for one: it is the difference between "we think it paged" and "the log said so", and this week has shown how much a missing line costs.

What I have not reviewed: the 212 lines of descriptor/host.rs and the paging algebra itself, in any depth. I measured the outcome; the reasoning inside would take a session of its own, and the outcome is the part I can be sure of here.

No game data is involved: counts from the title's own log.

Written with an AI assistant.

@0xkn0wh3r3

Copy link
Copy Markdown
Contributor Author

Thanks both, this is very useful.

@yualk: the missing-buffer case was real. In 907922c, when the stride buffer can't be made, a paged heap is now refused with a warning before its GPU range is recorded. Before, it wrote the page table relative to address 0. On the null descriptors: unplaced pages read slots filled with a Texture2D null. That's the same as every unwritten slot on main today (fill_null), so this PR doesn't change it. Matching the null to the kind a shader reads would be a separate change, and I'd keep it out of this one.

@fiestorra: thanks for the 4090 run, and for checking the merges with #2016 and #2027. The probe's line (host view heaps, paged=true) can come before logging is set up, which is probably why nothing matched. 907922c adds a line when the title's heap is made: view heap paged: the host caps view heaps, title slots are placed by page, with slots, host_slots, pages and fixed. After that, host view heap pages in use logs the count at each power of two, and no room left in the host view heap warns if pages run out. A run with #1630 and #1832 applied should show whether the world's pages fit.

@iGoldenNinja

iGoldenNinja commented Nov 25, 2026 •

Copy link
Copy Markdown

Independent RTX 5080 hardware check. Driver 617.14, Windows 11 Pro 25H2 build 26200.9974, Ryzen 9 5900X, Rust 1.98.1 MSVC, DXIL 1.9.2609.5, diag, paging and WARP overrides unset.

On clean main 940d32f69b22265690a0b5a15d6ded572ba33baf, dynamic_slots_are_held_until_released failed the NumDescriptors >= HEAP_VIEWS assertion. On clean PR head 442632413ce4e8b081b8c4ae4174a51a3682e7f4 it passed, along with pages_are_placed_once_on_first_write, the high-virtual-slot translated shader read on hardware and WARP, and the null buffer read. In total, 4 passed, 0 failed or ignored on the PR. These were synthetic fixtures.

Test commands and per-fixture outcomes

OpenAI Codex (GPT-6) ran the tests and drafted this report.

Title replay follow-up on RTX 5080 / 617.14 and Windows 11 26200.9974. I adapted 907922c onto the NVIDIA fork's 7e7bb18 diagnostics build with the previous integer-blend and descriptor-read fixes. The local port binds the page table through its own root view to preserve that fork's buffer refresh behavior.

The 1,245,184-slot title heap used 1,000,000 physical slots and logged pages=3906 fixed=1026. The available 2,880 title pages filled during world loading, 150.5 s after player selection, followed by the heap-exhaustion warning. The port retains allocated pages for the heap lifetime. This observes saturation on this fork and route.

It reached player control in the prison. The five-minute replay averaged 4.007 presented FPS, 658.550 ms P99, compared with 4.543 FPS and 435.072 ms on the unpaged control. Ten of 54 host samples still reported pending pipelines on the paged run. Wall and ceiling gaps persisted. The run ended deliberately with no DRED device removal logged.

Reproduction, capacity math and timing split

@JurajSimicevic

JurajSimicevic commented Nov 25, 2026 •

Copy link
Copy Markdown

On main 940d32f (RTX 5080) the pages also fill as the world loads; afterwards the device was removed within 1-3 minutes in both runs

Following @iGoldenNinja's fork replay above, the same on upstream main with no fork. RTX 5080, driver 32.0.16.1742, Windows 11 26200, diag build, VICTORY_D3D12_DRED=1, shader cache and pipeline library made first. Base: 940d32f + #1775's typed-UAV check (to boot, #1753) + #1762 + this PR at 907922c. The second run adds #1906 (astrosteveo's rebase 01ba70d) and #2098. Nothing skipped. One run each.

base + #1906 + #2098
pages in use 2,049 before the world; all 3,906 two seconds into it, then "no room left in the host view heap" the same: 2,049, then all 3,906 three seconds before the first world frame
title slot past the host heap, draws dropped for dynamic slots 0, 0 0, 0
end 0x887A0006 188 s into the world; DRED stops at #1968's program C (the one #984 addresses) 0x887A0006 70 s into the world; DRED stops at a mesh program's indirect draw
#1968's program A runs for the 3 minutes, never in a slow submission runs, never in a slow submission

No game data attached: counters, timings and log warnings only.

AI-assisted (Claude Code).

@0xkn0wh3r3

Copy link
Copy Markdown
Contributor Author

Thanks both, this is the measurement the PR needed.

What I take from it:

Whether a different page size helps depends on how full the placed pages are. If most placed pages hold only a few written slots, smaller pages (64 slots) would fit far more of the title. If they're mostly full, the title really writes more than about 740k distinct descriptors, and the next step is reclaiming pages, or growing the title's share at the dynamic region's expense, not resizing them. I'd rather measure than guess. c5d33e8 adds that count: host view heap pages in use and the no room left warning now carry written (slots written in pages placed on a write) and of / of_slots (slots in those pages). A new view heap pages written with no room left log counts the pages and slots that missed out. If either of you can run it again, the ratio at the warning settles it in one run.

On the removals: in the first run DRED stops at #1968's program C, which #984 addresses. In the second it stops at a mesh program's indirect draw. Neither points at a null descriptor read; a null SRV/UAV reads zeros and drops writes. With one run each, though, I agree it can't be ruled out yet.

Thanks for the conflict notes with #1762, #1906 and #2098. I'll resolve them in whichever order those land.

@GaussianGuaicai

Copy link
Copy Markdown
Contributor

Independent title smoke test on a Windows Hyper-V guest with an RTX 5070 Ti, using diagnostic builds, the same save snapshot and input, and separate cold caches:

  • Baseline 940d32f: Only frame 1 was logged before the 110 s watchdog. The run emitted 262,329 title slot past the host heap warnings.
  • Paging build 907922c: Paging activated automatically for the 1,245,184-slot title heap on the 1,000,000-slot host heap. I saw zero instances of that warning. The page-use log reported 2049 of 3906, and no page exhaustion was logged before exit. The run reached at least frame 1625, then exited on D3D12 device removal.

Separately, I compared unmodified 907922c with the same revision plus a local workaround excluding the R32_UINT to R9G9B9E5_SHAREDEXP cast. With matched debug-layer and capture settings, the unmodified build reproduced the rejected SRV and device removal. The workaround build reached the first detected world frame and ran until the watchdog without either error in that run, but the captured final image remained dark. The format workaround is not part of this PR.

This confirms automatic paging and provides one in-game page-use sample. It does not establish long-run page capacity, playable rendering, or a performance gain.

Test report prepared with assistance from GitHub Copilot.

@sinan-cmyk

Copy link
Copy Markdown

Offline measurement on a retail dump

Result: no count change against main.

I merged head 40bd210 onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Needs work: needs the maintainer's decision. Reviewed head c23f708. Three small commits since 248e4c3:

  • c1d5a3a gives a paged heap MIN_DYNAMIC (65,536) dynamic slots instead of DYNAMIC (HostHeap::new, descriptor/host.rs). PAGED_TITLE_VIEWS follows, which leaves 3,648 host pages for title slots. latentdev's RTX 4090 peak (16,384 to 32,767) still fits.
  • c2e5ebc adds VICTORY_VIEW_PAGES_KEEP=1 (diagnostics builds only), which skips Pages::take_back.
  • c23f708 makes the shared-table test use dynamic_end().

The logic reads correctly. passerbyyhx's fixture checked page reuse on hardware.

The open question is the new in-game evidence. bittertea0323's A/B on 248e4c3 shows the paged tree drawing the world black where an un-paged tree draws it, and pages are taken back inside the frame loop. Whether c23f708 fixes that needs the run you proposed (defaults and KEEP=1, to the first world frame). Beyond that, a maintainer still has to decide whether to take paging at all. It changes translated shaders and the shader cache key, and it competes with #1751, #1777 and #2461. The HostHeap::mirror clash with #2821 also remains.

CI: passing.


Generated by Claude Code

@crissuper20

Copy link
Copy Markdown

GTX 1650 (Turing, 4 GB, driver 32.0.16.2124), diag build, Series S, 940d32f + #2016 #1775 #454 #1731, with and without this PR at 40bd210, 18 min each, same save and input:

without with
paging no on automatically (paged=true)
title slot past the host heap 310,720 0
reaches the world yes yes
device removed (~11 min in the world) no no

So on Turing there's no device removal in the world, unlike the 5080 report above. The world image is black on this card with or without the PR. One run each.

AI-assisted (Claude Code); measured on my own machine.

@sinan-cmyk

Copy link
Copy Markdown

Shader tests on NVIDIA Ada

I ran cargo test --locked -p victory-shader --lib on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, VICTORY_WARP unset.

Build Passed Failed
main 940d32f 244 3: stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride, stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, synthetic_tests::gathers_at_a_level_match_the_hardware
this PR (head 40bd210) merged onto 940d32f 246 2: a_heap_buffer_read_by_element_takes_the_views_stride, gathers_at_a_level_match_the_hardware

So on Ada this PR fixes a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, one of the three NVIDIA failures that #1835 tracks. #2177 fixes the same test, and #2178 fixes the stride one (details in #1835).

Offline, on the retail dump, this PR does not change the counts (posted above).

AI-assisted (Claude Code).

JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
…d release build; preserve stride failure
JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
…e frame/paging runtime and visual unknowns
JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
JohnTWillemsen added a commit to JohnTWillemsen/VIctory-W that referenced this pull request Nov 26, 2026
@JurajSimicevic

Copy link
Copy Markdown

RTX 5080 (Blackwell), in the title with #439's console flow, this PR at 0bc5edb:

  • Paging holds the title's whole heap: no "past the host heap" slots, no unknown slots in traced bindings, and no device errors in 11 minutes in the world.
  • It does not change the green/red cast in the prison cell. That cast does not come from the slots past the cap.
  • Separately, one test fails at this head with --features diagnostics (below).

Setup: RTX 5080, driver 617.42, Windows 11 26200.

In the world:

same tree with #2628 instead this PR
"title slot past the host heap" 507,331 (host heap 737,853 slots; title 1,245,184) 0
traced bindings in the dumped frame's main submission 37,707 made, 664 null, 7,190 unknown 44,760 made, 997 null, 0 unknown
view heap paged=true; 2,049 of 3,906 pages at the dump; later about 3,480-3,510 in use, with pages taken back and placed again (up to 4,096), refused=0
dynamic slots peak=8192 of=65536 run=256
device removed or hung no no (11 min in the world)
green-dominant pixels in the cell's indirect-lighting buffer, end of the submission 60.8% 52.5%

In the tree with #2628, the passes of the cell's indirect-lighting chain read many of their views from slots past the cap:

  • 29 of 38 for the pass that fills a packed colour target;
  • 16 of 28 for the pass that starts the chain;
  • 580 of 3,311 for the per-material lighting draws.

With this PR none are, and the cast is still there, so for that symptom the missing slots are ruled out. Details of the cast are on #2711.

A test that fails at 0bc5edb with diagnostics: pipeline::placed_uav_tests::placed_uav_dispatch_writes_its_texture.

  • It is compiled only with --features diagnostics, because it reads back through capture::read_back, so CI does not run it.
  • With cargo test -p victory-gpu --lib --features diagnostics -- placed_uav, it reads back zeros instead of the dispatched texel: [[0.0, 0.0, 0.0, 0.0], …] against [[1.0, 0.5, -0.25, 2.0], …].
  • It fails on WARP (VICTORY_D3D12_WARP=1) and on the RTX 5080, on this PR's head alone.
  • It passes on Shaders: one console wave sharing LDS runs in the console flow on 32-lane hosts #439 alone and on the tree above without this PR, on WARP.
  • I haven't looked for the cause. The test translates its shader with emit::emit and no view_pages, so it may only need the test updated, or it may be a placed UAV made into a title heap that no longer reaches the host.

Not tested: more than one run, other scenes, this PR without #439.

Local diagnostics only. No game data: counts and pixel statistics.

AI-assisted.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.