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

Open
github-bot wants to merge 16 commits from github-bot/gh-2121 into main AGit
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 05:31 UTC · original
0xkn0wh3r3:gpu/view-heap-pages → main · +2529 −107 · 14 files · 16 commits · open

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, #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 #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.

#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 #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 (#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.
**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 05:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121) `0xkn0wh3r3:gpu/view-heap-pages` → `main` · +2529 −107 · 14 files · 16 commits · open 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, #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 #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 #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` (#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.
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 capped heap kept 934,464 title slots and left the
rest out ("title slot past the host heap"): views there 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).

A host that refuses a view heap of every index shaders take and 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,
  and the dynamic slots' pages are placed together after them (tables of
  them are bound as host ranges). 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.
- Translated shaders take each view heap index through the table when
  `Options::view_pages` is set (`Shader::heap_handle`: one table load, a
  shift and an or per handle; 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), where the
  stride table was taken from the title's heap only.

Pages are not given back yet, and the host has 3,906, of which 1,026 are
fixed (null, scratch, dynamic): 2,880 for the title's 4,864 virtual
pages. When they run out, further pages read null with a warning; the
pages in use are logged at each power of two, so a run shows whether a
title's live slots fit.

Tests:
- `descriptor::host::tests::pages_are_placed_once_on_first_write`: page
  placement, its table entries, reads placing none, running out.
- `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 and WARP (expected values on 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); the second's HLSL stand-in for a translated shader
  now indexes the heap as they do, through the page table.
`a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` failed on NVIDIA
before the program ran: `View::NullBuffers` made the test host's view
heap `HEAP_VIEWS` (2^21) slots, to put the null buffer views at
`NULL_BUFFER_VIEW`, and the driver takes at most 1,000,000.

Where the device refuses that heap, the test host now puts them in one
256-slot page after the dispatch's other views, at their offsets in
`NULL_BUFFER_VIEW`'s page (`Host::null_buffer_page` says which), and the
test translates the program with view pages and maps that page there,
as the runtime pages such heaps. A device that takes the whole heap
(AMD, WARP) runs as before.

On the RTX 5070 Ti the test now passes (it read through the page table
to the null view: zeros); `a_heap_index_in_a_paged_view_heap_reads_where_its_page_is`
still passes.
A paged heap's page table lives in the view-stride table's buffer. When
that upload buffer could not be made, the paged setup took 0 as its
address and wrote the table at `VIEW_PAGE_TABLE` from there. A paged heap
is now refused (with a warning) when the buffer is missing, before its
GPU range is recorded.

A paged heap logs it when it is made, at info: "view heap paged", with
the title's slots, the host's slots, its pages and how many are fixed.
The probe's own line can come before logging is set up; this one comes
when the title makes its heap.
The page-use log, the no-room warning and a new log of pages written
with no room left say how many slots of the pages placed on a write
were written: whether smaller pages would fit more of a title, or the
title writes that many views.
Clippy's manual_is_multiple_of lint (Rust 1.98) flags the % in the
compile-time check of the page size.
With view pages and marks, every instruction that reads or writes
through a view the program takes from the heap (the heap itself or a
table) also sets bit VIEW_PAGE_READS + the index's page in the
view-writes bitmap, where still clear: a load, a test and a branch, the
atomic only the first time in a submission. A page is marked once per
console block, at the end of the first instruction there that uses a
handle of it. A handle first used inside guarded code an instruction
made (whose values the instruction's end does not see) is marked there
with the atomic alone.

The host needs this to take back view heap pages: on an RTX 4090 the
title filled all 3,906 host pages within minutes, and "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 in a
run; the marks say which pages shaders still read.

The read mark of a texture view and the page mark share one helper. The
shader cache key changes with the translator's sources, so translations
without page marks are not reused.
Place-on-first-write never gave a page back, and the title's world
filled the 2,880 host pages it gets on NVIDIA within minutes (RTX 4090:
"view heap pages written with no room left" at pages=1024, about 231,000
slots written, 226 of 256 a page). After that, every page written next
read null.

Each virtual page now has a last-used stamp (submissions run): a slot
written, a shader-visible handle given out, a draw binding a slot of it
through a table, or its read mark (shadow::take_page_reads, both
bitmaps; the bitmap grows by a bit per page). Between submissions, after
the read marks are taken, where fewer than 1/32 of the host pages are
free, pages placed on a write that hold title slots only and were unused
for 300 submissions and 10 s are taken back, least recently used first,
until 1/16 are free. Taking a page back enters the null page in the
table, retires what its slots viewed, clears their write marks and
copies null views over its host page before that page goes on a free
list, which writes use before pages never given out. The dynamic slots'
pages and the host's own pairs and null views are never taken back.

Slot records stay noted, so heap syncs (which walk every slot of a 64 KiB
title page with a write in it) pass a taken-back page by. It is placed
again when the title changes a record there, when a draw makes a
texture's view there, or when its read mark comes in after a
submission. A page placed again has all its slots made from the title's
records before the next submission, or made null where the title holds
no view now; a page written while there was no room is made again the
same way once it gets a place. A wrong guess costs a submission of null
reads.

Logs: "view heap pages unused lately taken back" and "view heap pages
placed again" at power-of-two totals, with the free pages and pages in
use. The page code moves to descriptor/pages.rs.
A title heap whose slots and the dynamic slots past them reach past the
slots shaders index (HEAP_VIEWS) is capped in a paged heap as the
unpaged heap is capped at the host's limit: the dynamic slots and the
null buffer views keep their pages in the page table, and title slots
past the cap are left out.
A page that is placed while the title has records its host page lacks is
now counted by why it lacked them: taken back by reclaiming and then read,
written or drawn through (placed again), or written when no host page was
free (placed late). A page taken back and then written with no room counts
as placed again. "view heap pages placed again" logs both totals,
taken_back= and refused=, beside pages= (their sum) and in_use=, where
either total reaches a power of two.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:55:28 +00:00
Pages were taken back only once unused for both 300 submissions and 10 s.
At a few frames a second every page the title writes is younger than
that, so when the host pages ran out no page qualified and fresh slots
read null until enough time had passed.

A write that finds no host page now marks the pages under pressure until
the next pass of take_back. That pass, where room is short, also takes
back pages unused for more than 32 submissions, with no time minimum,
least recently used first and up to the high-water mark as before. Pages
old by the strict ages are the oldest, so they still go first. 32
submissions is more than a frame takes, so pages read every frame stay.
A pass with no write refused since the last one is unchanged. The
"view heap pages unused lately taken back" line logs relaxed= (whether
the pass took pages younger than the strict ages) and relaxed_total=.

Suggested by @kawaii-shakal, with measurements on the PR.
A view heap counts its dynamic slots taken, under the lock that taking
and giving them back already holds, and keeps the most taken at once and
the longest run asked for. Where either passes a power of two it logs
"view heap dynamic slots in use" with peak, of (the heap's dynamic
slots) and run. Nothing else changes.
With the switch, a paged view heap takes no page back, and a write past the free pages is refused as it was before pages were taken back. For telling whether a picture's missing views come from the take-back.
A paged heap's host heap is capped, as a heap with MIN_DYNAMIC dynamic slots is, so it takes MIN_DYNAMIC too: 768 more host pages hold the title's slots, and the paged cap on title slots rises by as many slots.
A paged view heap has MIN_DYNAMIC dynamic slots since #2121's c1d5a3a2, so its view pairs lie from count + 65,536 on, not 2^18: the test asks the heap where its dynamic slots end.
Author
Owner

@⁠yualk on GitHub · 2026-11-25 05:48 UTC · original

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.

**@⁠yualk** on GitHub · 2026-11-25 05:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7154157455) 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](https://github.com/Marvisak/VIctory/blob/442632413ce4e8b081b8c4ae4174a51a3682e7f4/crates/victory-gpu/src/host.rs#L2233-L2256), but [paged initialization](https://github.com/Marvisak/VIctory/blob/442632413ce4e8b081b8c4ae4174a51a3682e7f4/crates/victory-gpu/src/descriptor/host.rs#L307-L322) 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](https://learn.microsoft.com/en-us/windows/win32/direct3d12/descriptors-overview#null-descriptors)). AI-assisted; no title data or captures used.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-25 05:49 UTC · original

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 (#2016, the vertex UAV flag; #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.

**@⁠fiestorra** on GitHub · 2026-11-25 05:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7154174058) **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** (#2016, the vertex UAV flag; #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.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 05:59 UTC · original

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.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 05:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7154325386) 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.
Author
Owner

@⁠iGoldenNinja on GitHub · 2026-11-25 06:06 UTC · original · edited 2026-11-25 06:35 UTC

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

**@⁠iGoldenNinja** on GitHub · 2026-11-25 06:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7154443823) · edited 2026-11-25 06:35 UTC 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](https://github.com/iGoldenNinja/victory-fork/blob/6a359ebfb06ca62f26660d0314b16fdc71f5ff4b/docs/victory-view-pages-pr2121-5080.md) 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](https://github.com/iGoldenNinja/victory-fork/blob/ea068019bdae517f5580c15cfbc6bd2c5b494ebe/docs/ssd-pr2121-paging-port-5080.md)
Author
Owner

@⁠JurajSimicevic on GitHub · 2026-11-25 06:47 UTC · original · edited 2026-11-25 07:34 UTC

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
  • A no longer hangs with this PR, even without #1906 (first column). With every title slot placed, A's table is no longer made afresh in the dynamic slots.
  • For comparison, the unpaged heap with #1762 and only A skipped ran 12.5 minutes on this card with no removal (#1968), with 65,536 to 131,071 draws dropped for lack of dynamic slots (corrected from 131,071, a sum of the cumulative counter's log lines). With two runs I can't tell whether the removals above come from the null reads after the pages are full.
  • Merging: with #1762 the only conflict is two tests added at the same place in stride_tests.rs. With #1906 it is two tests in descriptor/host.rs, and with #2098 the doc comment of write_address. With #1762 + this PR, victory-gpu (148 passed) and victory-shader (250 passed) have no failures on this RTX 5080. On main five fail here.

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

AI-assisted (Claude Code).

**@⁠JurajSimicevic** on GitHub · 2026-11-25 06:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7155153701) · edited 2026-11-25 07:34 UTC **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 | - **A no longer hangs with this PR, even without #1906** (first column). With every title slot placed, A's table is no longer made afresh in the dynamic slots. - For comparison, the unpaged heap with #1762 and only A skipped ran 12.5 minutes on this card with no removal (#1968), with 65,536 to 131,071 draws dropped for lack of dynamic slots *(corrected from 131,071, a sum of the cumulative counter's log lines)*. With two runs I can't tell whether the removals above come from the null reads after the pages are full. - **Merging:** with #1762 the only conflict is two tests added at the same place in `stride_tests.rs`. With #1906 it is two tests in `descriptor/host.rs`, and with #2098 the doc comment of `write_address`. With #1762 + this PR, `victory-gpu` (148 passed) and `victory-shader` (250 passed) have no failures on this RTX 5080. On `main` five fail here. No game data attached: counters, timings and log warnings only. AI-assisted (Claude Code).
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 07:21 UTC · original

Thanks both, this is the measurement the PR needed.

What I take from it:

  • Paging does what it's for. No title slot past the host heap, no draws dropped for dynamic slots, and #1968's program A no longer hangs, even without #1906.
  • But the world fills the pages. 2,880 title pages hold 737,280 slots. The title heap is 4,864 pages, and the world writes into more than 2,880 of them within seconds. Once they're full, a slot on an unplaced page reads the null page. So on this title paging moves the limit instead of removing 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.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 07:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7155767924) Thanks both, this is the measurement the PR needed. What I take from it: - **Paging does what it's for.** No `title slot past the host heap`, no draws dropped for dynamic slots, and #1968's program A no longer hangs, even without #1906. - **But the world fills the pages.** 2,880 title pages hold 737,280 slots. The title heap is 4,864 pages, and the world writes into more than 2,880 of them within seconds. Once they're full, a slot on an unplaced page reads the null page. So on this title paging moves the limit instead of removing 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.
Author
Owner

@⁠GaussianGuaicai on GitHub · 2026-11-25 08:05 UTC · original

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.

**@⁠GaussianGuaicai** on GitHub · 2026-11-25 08:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7156599725) 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.
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 10:09 UTC · original

Offline measurement on a retail dump

Result: no count change against main.

I merged head 40bd2100 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).

**@⁠sinan-cmyk** on GitHub · 2026-11-25 10:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7159309535) ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head 40bd2100 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).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 10:46 UTC · original · edited 2026-11-26 07:21 UTC

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

**@⁠Marvisak** on GitHub · 2026-11-25 10:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7160149517) · edited 2026-11-26 07:21 UTC <!-- victory-triage v1 head=c23f70853f3c9887642b0345b127aa08498eef14 verdict=needs-work at=2026-11-26T07:21:47Z --> 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](https://claude.ai/code)_
Author
Owner

@⁠crissuper20 on GitHub · 2026-11-25 11:03 UTC · original

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.

**@⁠crissuper20** on GitHub · 2026-11-25 11:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7160522085) 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.
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 11:04 UTC · original

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).

**@⁠sinan-cmyk** on GitHub · 2026-11-25 11:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7160556421) ### 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).
Author
Owner

@⁠latentdev on GitHub · 2026-11-25 16:04 UTC · original

In-world on an RTX 4090: both capped-heap layouts fill up within minutes

RTX 4090, driver 621.24, Windows 11, title 1.0.2.1, diag build, opening cutscene. I ran this PR and #1779 (9323a74) on main 940d32f + #1778 + #1630 + #1832 + #2332 + #2178. The #1779 run also had #233; the runs of this PR didn't.

#1779: the title gets 720,896 host slots in blocks of 1,024. "A title view without a host slot" is logged at power-of-two write counts. Its sampled indices range from 390,106 to 1,210,753, and the write count reached 16,777,216 before the run ended. All of the write views of the lighting passes 2dc364df5d3278b8, 34fb51b8a0312e82 and 5cf00dc39042edaf that VICTORY_TRACE_SHADERS listed were slot null (23 of 23), as were 2,939 of the 13,100 bindings traced.

This PR (40bd210): paging fixes that at first. There are 0 "without a host slot" warnings and 0 null slots among the traced bindings. But all 3,906 host pages are in use within a few minutes, and "view heap pages written with no room left" reaches pages=1024, written≈231,000 (232,002 in one run, 230,748 in another). In a later run with the same overflow, the light-list pass 5cf00dc39042edaf read its per-pass root view at slot 1,156,966 as null.

My guess is that the title writes fresh descriptors across most of its 1,245,184 slots over a run, so any layout that places on first write and never gives back runs out. Both layouts might hold the live set if they reclaimed blocks or pages not written or read recently. The per-slot read marks from #1962, now on main too, already record which slots shaders read.

The lighting outputs stayed at zero with this PR even while no traced slot was null, so the slots aren't the whole story. All of this was on 940d32f. main has since gained command-list memory waits (9cc37c5) and placed textures made on read (52d14b1), and I'll rerun this on current main.

**@⁠latentdev** on GitHub · 2026-11-25 16:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7167577085) ### In-world on an RTX 4090: both capped-heap layouts fill up within minutes RTX 4090, driver 621.24, Windows 11, title 1.0.2.1, diag build, opening cutscene. I ran this PR and #1779 (9323a74) on `main` 940d32f + #1778 + #1630 + #1832 + #2332 + #2178. The #1779 run also had #233; the runs of this PR didn't. **#1779:** the title gets 720,896 host slots in blocks of 1,024. "A title view without a host slot" is logged at power-of-two write counts. Its sampled indices range from 390,106 to 1,210,753, and the write count reached 16,777,216 before the run ended. All of the write views of the lighting passes `2dc364df5d3278b8`, `34fb51b8a0312e82` and `5cf00dc39042edaf` that `VICTORY_TRACE_SHADERS` listed were `slot null` (23 of 23), as were 2,939 of the 13,100 bindings traced. **This PR (40bd210):** paging fixes that at first. There are 0 "without a host slot" warnings and 0 null slots among the traced bindings. But all 3,906 host pages are in use within a few minutes, and "view heap pages written with no room left" reaches pages=1024, written≈231,000 (232,002 in one run, 230,748 in another). In a later run with the same overflow, the light-list pass `5cf00dc39042edaf` read its per-pass root view at slot 1,156,966 as null. My guess is that the title writes fresh descriptors across most of its 1,245,184 slots over a run, so any layout that places on first write and never gives back runs out. Both layouts might hold the live set if they reclaimed blocks or pages not written or read recently. The per-slot read marks from #1962, now on `main` too, already record which slots shaders read. The lighting outputs stayed at zero with this PR even while no traced slot was null, so the slots aren't the whole story. All of this was on `940d32f`. `main` has since gained command-list memory waits (9cc37c5) and placed textures made on read (52d14b1), and I'll rerun this on current `main`.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 18:37 UTC · original

Thanks all. @⁠latentdev, your overflow log settles the question from my last comment. 1,024 refused pages with about 231,000 slots written is about 226 of 256 slots per page, so the pages that miss out are nearly full. Smaller pages wouldn't fit noticeably more. The title really does write fresh descriptors over most of its 1,245,184 slots, and anything that places on first write and never gives back runs out, as you say for both layouts.

So the next step is reclaiming, not resizing. A host page whose slots no shader has read for a while can go back to the free list and its virtual page back to the null page. The per-slot read marks already on main give the "read lately" signal. A reclaimed page that's read again just reads null until it's written again. That's the same as today's overflow, but only for stale slots instead of whichever pages came last. I'll look at it on top of this PR. The other open question is when it's safe to recycle a host page while a submitted list may still read it; the retirement fence release_retired already tracks covers that.

@⁠GaussianGuaicai @⁠crissuper20 thanks for the 5070 Ti and Turing runs: 262k and 310k title slot past the host heap warnings down to 0. The rejected R32_UINT → R9G9B9E5_SHAREDEXP SRV and the dark image are separate from this PR. The removal on the 5070 Ti matches that SRV, not the heap. The branch is now rebased onto 13f91ca.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 18:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7171159649) Thanks all. @⁠latentdev, your overflow log settles the question from my last comment. 1,024 refused pages with about 231,000 slots written is about 226 of 256 slots per page, so the pages that miss out are nearly full. Smaller pages wouldn't fit noticeably more. The title really does write fresh descriptors over most of its 1,245,184 slots, and anything that places on first write and never gives back runs out, as you say for both layouts. So the next step is reclaiming, not resizing. A host page whose slots no shader has read for a while can go back to the free list and its virtual page back to the null page. The per-slot read marks already on `main` give the "read lately" signal. A reclaimed page that's read again just reads null until it's written again. That's the same as today's overflow, but only for stale slots instead of whichever pages came last. I'll look at it on top of this PR. The other open question is when it's safe to recycle a host page while a submitted list may still read it; the retirement fence `release_retired` already tracks covers that. @⁠GaussianGuaicai @⁠crissuper20 thanks for the 5070 Ti and Turing runs: 262k and 310k `title slot past the host heap` warnings down to 0. The rejected `R32_UINT` → `R9G9B9E5_SHAREDEXP` SRV and the dark image are separate from this PR. The removal on the 5070 Ti matches that SRV, not the heap. The branch is now rebased onto 13f91ca.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-25 19:05 UTC · original

I tested this PR on an NVIDIA GeForce RTX 4090 Laptop GPU (driver 621.14) with Rust 1.98.1 MSVC on Windows 11 (build 26300.9974). I ran cargo test --offline --locked -p victory-gpu --lib -- --test-threads=1 on both revisions. On main at 13f91ca, 193 tests passed, 2 failed, and 1 was ignored. Both failures, descriptor::host::tests::dynamic_slots_are_held_until_released and memory::tests::lists_share_a_table_and_copies_keep_their_views, passed on the PR at 6fbfa4b, where the suite finished with 197 passed, 0 failed, and 1 ignored. A separate run of the descriptor test confirmed via DXGI that D3D12 selected the RTX 4090 Laptop GPU. This was a GPU unit-test run with no game files. I used Codex to run the tests and summarize the results.

**@⁠passerbyyhx** on GitHub · 2026-11-25 19:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7171816275) I tested this PR on an NVIDIA GeForce RTX 4090 Laptop GPU (driver 621.14) with Rust 1.98.1 MSVC on Windows 11 (build 26300.9974). I ran `cargo test --offline --locked -p victory-gpu --lib -- --test-threads=1` on both revisions. On `main` at `13f91ca`, 193 tests passed, 2 failed, and 1 was ignored. Both failures, `descriptor::host::tests::dynamic_slots_are_held_until_released` and `memory::tests::lists_share_a_table_and_copies_keep_their_views`, passed on the PR at `6fbfa4b`, where the suite finished with 197 passed, 0 failed, and 1 ignored. A separate run of the descriptor test confirmed via DXGI that D3D12 selected the RTX 4090 Laptop GPU. This was a GPU unit-test run with no game files. I used Codex to run the tests and summarize the results.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-25 19:48 UTC · original

Follow-up from the RTX 4090 Laptop (driver 621.14) on 6fbfa4b: I opened a hardware test against this PR’s head branch. It uses two generated 1×1 textures and reads back both the color and the physical descriptor slot.

With two allocatable pages, I closed a list while B was unmapped, placed B before submission, then submitted that same list. The GPU read A red at slot 262919, B green at 263175, and the blue control at 519. With just one allocatable page, the host submission fence stayed at 4 (target 5) across a refused request for B. After I opened a separate CPU gate, the queue completed 5 and the old list read red / transparent black / blue. Retrying after a control-only submission still left B on the null page.

This gives a baseline for testing a future recycler. The outstanding check is whether B can acquire A’s same physical slot after the retirement condition is satisfied. The GPU suite finished with 198 passed, 0 failed, 1 ignored. AI-assisted with Codex.

**@⁠passerbyyhx** on GitHub · 2026-11-25 19:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7172786355) Follow-up from the RTX 4090 Laptop (driver 621.14) on `6fbfa4b`: I opened a [hardware test against this PR’s head branch](https://github.com/0xkn0wh3r3/VIctory/pull/1). It uses two generated 1×1 textures and reads back both the color and the physical descriptor slot. With two allocatable pages, I closed a list while B was unmapped, placed B before submission, then submitted that same list. The GPU read A red at slot 262919, B green at 263175, and the blue control at 519. With just one allocatable page, the host submission fence stayed at 4 (target 5) across a refused request for B. After I opened a separate CPU gate, the queue completed 5 and the old list read red / transparent black / blue. Retrying after a control-only submission still left B on the null page. This gives a baseline for testing a future recycler. The outstanding check is whether B can acquire **A’s same physical slot** after the retirement condition is satisfied. The GPU suite finished with 198 passed, 0 failed, 1 ignored. AI-assisted with Codex.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-25 20:23 UTC · original

For the cold-page question, I checked which descriptor slot the runtime reports after a translated heap-direct image_load on a GeForce RTX 4090 Laptop GPU (621.14). Red A and blue B stayed mapped throughout. Virtual A/B/output slots were 519 / 7 / 776, with physical slots 262919 / 263175 / 520. All six indices were distinct.

Completed submission GPU output reads_since() Selected slot reported as new
First read of A Red [519] Yes
No dispatch Sentinel unchanged [] No
Read A again Red [519] No
Read B only Blue [7] Yes

The window followed the original virtual slot and reported repeat use. The newly-read notification fired once per slot in this fixture. B stayed unreported until the shader read it. This gives one signal for choosing cold pages after completed submissions. Safe reuse still needs a fence covering the last work that can use the old mapping. The fixture uses runtime shader translation and page tables with manually bound test root arguments. It exercises no page reassignment.

Reproducer commit, based on the earlier fence fixture. Set VICTORY_VIEW_PAGES=1 and run this test alone, since the bitmap is process-wide:

cargo test --locked -p victory-gpu --lib descriptor::host::page_retirement::translated_reads::translated_texture_reports_its_virtual_slot_in_each_read_window -- --exact --ignored --nocapture --test-threads=1

The four windows passed in default and diagnostics builds. The default GPU suite passed 198 tests, with 2 ignored. Code and hardware testing assisted by Codex.

**@⁠passerbyyhx** on GitHub · 2026-11-25 20:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7173605268) For the cold-page question, I checked which descriptor slot the runtime reports after a translated heap-direct `image_load` on a GeForce RTX 4090 Laptop GPU (621.14). Red A and blue B stayed mapped throughout. Virtual A/B/output slots were `519 / 7 / 776`, with physical slots `262919 / 263175 / 520`. All six indices were distinct. | Completed submission | GPU output | `reads_since()` | Selected slot reported as new | |---|---|---|---| | First read of A | Red | `[519]` | Yes | | No dispatch | Sentinel unchanged | `[]` | No | | Read A again | Red | `[519]` | No | | Read B only | Blue | `[7]` | Yes | The window followed the original virtual slot and reported repeat use. The newly-read notification fired once per slot in this fixture. B stayed unreported until the shader read it. This gives one signal for choosing cold pages after completed submissions. Safe reuse still needs a fence covering the last work that can use the old mapping. The fixture uses runtime shader translation and page tables with manually bound test root arguments. It exercises no page reassignment. [Reproducer commit](https://github.com/passerbyyhx/VIctory/commit/a85683ab7ed54f8e24173b3a183d555ba10e0fb6), based on the earlier fence fixture. Set `VICTORY_VIEW_PAGES=1` and run this test alone, since the bitmap is process-wide: `cargo test --locked -p victory-gpu --lib descriptor::host::page_retirement::translated_reads::translated_texture_reports_its_virtual_slot_in_each_read_window -- --exact --ignored --nocapture --test-threads=1` The four windows passed in default and diagnostics builds. The default GPU suite passed 198 tests, with 2 ignored. Code and hardware testing assisted by Codex.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 20:33 UTC · original

@⁠latentdev @⁠JurajSimicevic @⁠iGoldenNinja: a12b972 adds page reclaiming on top of paging, as discussed above.

  • Page read marks: on a paged host, a shader reading a view through the page table also marks the page read. That covers buffer views too, which the per-slot texture read marks don't. A mark costs a load and a test per (block, handle); the atomic runs only while the bit is clear, so about once per page per submission.
  • Taking pages back: between submissions, when fewer than 1/32 of host pages are free, pages no shader or command used for 300 submissions and 10 s are taken back, oldest first, until 1/16 are free. A taken-back page gets a null table entry, its host views are released, and its host page is nulled before reuse.
  • Placing them again: a taken-back page that is read (its mark), written or drawn through is placed again, with its slots remade from the title's records before the next submission. A wrong guess costs one submission of null reads for that page. Pages that were refused room before now get remade too, once there is room.

Could you rerun your setup (diag build; shaders are retranslated automatically) and post these info lines with their counts?

  • view heap pages unused lately taken back (total, free, in_use)
  • view heap pages placed again
  • whether no room left in the host view heap or view heap pages written with no room left still appear

If those don't appear while taken back keeps climbing, the live set fits. A placed again count close to taken back would mean the age limits are too short.

@⁠passerbyyhx thanks for the hardware test on your fork. Your sequence (a list closed while B was unmapped, then B placed before submission, reads B) is the property this relies on: the page table is read when the list runs. A host page taken back is now nulled before it goes back to the free list, so B can take A's physical page once it's free. The unit tests in descriptor::pages and host::tests::view_heap_pages_taken_back_are_placed_again_when_read cover that path on the host heap.

Tests: victory-gpu 203 passed, 0 failed (the two NVIDIA heap failures on main pass here), also with VICTORY_VIEW_PAGES=1. The new views_read_in_a_paged_view_heap_mark_their_pages passes on hardware and WARP, and the paged program passes the DXIL validator.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 20:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7173856892) @⁠latentdev @⁠JurajSimicevic @⁠iGoldenNinja: a12b972 adds page reclaiming on top of paging, as discussed above. - **Page read marks:** on a paged host, a shader reading a view through the page table also marks the page read. That covers buffer views too, which the per-slot texture read marks don't. A mark costs a load and a test per (block, handle); the atomic runs only while the bit is clear, so about once per page per submission. - **Taking pages back:** between submissions, when fewer than 1/32 of host pages are free, pages no shader or command used for 300 submissions and 10 s are taken back, oldest first, until 1/16 are free. A taken-back page gets a null table entry, its host views are released, and its host page is nulled before reuse. - **Placing them again:** a taken-back page that is read (its mark), written or drawn through is placed again, with its slots remade from the title's records before the next submission. A wrong guess costs one submission of null reads for that page. Pages that were refused room before now get remade too, once there is room. Could you rerun your setup (diag build; shaders are retranslated automatically) and post these info lines with their counts? - `view heap pages unused lately taken back` (`total`, `free`, `in_use`) - `view heap pages placed again` - whether `no room left in the host view heap` or `view heap pages written with no room left` still appear If those don't appear while `taken back` keeps climbing, the live set fits. A `placed again` count close to `taken back` would mean the age limits are too short. @⁠passerbyyhx thanks for the hardware test on your fork. Your sequence (a list closed while B was unmapped, then B placed before submission, reads B) is the property this relies on: the page table is read when the list runs. A host page taken back is now nulled before it goes back to the free list, so B can take A's physical page once it's free. The unit tests in `descriptor::pages` and `host::tests::view_heap_pages_taken_back_are_placed_again_when_read` cover that path on the host heap. Tests: `victory-gpu` 203 passed, 0 failed (the two NVIDIA heap failures on `main` pass here), also with `VICTORY_VIEW_PAGES=1`. The new `views_read_in_a_paged_view_heap_mark_their_pages` passes on hardware and WARP, and the paged program passes the DXIL validator.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 20:34 UTC · original

@⁠passerbyyhx thanks, that's a useful check that read windows follow the virtual slot. On the fence: reclaiming in a12b972 runs at the point in Host::execute where the submission has completed and the next one waits for our lock, the same place take_reads/make_read run. execute waits for each submission, so no GPU work that could use the old mapping is in flight when a page is taken back. The page table is read when a list runs, so a list recorded earlier but submitted later sees the null entry or the new placement, never the old host page. The one recorded command that bakes a host handle (the UAV clear) uses a dynamic slot, which is never taken back. Since texture read marks cover only textures, a12b972 also adds per-page read marks set by every paged heap access, and those drive both the age and re-placement.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 20:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7173878484) @⁠passerbyyhx thanks, that's a useful check that read windows follow the virtual slot. On the fence: reclaiming in a12b972 runs at the point in `Host::execute` where the submission has completed and the next one waits for our lock, the same place `take_reads`/`make_read` run. `execute` waits for each submission, so no GPU work that could use the old mapping is in flight when a page is taken back. The page table is read when a list runs, so a list recorded earlier but submitted later sees the null entry or the new placement, never the old host page. The one recorded command that bakes a host handle (the UAV clear) uses a dynamic slot, which is never taken back. Since texture read marks cover only textures, a12b972 also adds per-page read marks set by every paged heap access, and those drive both the age and re-placement.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-25 20:48 UTC · original

Tested a12b972 on a GeForce RTX 4090 Laptop GPU (621.14). B acquired A's former physical page 1027, offset 7, slot 262919. The old command still sampled red from A. This used two generated 1×1 textures, one registered title heap and the normal host direct queue.

Observation A (virtual slot 519) B (virtual slot 7) Control
Old list, read back after fence 302 Red at physical slot 262919 Transparent black Blue at physical slot 519
First translated demand for B after A aged Transparent black
Next submission Transparent black Green at physical slot 262919 Blue at physical slot 519

While the old list was queued, the completed fence stayed at 301 across a refused request for B (target 302). Each aging window used 299 real empty submissions, just over 10 seconds of wall time, and one dispatch at the boundary. We kept the filler pages hot with CPU handle requests. B's green comes from swapping G/B on a view of the live blue control texture. A separate GPU readback echoed the physical page, slot and RGBA. The handoff occurred after the old submission completed.

The diagnostics build emitted these counts in order:

no room left in the host view heap        pages=3906 written=2881 of=737280
view heap pages written with no room left pages=2 written=2 placed_written=2881 of=737280
view heap pages unused lately taken back  pages=1 total=1 free=1 in_use=2879
view heap pages placed again              pages=1 in_use=2880

The two overflow messages were intentional. We exhausted all 2,880 allocatable pages, then wrote B and a second virtual page (4095). Only B received a GPU demand and the second page stayed unmapped. These counts describe the synthetic workload. In-game page pressure and the frequency of first-read misses remain open.

Reproducer and PowerShell command · Tested source. The strict case passed in default and diagnostics builds. AI-assisted test design and implementation.

**@⁠passerbyyhx** on GitHub · 2026-11-25 20:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7174220795) Tested `a12b972` on a GeForce RTX 4090 Laptop GPU (621.14). **B acquired A's former physical page 1027, offset 7, slot 262919.** The old command still sampled red from A. This used two generated 1×1 textures, one registered title heap and the normal host direct queue. | Observation | A (virtual slot 519) | B (virtual slot 7) | Control | | --- | --- | --- | --- | | Old list, read back after fence 302 | Red at physical slot 262919 | Transparent black | Blue at physical slot 519 | | First translated demand for B after A aged | | Transparent black | | | Next submission | Transparent black | Green at physical slot 262919 | Blue at physical slot 519 | While the old list was queued, the completed fence stayed at 301 across a refused request for B (target 302). Each aging window used 299 real empty submissions, just over 10 seconds of wall time, and one dispatch at the boundary. We kept the filler pages hot with CPU handle requests. B's green comes from swapping G/B on a view of the live blue control texture. A separate GPU readback echoed the physical page, slot and RGBA. The handoff occurred after the old submission completed. The diagnostics build emitted these counts in order: ```text no room left in the host view heap pages=3906 written=2881 of=737280 view heap pages written with no room left pages=2 written=2 placed_written=2881 of=737280 view heap pages unused lately taken back pages=1 total=1 free=1 in_use=2879 view heap pages placed again pages=1 in_use=2880 ``` The two overflow messages were intentional. We exhausted all 2,880 allocatable pages, then wrote B and a second virtual page (4095). Only B received a GPU demand and the second page stayed unmapped. These counts describe the synthetic workload. In-game page pressure and the frequency of first-read misses remain open. [Reproducer and PowerShell command](https://github.com/0xkn0wh3r3/VIctory/pull/1) · [Tested source](https://github.com/passerbyyhx/VIctory/commit/7f5455a940af0ba752f070219bd7617e89cac32c). The strict case passed in default and diagnostics builds. AI-assisted test design and implementation.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 21:05 UTC · original

@⁠passerbyyhx thank you, that's the end-to-end check the reclaim needed:

  • B takes A's old physical page (1027, slot 262919) only after the old submission has completed.
  • The old list still samples A's red.
  • B reads null on its first demand and green from the next submission on.

That one null first read is the cost the design accepts for a wrong guess, and your counts line up with the four log lines as intended. How often in-game reads hit a taken-back page is the open question for the title runs.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 21:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7174599368) @⁠passerbyyhx thank you, that's the end-to-end check the reclaim needed: - B takes A's old physical page (1027, slot 262919) only after the old submission has completed. - The old list still samples A's red. - B reads null on its first demand and green from the next submission on. That one null first read is the cost the design accepts for a wrong guess, and your counts line up with the four log lines as intended. How often in-game reads hit a taken-back page is the open question for the title runs.
Author
Owner

@⁠aef200 on GitHub · 2026-11-25 22:12 UTC · original

A crash report from an NVIDIA card where the paging itself works, if it helps: the layer faults in resource::alias_source shortly after the paged heap comes up.

Setup RTX 4060 Ti 8 GB, driver 32.0.16.2124, Windows 11 26200, Series X profile, diagnostics build of main at 61bfc77 with this PR's a12b972 applied (the patch applied cleanly to main; nothing else changed).

The paging starts and reports itself:

victory_gpu::descriptor::host: view heap paged: the host caps view heaps, title slots are placed by page
  slots=1245184  host_slots=1000000  pages=3906  fixed=1026

48 seconds later the layer faults:

first-chance exception 0xc0000005 at victory.exe+0x22c1d3 (read 0x30: nothing mapped there)

Symbolized from the PDB of that same build:

#0  victory_gpu::resource::alias_source::closure$1+0x23
#1  victory_gpu::resource::alias_source+0x6e
#2  victory_gpu::draw::readable+0x279
#3  victory_gpu::draw::State::bind+0xb8c
#4  victory_gpu::draw::State::execute_indirect+0x9b5
#5  victory_gpu::list::execute_indirect+0x252

So the read is a null pointer plus the 0x30 field, taken inside alias_source while a draw binds its indirect arguments - after the heap has been paged. My guess, since a12b972 added page reclaiming: alias_source is resolving an alias for a view whose page has just been reclaimed, and the source it looks up is gone.

For contrast, on this card the same tree without the PR boots and reaches the world without this fault (everything else about it is the same: 1 fps, the intro cutscene draws, the known 0xC0000005 at victory_image+0x3de6491 comes later, minutes in). So this one looks specific to the paged path.

I can re-run with any diagnostic switch you would like set, or dump the surrounding log; the run is repeatable in under a minute.

**@⁠aef200** on GitHub · 2026-11-25 22:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7176073663) A crash report from an NVIDIA card where the paging itself works, if it helps: the layer faults in `resource::alias_source` shortly after the paged heap comes up. **Setup** RTX 4060 Ti 8 GB, driver 32.0.16.2124, Windows 11 26200, Series X profile, diagnostics build of `main` at `61bfc77` with this PR's `a12b972` applied (the patch applied cleanly to main; nothing else changed). **The paging starts and reports itself:** ``` victory_gpu::descriptor::host: view heap paged: the host caps view heaps, title slots are placed by page slots=1245184 host_slots=1000000 pages=3906 fixed=1026 ``` **48 seconds later the layer faults:** ``` first-chance exception 0xc0000005 at victory.exe+0x22c1d3 (read 0x30: nothing mapped there) ``` Symbolized from the PDB of that same build: ``` #0 victory_gpu::resource::alias_source::closure$1+0x23 #1 victory_gpu::resource::alias_source+0x6e #2 victory_gpu::draw::readable+0x279 #3 victory_gpu::draw::State::bind+0xb8c #4 victory_gpu::draw::State::execute_indirect+0x9b5 #5 victory_gpu::list::execute_indirect+0x252 ``` So the read is a null pointer plus the `0x30` field, taken inside `alias_source` while a draw binds its indirect arguments - after the heap has been paged. My guess, since `a12b972` added page reclaiming: `alias_source` is resolving an alias for a view whose page has just been reclaimed, and the source it looks up is gone. For contrast, on this card the same tree **without** the PR boots and reaches the world without this fault (everything else about it is the same: 1 fps, the intro cutscene draws, the known `0xC0000005` at `victory_image+0x3de6491` comes later, minutes in). So this one looks specific to the paged path. I can re-run with any diagnostic switch you would like set, or dump the surrounding log; the run is repeatable in under a minute.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 22:20 UTC · original

A note for whichever of #2121 and #2821 lands second: they merge cleanly but clash in HostHeap::mirror.

  • #2821 adds a lock-free ready check that skips a slot already made from the same record.
  • #2121's page reclaiming keeps each slot's made record when it takes a page back, so a page placed again is never remade: host::tests::view_heap_pages_taken_back_are_placed_again_when_read fails at "made from the title's record".

The fix is to clear ready for a page's slots in take_back_pages and in remakes (crates/victory-gpu/src/descriptor/host.rs). I'll add it to whichever branch lands second.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 22:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7176247212) A note for whichever of #2121 and #2821 lands second: they merge cleanly but clash in `HostHeap::mirror`. - #2821 adds a lock-free `ready` check that skips a slot already made from the same record. - #2121's page reclaiming keeps each slot's `made` record when it takes a page back, so a page placed again is never remade: `host::tests::view_heap_pages_taken_back_are_placed_again_when_read` fails at "made from the title's record". The fix is to clear `ready` for a page's slots in `take_back_pages` and in `remakes` (crates/victory-gpu/src/descriptor/host.rs). I'll add it to whichever branch lands second.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 22:33 UTC · original

@⁠aef200 thanks, that's a useful report. A repeatable run in under a minute is exactly what's needed to pin it down.

alias_source looks for another title texture in the same memory (TEXTURES_AT, keyed by address) to alias from. The fault is a null-plus-0x30 read inside its search. Page reclaiming in a12b972 doesn't touch title resources or TEXTURES_AT. When it takes a page back it drops the host views and per-slot state, and a page read again is remade from the title's records. So I don't see the link from the code alone yet. Could you help narrow it down?

  1. Paging without reclaiming: the same run on 6fbfa4b, the PR's head before reclaiming (git checkout 6fbfa4b, or apply only up to it). If it doesn't fault, reclaiming is involved. If it does, it's paging itself.
  2. The log just before the fault: whether view heap pages unused lately taken back or view heap pages placed again appear before it, with their counts. Reclaiming only starts once fewer than 1/32 of host pages are free. If neither line appears, no page had been taken back when it faulted.
  3. Line numbers: if your PDB gives them for frames #0–#2, the exact source lines in alias_source and readable. closure$1 could be the address lookup, the bytes closure or the find closure.

A null read at 0x30 suggests a resource pointer or field that is null, rather than a freed one, so the exact line would settle a lot.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 22:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7176510805) @⁠aef200 thanks, that's a useful report. A repeatable run in under a minute is exactly what's needed to pin it down. `alias_source` looks for another title texture in the same memory (`TEXTURES_AT`, keyed by address) to alias from. The fault is a null-plus-0x30 read inside its search. Page reclaiming in a12b972 doesn't touch title resources or `TEXTURES_AT`. When it takes a page back it drops the host views and per-slot state, and a page read again is remade from the title's records. So I don't see the link from the code alone yet. Could you help narrow it down? 1. **Paging without reclaiming:** the same run on `6fbfa4b`, the PR's head before reclaiming (`git checkout 6fbfa4b`, or apply only up to it). If it doesn't fault, reclaiming is involved. If it does, it's paging itself. 2. **The log just before the fault:** whether `view heap pages unused lately taken back` or `view heap pages placed again` appear before it, with their counts. Reclaiming only starts once fewer than 1/32 of host pages are free. If neither line appears, no page had been taken back when it faulted. 3. **Line numbers:** if your PDB gives them for frames #0–#2, the exact source lines in `alias_source` and `readable`. `closure$1` could be the address lookup, the `bytes` closure or the `find` closure. A null read at 0x30 suggests a resource pointer or field that is null, rather than a freed one, so the exact line would settle a lot.
Author
Owner

@⁠aef200 on GitHub · 2026-11-25 22:44 UTC · original

Answering your three questions, and one of them narrows it: reclaiming was active before the fault.

2. The log lines. Both appear, twice, before the fault, at 22:41:45 and 22:42:14:

victory_gpu::descriptor::pages: view heap pages unused lately taken back: they read null until placed again
  pages=131 total=131 free=...
victory_gpu::descriptor::pages: view heap pages unused lately taken back: they read null until placed again
  pages=134 total=265 free=...

"No placed again" line appears separately - the only match for that phrase is inside the same message. So pages were taken back (131, then 134 of 265), and the fault came after.

3. Line numbers. From the PDB of the same build (61bfc77 + a12b972), offsets 0x22c1d3, 0x238cee, 0x28f2c9, 0x28745c:

#0  0x0022c1d3  std::sync::once::impl$2::call_once::closure$0<victory_gpu::resource::gpu_address::closure_env$0>
                once.rs:166
#1  0x00238cee  victory_gpu::resource::create_heap
                crates/victory-gpu/src/resource.rs:715
#2  0x0028f2c9  victory_gpu::draw::readable
                crates/victory-gpu/src/draw.rs:1843
#3  0x0028745c  victory_gpu::draw::State::bind
                crates/victory-gpu/src/draw.rs:681

So #2 is the (View::Shader(resource, _), ResourceType::Srv) arm, the one that calls alias_source(*resource as This) at 1846, and #3 is self.tables(list, &t.used, compute).

One thing that may matter: I could not reproduce your expectation that closure$1 is one of the three closures in alias_source. In this build it resolves to the closure inside gpu_address's diagnostic call_once (once.rs:166), and the frame above it is create_heap. I also added a placed.is_null() guard at the top of alias_source and a !r.is_null() filter in its find, rebuilt, and it still faults at the same victory.exe+0x22c1d3, read 0x30. So the null being dereferenced is probably not r in that closure.

If 0x30 is a field offset in Resource, the candidates are a null resource pointer reaching gpu_address (its resource(this) then r.data()/r.backing) or a null *resource in the View::Shader arm feeding alias_source.

1. Paging without reclaiming. I have not run 6fbfa4b yet; I can build it and run it tonight, and report whether it faults. Say the word and I will also run it with any logging you want around page placement.

**@⁠aef200** on GitHub · 2026-11-25 22:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7176737594) Answering your three questions, and one of them narrows it: **reclaiming was active before the fault.** **2. The log lines.** Both appear, twice, before the fault, at 22:41:45 and 22:42:14: ``` victory_gpu::descriptor::pages: view heap pages unused lately taken back: they read null until placed again pages=131 total=131 free=... victory_gpu::descriptor::pages: view heap pages unused lately taken back: they read null until placed again pages=134 total=265 free=... ``` "No placed again" line appears separately - the only match for that phrase is inside the same message. So pages were taken back (`131`, then `134` of `265`), and the fault came after. **3. Line numbers.** From the PDB of the same build (61bfc77 + a12b972), offsets 0x22c1d3, 0x238cee, 0x28f2c9, 0x28745c: ``` #0 0x0022c1d3 std::sync::once::impl$2::call_once::closure$0<victory_gpu::resource::gpu_address::closure_env$0> once.rs:166 #1 0x00238cee victory_gpu::resource::create_heap crates/victory-gpu/src/resource.rs:715 #2 0x0028f2c9 victory_gpu::draw::readable crates/victory-gpu/src/draw.rs:1843 #3 0x0028745c victory_gpu::draw::State::bind crates/victory-gpu/src/draw.rs:681 ``` So `#2` is the `(View::Shader(resource, _), ResourceType::Srv)` arm, the one that calls `alias_source(*resource as This)` at 1846, and `#3` is `self.tables(list, &t.used, compute)`. **One thing that may matter:** I could not reproduce your expectation that `closure$1` is one of the three closures in `alias_source`. In this build it resolves to the closure inside `gpu_address`'s diagnostic `call_once` (`once.rs:166`), and the frame above it is `create_heap`. I also added a `placed.is_null()` guard at the top of `alias_source` and a `!r.is_null()` filter in its `find`, rebuilt, and it still faults at the same `victory.exe+0x22c1d3`, read `0x30`. So the null being dereferenced is probably not `r` in that closure. If `0x30` is a field offset in `Resource`, the candidates are a null resource pointer reaching `gpu_address` (its `resource(this)` then `r.data()`/`r.backing`) or a null `*resource` in the `View::Shader` arm feeding `alias_source`. **1. Paging without reclaiming.** I have not run `6fbfa4b` yet; I can build it and run it tonight, and report whether it faults. Say the word and I will also run it with any logging you want around page placement.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 23:06 UTC · original

@⁠aef200 thanks. The take-back lines (131, then 134 of 265) before the fault are the key fact: reclaiming is involved, or at least running.

The symbols look folded. gpu_address's diagnostic call_once closure and a closure in alias_source can compile to the same machine code, and the linker's identical-code folding then gives them one address. The PDB names one of them, and create_heap:715 as a caller of a draw-time path doesn't fit either. A build with RUSTFLAGS="-C link-arg=/OPT:NOICF", or the dev profile with optimisation on, would give frames you can trust. If the faulting frame then really is in alias_source or readable, note that View::Shader can legitimately hold a null resource (a null SRV). host_resource checks for that and alias_source doesn't, but your null guard should have covered it, so I don't think that's the whole story.

Yes please to 6fbfa4b tonight. Paging without reclaiming, same save and run, is the cleanest split. If that's clean, could you also run a12b972 with RUST_LOG=victory_gpu::descriptor=debug? The last lines before the fault would show whether a page that was taken back is placed again in the same submission that faults.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 23:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7177162656) @⁠aef200 thanks. The take-back lines (131, then 134 of 265) before the fault are the key fact: reclaiming is involved, or at least running. The symbols look folded. `gpu_address`'s diagnostic `call_once` closure and a closure in `alias_source` can compile to the same machine code, and the linker's identical-code folding then gives them one address. The PDB names one of them, and `create_heap:715` as a caller of a draw-time path doesn't fit either. A build with `RUSTFLAGS="-C link-arg=/OPT:NOICF"`, or the `dev` profile with optimisation on, would give frames you can trust. If the faulting frame then really is in `alias_source` or `readable`, note that `View::Shader` can legitimately hold a null resource (a null SRV). `host_resource` checks for that and `alias_source` doesn't, but your null guard should have covered it, so I don't think that's the whole story. Yes please to `6fbfa4b` tonight. Paging without reclaiming, same save and run, is the cleanest split. If that's clean, could you also run `a12b972` with `RUST_LOG=victory_gpu::descriptor=debug`? The last lines before the fault would show whether a page that was taken back is placed again in the same submission that faults.
Author
Owner

@⁠aef200 on GitHub · 2026-11-25 23:39 UTC · original

Short status on the 6fbfa4b run you asked for, so you are not waiting on it: I cannot get a clean run of it on this card.

Two attempts, same result: the process ends about 15 s after start with 0x887A0005 (device removed), before any draw happens - the display driver is reset while the first pipelines are made. The second attempt was after victory translate --cache --pipelines on that same build (a 4.3 GB cache), and it lasted no longer. So on an RTX 4060 Ti 8 GB that tree cannot reach the world at all, and the crash I would be comparing against never gets a chance to happen.

What I can do instead, when I next have the machine:

  1. Rebuild a12b972 with RUSTFLAGS="-C link-arg=/OPT:NOICF" as you suggested, so the frames are not folded, and re-report #0-#2 with real names. That also tells us whether the faulting frame really is in alias_source, since you are right that create_heap:715 does not fit a draw-time path.
  2. Run a12b972 with RUST_LOG=victory_gpu::descriptor=debug and send the last lines before the fault, to see whether a page taken back is placed again in the same submission.

One thing worth knowing for anyone else on a small card: on this machine, 6fbfa4b and a12b972 differ in whether the run survives startup at all, which may say more about VRAM than about paging - a12b972 reaches the world (and faults later, at 0x22c1d3), while 6fbfa4b never does.

**@⁠aef200** on GitHub · 2026-11-25 23:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7177871592) Short status on the `6fbfa4b` run you asked for, so you are not waiting on it: **I cannot get a clean run of it on this card.** Two attempts, same result: the process ends about 15 s after start with `0x887A0005` (device removed), before any draw happens - the display driver is reset while the first pipelines are made. The second attempt was after `victory translate --cache --pipelines` on that same build (a 4.3 GB cache), and it lasted no longer. So on an RTX 4060 Ti 8 GB that tree cannot reach the world at all, and the crash I would be comparing against never gets a chance to happen. What I can do instead, when I next have the machine: 1. Rebuild `a12b972` with `RUSTFLAGS="-C link-arg=/OPT:NOICF"` as you suggested, so the frames are not folded, and re-report #0-#2 with real names. That also tells us whether the faulting frame really is in `alias_source`, since you are right that `create_heap:715` does not fit a draw-time path. 2. Run `a12b972` with `RUST_LOG=victory_gpu::descriptor=debug` and send the last lines before the fault, to see whether a page taken back is placed again in the same submission. One thing worth knowing for anyone else on a small card: on this machine, `6fbfa4b` and `a12b972` differ in whether the run survives startup at all, which may say more about VRAM than about paging - `a12b972` reaches the world (and faults later, at `0x22c1d3`), while `6fbfa4b` never does.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 23:41 UTC · original

@⁠aef200 thanks for trying it, and for the clear status. Yes to both:

  1. Unfolded frames: /OPT:NOICF to get real frame names.
  2. Descriptor logging: RUST_LOG=victory_gpu::descriptor=debug for the last lines before the fault.

One change: the PR is now rebased onto current main (head 1503227, on 842b0cb; same seven commits, CI green), so please use that rather than a12b972. It also picks up the fixes on main since 61bfc77.

The startup device removal on 6fbfa4b is worth knowing in its own right. It happens while pipelines are made, before any draw, and the two heads translate the same programs except for the page read marks. So it may be VRAM pressure on an 8 GB card rather than paging. If you get a minute, a run of 6fbfa4b with VICTORY_D3D12_DRED=1 would show where it stops.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 23:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7177916971) @⁠aef200 thanks for trying it, and for the clear status. Yes to both: 1. **Unfolded frames:** `/OPT:NOICF` to get real frame names. 2. **Descriptor logging:** `RUST_LOG=victory_gpu::descriptor=debug` for the last lines before the fault. One change: the PR is now rebased onto current `main` (head `1503227`, on `842b0cb`; same seven commits, CI green), so please use that rather than `a12b972`. It also picks up the fixes on `main` since `61bfc77`. The startup device removal on `6fbfa4b` is worth knowing in its own right. It happens while pipelines are made, before any draw, and the two heads translate the same programs except for the page read marks. So it may be VRAM pressure on an 8 GB card rather than paging. If you get a minute, a run of `6fbfa4b` with `VICTORY_D3D12_DRED=1` would show where it stops.
Author
Owner

@⁠aef200 on GitHub · 2026-11-25 23:51 UTC · original

Started on it, with a timing caveat so you know when to look.

1503227 (your rebased head on 842b0cb) is built here with RUSTFLAGS="-C link-arg=/OPT:NOICF", release + diagnostics, and the frame symbols now resolve without the folding - I will report #0-#3 with real names once a run faults.

The delay is the prewarm: this tree's translate --cache --pipelines is a full pass over the pack (27,145 pipelines) and runs at about 7 a second on this machine, so it is roughly an hour. --used-pipelines would be the shortcut, but it is rejected together with --cache --pipelines, so there is no way to warm only what earlier runs drew with from the CLI as far as I can see.

If waiting is not worth it, I can skip the remaining warm and run cold - on a12b972 a cold run still reached the world before faulting, so the descriptor log may come out the same. Your call: I can run it cold in a few minutes, or wait for the warm and have a clean run. Either way the 6fbfa4b run with VICTORY_D3D12_DRED=1 is queued after it.

**@⁠aef200** on GitHub · 2026-11-25 23:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7178137012) Started on it, with a timing caveat so you know when to look. `1503227` (your rebased head on `842b0cb`) is built here with `RUSTFLAGS="-C link-arg=/OPT:NOICF"`, release + diagnostics, and the frame symbols now resolve without the folding - I will report #0-#3 with real names once a run faults. The delay is the prewarm: this tree's `translate --cache --pipelines` is a full pass over the pack (27,145 pipelines) and runs at about 7 a second on this machine, so it is roughly an hour. `--used-pipelines` would be the shortcut, but it is rejected together with `--cache --pipelines`, so there is no way to warm only what earlier runs drew with from the CLI as far as I can see. If waiting is not worth it, I can skip the remaining warm and run cold - on `a12b972` a cold run still reached the world before faulting, so the descriptor log may come out the same. Your call: I can run it cold in a few minutes, or wait for the warm and have a clean run. Either way the `6fbfa4b` run with `VICTORY_D3D12_DRED=1` is queued after it.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 23:53 UTC · original

@⁠aef200 a cold run is fine, no need to wait an hour for the warm.

A likely explanation turned up: upstream fixed this exact path while we were looking. 219878a0, "GPU: a null shader view has no alias source", is on main and in 1503227, but not in 61bfc77, the base of your earlier runs. A View::Shader with a null resource (a null SRV in a draw's table) reached alias_source and was dereferenced there. That matches the fault in readable's View::Shader arm. Reclaiming plausibly made it likelier, because a page that's taken back and then read again goes through the table path more often.

So the most useful result is simply whether 1503227 faults at all in the same run. If it doesn't, I'll count that as this. If it still does, the unfolded frames and the descriptor log will show where.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 23:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7178174729) @⁠aef200 a cold run is fine, no need to wait an hour for the warm. A likely explanation turned up: upstream fixed this exact path while we were looking. 219878a0, "GPU: a null shader view has no alias source", is on `main` and in `1503227`, but not in `61bfc77`, the base of your earlier runs. A `View::Shader` with a null resource (a null SRV in a draw's table) reached `alias_source` and was dereferenced there. That matches the fault in `readable`'s `View::Shader` arm. Reclaiming plausibly made it likelier, because a page that's taken back and then read again goes through the table path more often. So the most useful result is simply whether `1503227` faults at all in the same run. If it doesn't, I'll count that as this. If it still does, the unfolded frames and the descriptor log will show where.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 00:06 UTC · original

Thanks for the re-check. New head 07a132db (rebased onto 63bcca4, whose only change is README.md, plus one new commit).

Edge case in HostHeap::new: fixed in 07a132db. The paged path now caps the title's count, the same way the unpaged path caps at the host's limit (cap plus warning, title slots past it left out):

  • PAGED_TITLE_VIEWS = NULL_BUFFER_VIEW - 1 - DYNAMIC (1,835,005), descriptor/host.rs:150. A larger count is capped at host.rs:178, with the warning paged view heap capped at 1835005 title slots, before anything is sized from it. So the dynamic slots end below the null buffer views (HEAP_VIEWS - 2 and the slot below it), and both still get made. Title slots past the cap get no mirror ("title slot past the host heap", mirror). The title's 1,245,184 slots are well below the cap.
  • What it was: the dynamic pages loop (host.rs:295) wrote placed[page] and the page table for pages up to (count + DYNAMIC).div_ceil(PAGE). With count + DYNAMIC > HEAP_VIEWS that is a Vec index panic, and a write past the 8,192 page-table dwords. Also, with count > HEAP_VIEWS the stride table (count * 4 bytes, host.rs:195) would have run into the page table, which sits at HEAP_VIEWS * 4. With the cap, count <= HEAP_VIEWS, so neither can happen.
  • Sizes: the page table, Placed::host (host.rs:293) and Placed::written/lost/used (pages.rs:143-162) are all sized by virtual pages (HEAP_VIEWS / PAGE). Pages::slot/place/read/stamp look pages up with .get(), and the stride and mark tables keep at least HEAP_VIEWS entries.
  • Test: host::tests::a_paged_heap_of_every_slot_shaders_index_is_capped (host.rs:2608). On a paged host, a title heap of HEAP_VIEWS slots is capped at PAGED_TITLE_VIEWS. The first title/dynamic page, the last dynamic slot and both null buffer views have their pages in the page table, within its 8,192 entries. Every dynamic slot can be taken, and a title slot past the cap has no mirror. Without the cap the test panics in HostHeap::new ("the len is 8192 but the index is 8192").
  • cargo test -p victory-gpu --lib: 240 passed, 0 failed, 1 ignored, with and without VICTORY_VIEW_PAGES=1 (RTX, pages automatically). Clippy with and without --features diagnostics: 0 warnings. cargo xtask policy ok.

The crash report (aef200): upstream 219878a0, "GPU: a null shader view has no alias source", is in this branch's base (842b0cb, and now 63bcca4) but not in 61bfc77, which aef200's runs were based on. I read it. alias_source now returns None for a null placed before it reads the resource through it (resource.rs:1795). That covers the path in readable's (View::Shader(resource, _), ResourceType::Srv) arm (draw.rs:1918-1921), which hands a null view's resource straight to alias_source. host_resource, called later in the same arm, already returned None for null. One caveat: aef200 wrote that a local placed.is_null() guard in alias_source still faulted at the same offset, on a build with folded symbols. So it isn't settled that 219878a0 was this fault. aef200 is running 1503227 with /OPT:NOICF and RUST_LOG=victory_gpu::descriptor=debug. 07a132db differs from it only by the README rebase and the cap, which doesn't apply to a 1,245,184-slot heap, so that run holds for this head. Waiting on that run.

The clash with #2821: acknowledged on both PRs. Whichever lands second gets the fix: take_back_pages and remakes clear #2821's ready marks for the slots of a page taken back or remade.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 00:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7178401358) Thanks for the re-check. New head `07a132db` (rebased onto `63bcca4`, whose only change is `README.md`, plus one new commit). **Edge case in `HostHeap::new`:** fixed in `07a132db`. The paged path now caps the title's count, the same way the unpaged path caps at the host's limit (cap plus warning, title slots past it left out): - `PAGED_TITLE_VIEWS = NULL_BUFFER_VIEW - 1 - DYNAMIC` (1,835,005), `descriptor/host.rs:150`. A larger count is capped at `host.rs:178`, with the warning `paged view heap capped at 1835005 title slots`, before anything is sized from it. So the dynamic slots end below the null buffer views (`HEAP_VIEWS - 2` and the slot below it), and both still get made. Title slots past the cap get no mirror ("title slot past the host heap", `mirror`). The title's 1,245,184 slots are well below the cap. - What it was: the dynamic pages loop (`host.rs:295`) wrote `placed[page]` and the page table for pages up to `(count + DYNAMIC).div_ceil(PAGE)`. With `count + DYNAMIC > HEAP_VIEWS` that is a Vec index panic, and a write past the 8,192 page-table dwords. Also, with `count > HEAP_VIEWS` the stride table (`count * 4` bytes, `host.rs:195`) would have run into the page table, which sits at `HEAP_VIEWS * 4`. With the cap, `count <= HEAP_VIEWS`, so neither can happen. - Sizes: the page table, `Placed::host` (`host.rs:293`) and `Placed::written`/`lost`/`used` (`pages.rs:143-162`) are all sized by virtual pages (`HEAP_VIEWS / PAGE`). `Pages::slot`/`place`/`read`/`stamp` look pages up with `.get()`, and the stride and mark tables keep at least `HEAP_VIEWS` entries. - Test: `host::tests::a_paged_heap_of_every_slot_shaders_index_is_capped` (`host.rs:2608`). On a paged host, a title heap of `HEAP_VIEWS` slots is capped at `PAGED_TITLE_VIEWS`. The first title/dynamic page, the last dynamic slot and both null buffer views have their pages in the page table, within its 8,192 entries. Every dynamic slot can be taken, and a title slot past the cap has no mirror. Without the cap the test panics in `HostHeap::new` ("the len is 8192 but the index is 8192"). - `cargo test -p victory-gpu --lib`: 240 passed, 0 failed, 1 ignored, with and without `VICTORY_VIEW_PAGES=1` (RTX, pages automatically). Clippy with and without `--features diagnostics`: 0 warnings. `cargo xtask policy` ok. **The crash report (aef200):** upstream 219878a0, "GPU: a null shader view has no alias source", is in this branch's base (`842b0cb`, and now `63bcca4`) but not in `61bfc77`, which aef200's runs were based on. I read it. `alias_source` now returns None for a null `placed` before it reads the resource through it (`resource.rs:1795`). That covers the path in `readable`'s `(View::Shader(resource, _), ResourceType::Srv)` arm (`draw.rs:1918-1921`), which hands a null view's resource straight to `alias_source`. `host_resource`, called later in the same arm, already returned None for null. One caveat: aef200 wrote that a local `placed.is_null()` guard in `alias_source` still faulted at the same offset, on a build with folded symbols. So it isn't settled that 219878a0 was this fault. aef200 is running `1503227` with `/OPT:NOICF` and `RUST_LOG=victory_gpu::descriptor=debug`. `07a132db` differs from it only by the README rebase and the cap, which doesn't apply to a 1,245,184-slot heap, so that run holds for this head. Waiting on that run. **The clash with #2821:** acknowledged on both PRs. Whichever lands second gets the fix: `take_back_pages` and `remakes` clear #2821's `ready` marks for the slots of a page taken back or remade.
Author
Owner

@⁠aef200 on GitHub · 2026-11-26 00:06 UTC · original

1503227 does not fault. That answers your question, and I think it closes it.

Cold run (no warm - the prewarm was still going, so I stopped it as you said to), RUSTFLAGS="-C link-arg=/OPT:NOICF", release + diagnostics, RUST_LOG=victory_gpu::descriptor=debug, Series X, same save, same launcher as the runs that faulted:

  • 10.4 minutes in the world, still running as I write this.
  • 0 first-chance exception, 0 device removed in the log.
  • Compare with 61bfc77 + a12b972, which faulted at +0x22c1d3 in under a minute, twice, at the same address.

So the 219878a0 reading looks right: a View::Shader with a null resource reached alias_source and was dereferenced in readable's View::Shader arm, and the 61bfc77 base simply did not have that guard. Reclaiming is a plausible amplifier rather than the cause, exactly as you suggested.

Two caveats on the run, so you do not over-read it: the picture is not usable here (this card renders the world laggy and largely without draw - it is an 8 GB card on a tree tuned for bigger ones), and I did not reach the scenes that previously faulted with a warm cache, so "does not fault" is over these 10 minutes rather than proven for every path.

If it does fault later in this same session I will send the unfolded frames and the descriptor log; otherwise I consider #2121 clear of the crash we reported.

**@⁠aef200** on GitHub · 2026-11-26 00:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7178409565) **`1503227` does not fault.** That answers your question, and I think it closes it. Cold run (no warm - the prewarm was still going, so I stopped it as you said to), `RUSTFLAGS="-C link-arg=/OPT:NOICF"`, release + diagnostics, `RUST_LOG=victory_gpu::descriptor=debug`, Series X, same save, same launcher as the runs that faulted: - **10.4 minutes in the world, still running as I write this.** - **0 `first-chance exception`, 0 `device removed`** in the log. - Compare with `61bfc77 + a12b972`, which faulted at `+0x22c1d3` in under a minute, twice, at the same address. So the `219878a0` reading looks right: a `View::Shader` with a null resource reached `alias_source` and was dereferenced in `readable`'s `View::Shader` arm, and the `61bfc77` base simply did not have that guard. Reclaiming is a plausible amplifier rather than the cause, exactly as you suggested. Two caveats on the run, so you do not over-read it: the picture is not usable here (this card renders the world laggy and largely without draw - it is an 8 GB card on a tree tuned for bigger ones), and I did not reach the scenes that previously faulted with a warm cache, so "does not fault" is over these 10 minutes rather than proven for every path. If it does fault later in this same session I will send the unfolded frames and the descriptor log; otherwise I consider #2121 clear of the crash we reported.
Author
Owner

@⁠latentdev on GitHub · 2026-11-26 00:07 UTC · original

1503227 in-world on an RTX 4090: pages are taken back, but the heap still fills

RTX 4090, driver 621.24, Windows 11, title 1.0.2.1, diag build, opening cutscene. Tree: main 63bcca4 + this PR at 1503227 (a12b972 rebased) + #2178 + #1630 + #1832 + #2332. The only conflict was the cache key in shader_cache.rs; I kept both settings. Since then, 07a132d has added only the count cap, which a 1,245,184-slot heap doesn't reach.

I ran it twice. In the first run every shader was translated again because the key changed. The second ran with them cached, and it moved through the scene at about the same pace as my earlier run of 40bd210 (no reclaiming, main 67e8ae1, cached). The numbers below are from the second run. Times count from the world's first frame.

view heap pages unused lately taken back:

in world pages total free in_use
0:40 125 125 244 2,636
0:48 138 263 239 2,641
1:28 52 542 136 2,744
2:10 123 1,144 244 2,636
3:54 13 2,051 13 2,867

Up to 2:10 the logged passes got back to about the 1/16 target, except at 1:28. At 3:54 the pass took back only 13 pages, and 13 were free.

view heap pages placed again passed 1,024 at 3:34 and 2,048 at 5:18.

Both no-room lines still appear:

  • no room left in the host view heap at 1:02 (written=576948 of=737280). On 40bd210 it came at 0:18.
  • view heap pages written with no room left reached pages=1024 written=192121 at 4:15. On 40bd210 it reached pages=1024 written=228606 at 2:10. Here it stayed at 64 pages from 1:17 to 2:49, then climbed again.

So reclaiming delays the overflow, by 44 s for the first refusal and about 2 minutes for 1,024 refused pages, but it doesn't prevent it. The first run went the same way: no room at 2:15, 4,111 taken back, and placed again past 2,048.

The placed again count is hard to use for the age-limit question. place_at counts every lost page, and slot also marks a page lost when it's refused room, so the count mixes wrong guesses with refused pages that later found room. Logging the two separately would show which one dominates.

Neither run logged title slot past the host heap or faulted in alias_source (this tree has 219878a). The second run ended 6:06 into the world with a device hang. The list stopped at a 1x1x1 dispatch of compute 37e19ccb4f889f63, its first command, 5 s after that program was first bound. That's the program from #71.

**@⁠latentdev** on GitHub · 2026-11-26 00:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7178412164) ### 1503227 in-world on an RTX 4090: pages are taken back, but the heap still fills RTX 4090, driver 621.24, Windows 11, title 1.0.2.1, diag build, opening cutscene. Tree: `main` 63bcca4 + this PR at 1503227 (a12b972 rebased) + #2178 + #1630 + #1832 + #2332. The only conflict was the cache key in `shader_cache.rs`; I kept both settings. Since then, 07a132d has added only the count cap, which a 1,245,184-slot heap doesn't reach. I ran it twice. In the first run every shader was translated again because the key changed. The second ran with them cached, and it moved through the scene at about the same pace as my earlier run of 40bd210 (no reclaiming, `main` 67e8ae1, cached). The numbers below are from the second run. Times count from the world's first frame. **`view heap pages unused lately taken back`:** | in world | pages | total | free | in_use | | --- | --- | --- | --- | --- | | 0:40 | 125 | 125 | 244 | 2,636 | | 0:48 | 138 | 263 | 239 | 2,641 | | 1:28 | 52 | 542 | 136 | 2,744 | | 2:10 | 123 | 1,144 | 244 | 2,636 | | 3:54 | 13 | 2,051 | 13 | 2,867 | Up to 2:10 the logged passes got back to about the 1/16 target, except at 1:28. At 3:54 the pass took back only 13 pages, and 13 were free. **`view heap pages placed again`** passed 1,024 at 3:34 and 2,048 at 5:18. **Both no-room lines still appear:** - `no room left in the host view heap` at 1:02 (`written=576948 of=737280`). On 40bd210 it came at 0:18. - `view heap pages written with no room left` reached `pages=1024 written=192121` at 4:15. On 40bd210 it reached `pages=1024 written=228606` at 2:10. Here it stayed at 64 pages from 1:17 to 2:49, then climbed again. So reclaiming delays the overflow, by 44 s for the first refusal and about 2 minutes for 1,024 refused pages, but it doesn't prevent it. The first run went the same way: no room at 2:15, 4,111 taken back, and `placed again` past 2,048. The `placed again` count is hard to use for the age-limit question. `place_at` counts every `lost` page, and `slot` also marks a page lost when it's refused room, so the count mixes wrong guesses with refused pages that later found room. Logging the two separately would show which one dominates. Neither run logged `title slot past the host heap` or faulted in `alias_source` (this tree has 219878a). The second run ended 6:06 into the world with a device hang. The list stopped at a 1x1x1 dispatch of compute `37e19ccb4f889f63`, its first command, 5 s after that program was first bound. That's the program from #71.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 00:07 UTC · original

@⁠aef200 thank you, that settles it. More than 10 minutes on 1503227 with no fault, against two faults at the same address in under a minute on 61bfc77 + a12b972, fits 219878a0 (a null View::Shader reaching alias_source). I'll treat the crash as fixed upstream, with reclaiming as an amplifier, unless it turns up again later in your session.

@⁠latentdev thanks, that's the measurement I wanted. Reclaiming delays the overflow (first refusal at 1:02 instead of 0:18, and 1,024 refused pages at 4:15 instead of 2:10) but doesn't prevent it. By 3:54 a pass found only 13 pages old enough, so the set the title uses within the age window is close to the 2,880 title pages. You're right that placed again mixes two things: pages taken back and read again (wrong guesses), and pages that were refused room and later found it. I'll split that into two counts in the log, so the next run shows whether the age limits are too short or the live set really is bigger than the heap. If it's the latter, no page policy fixes it, and the remaining lever is the dynamic region's 1,024 fixed pages.

The device hang at the 1x1x1 dispatch of 37e19ccb4f889f63 (#71) looks unrelated to the heap: no title slot past the host heap lines, and no null reads there.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 00:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7178428648) @⁠aef200 thank you, that settles it. More than 10 minutes on `1503227` with no fault, against two faults at the same address in under a minute on `61bfc77 + a12b972`, fits 219878a0 (a null `View::Shader` reaching `alias_source`). I'll treat the crash as fixed upstream, with reclaiming as an amplifier, unless it turns up again later in your session. @⁠latentdev thanks, that's the measurement I wanted. Reclaiming delays the overflow (first refusal at 1:02 instead of 0:18, and 1,024 refused pages at 4:15 instead of 2:10) but doesn't prevent it. By 3:54 a pass found only 13 pages old enough, so the set the title uses within the age window is close to the 2,880 title pages. You're right that `placed again` mixes two things: pages taken back and read again (wrong guesses), and pages that were refused room and later found it. I'll split that into two counts in the log, so the next run shows whether the age limits are too short or the live set really is bigger than the heap. If it's the latter, no page policy fixes it, and the remaining lever is the dynamic region's 1,024 fixed pages. The device hang at the 1x1x1 dispatch of `37e19ccb4f889f63` (#71) looks unrelated to the heap: no `title slot past the host heap` lines, and no null reads there.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 00:10 UTC · original

@⁠latentdev done in 6f8b5887. The line keeps its message and its pages= total, and now splits the total:

view heap pages placed again: their slots are made from the title's records pages=<total> taken_back=<n> refused=<n> in_use=<n>

  • taken_back: pages reclaiming took back that were then read, written or drawn through again (wrong guesses).
  • refused: pages written when no host page was free, which found room later.

A page taken back and then refused room counts as taken_back. It's logged when either count reaches a power of two. If taken_back dominates, the age limits are too short; if refused does, the live set is bigger than the heap.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 00:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7178481668) @⁠latentdev done in 6f8b5887. The line keeps its message and its `pages=` total, and now splits the total: `view heap pages placed again: their slots are made from the title's records pages=<total> taken_back=<n> refused=<n> in_use=<n>` - `taken_back`: pages reclaiming took back that were then read, written or drawn through again (wrong guesses). - `refused`: pages written when no host page was free, which found room later. A page taken back and then refused room counts as `taken_back`. It's logged when either count reaches a power of two. If `taken_back` dominates, the age limits are too short; if `refused` does, the live set is bigger than the heap.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-26 00:17 UTC · original

The two placement counters on 6f8b5887 distinguished the two cases in a three-step GPU readback on an RTX 4090 Laptop (621.14). A, then B, then A again occupied physical page 1027, offset 7, slot 262919. The shader returned the page and slot alongside the color.

Page requested First demand Following submission (A / B / control) Production placement log
B, initially refused because the heap was full Transparent black Transparent black / green / blue pages=1 taken_back=0 refused=1
A, formerly resident and taken back to make room for B Transparent black Red / transparent black / blue pages=2 taken_back=1 refused=1

The separate total of pages evicted rose from 1 to 2. Before either handoff, the old gated list completed at fence 302 and still read red / transparent black / blue. B used a G/B-swapped view of the blue control texture.

I first checked the A-to-B transfer at the legal limit added in 07a132db, then ran this round trip on 6f8b5887 at both 1,048,576 and 1,835,005 title slots. The control stayed blue at physical slot 519 in the first layout (2,880 allocatable pages) and slot 772 in the second (2,879). This synthetic workload deliberately produced one event of each kind. The in-game ratio and the interaction with #2821 remain open.

Reproducer and PowerShell command · Tested source.

**@⁠passerbyyhx** on GitHub · 2026-11-26 00:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7178605687) The two placement counters on `6f8b5887` distinguished the two cases in a three-step GPU readback on an RTX 4090 Laptop (621.14). A, then B, then A again occupied **physical page 1027, offset 7, slot 262919**. The shader returned the page and slot alongside the color. | Page requested | First demand | Following submission (A / B / control) | Production placement log | | --- | --- | --- | --- | | B, initially refused because the heap was full | Transparent black | Transparent black / green / blue | `pages=1 taken_back=0 refused=1` | | A, formerly resident and taken back to make room for B | Transparent black | Red / transparent black / blue | `pages=2 taken_back=1 refused=1` | The separate total of pages evicted rose from 1 to 2. Before either handoff, the old gated list completed at fence 302 and still read red / transparent black / blue. B used a G/B-swapped view of the blue control texture. I first checked the A-to-B transfer at the legal limit added in `07a132db`, then ran this round trip on `6f8b5887` at both 1,048,576 and 1,835,005 title slots. The control stayed blue at physical slot 519 in the first layout (2,880 allocatable pages) and slot 772 in the second (2,879). This synthetic workload deliberately produced one event of each kind. The in-game ratio and the interaction with #2821 remain open. [Reproducer and PowerShell command](https://github.com/0xkn0wh3r3/VIctory/pull/1) · [Tested source](https://github.com/passerbyyhx/VIctory/commit/95b7d19d12d3b46ac9bb2886fe444a70a118d203).
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 00:19 UTC · original

@⁠passerbyyhx thanks, that's a clean check of both counts. A page refused room shows up as refused=1. A page taken back and then demanded again shows up as taken_back=1, on the same physical page each time, with the old list still reading what it was recorded against. It's also useful to have it at the new cap (1,835,005 title slots, 2,879 allocatable pages) as well as below it. The in-game ratio is what the next title run should show.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 00:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7178638502) @⁠passerbyyhx thanks, that's a clean check of both counts. A page refused room shows up as `refused=1`. A page taken back and then demanded again shows up as `taken_back=1`, on the same physical page each time, with the old list still reading what it was recorded against. It's also useful to have it at the new cap (1,835,005 title slots, 2,879 allocatable pages) as well as below it. The in-game ratio is what the next title run should show.
Author
Owner

@⁠DenRakEiw on GitHub · 2026-11-25 05:36 UTC · original · approved these changes

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).

**@⁠DenRakEiw** on GitHub · 2026-11-25 05:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#pullrequestreview-6052374133) · **approved these changes** 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).
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 05:49 UTC · original · reviewed

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.

**@⁠catminou4** on GitHub · 2026-11-25 05:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#pullrequestreview-6052484182) · **reviewed** 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.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-26 03:30 UTC · original · edited 2026-11-26 03:38 UTC

I checked the two ready-mark invalidations you described for #2821 using an RTX 4090 Laptop (621.14) and two generated textures. This is an independent combination of #2121 at 6f8b5887 and #2821 at cfbb10a4, with turn_pages taking the registry write lock. The GPU reported physical page 1027, offset 7 (slot 262919) for A → B → A in all four runs.

Change on the combined branch B after taking the slot A after getting it back
Baseline Transparent black Transparent black
Clear ready only in take_back_pages Transparent black Red
Clear ready only in remakes Green Red
Clear it in both places Green Red

B uses a green/blue-swapped view of the blue control texture. The control stayed blue, and the old submission read red for A after the gated fence advanced from 301 to 302. Clearing on remake covered both a previously refused page (B) and a previously evicted page (A). With both clears the full round trip passed at 1,048,576 and 1,835,005 title slots.

Combined baseline and fixture · Tested integration change

To reproduce on the integration branch, set VICTORY_VIEW_PAGES=1 and run cargo test --locked -p victory-gpu --lib --features diagnostics expect_reuse_ -- --ignored --nocapture --test-threads=1.

I also ran the same test directly on your integrated demo at fe85e996 with its production code unchanged. At both 1,048,576 and 1,835,005 title slots, the old submission read A as red when the gated fence advanced from 301 to 302. B then read green at physical slot 262919, and A read red after getting that same slot back. The control stayed blue throughout.

**@⁠passerbyyhx** on GitHub · 2026-11-26 03:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7181784995) · edited 2026-11-26 03:38 UTC I checked the two ready-mark invalidations you described for #2821 using an RTX 4090 Laptop (621.14) and two generated textures. This is an independent combination of #2121 at `6f8b5887` and #2821 at `cfbb10a4`, with `turn_pages` taking the registry write lock. The GPU reported physical page 1027, offset 7 (slot 262919) for A → B → A in all four runs. | Change on the combined branch | B after taking the slot | A after getting it back | | --- | --- | --- | | Baseline | Transparent black | Transparent black | | Clear `ready` only in `take_back_pages` | Transparent black | Red | | Clear `ready` only in `remakes` | Green | Red | | Clear it in both places | Green | Red | B uses a green/blue-swapped view of the blue control texture. The control stayed blue, and the old submission read red for A after the gated fence advanced from 301 to 302. Clearing on remake covered both a previously refused page (B) and a previously evicted page (A). With both clears the full round trip passed at 1,048,576 and 1,835,005 title slots. [Combined baseline and fixture](https://github.com/passerbyyhx/VIctory/commit/7c162b74179a11205acb257ab3dfbdd1ee868f25) · [Tested integration change](https://github.com/passerbyyhx/VIctory/commit/89ef13b341f0b46abf06257a76d8c985bffec763) To reproduce on the integration branch, set `VICTORY_VIEW_PAGES=1` and run `cargo test --locked -p victory-gpu --lib --features diagnostics expect_reuse_ -- --ignored --nocapture --test-threads=1`. I also ran the [same test](https://github.com/passerbyyhx/VIctory/commit/badb3a743010bcc291c0cfb3159ff831836dabe4) directly on [your integrated demo at `fe85e996`](https://github.com/0xkn0wh3r3/VIctory/commit/fe85e996002fc4a88a3d8d817cd2b9da27d68b88) with its production code unchanged. At both 1,048,576 and 1,835,005 title slots, the old submission read A as red when the gated fence advanced from 301 to 302. B then read green at physical slot 262919, and A read red after getting that same slot back. The control stayed blue throughout.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 03:33 UTC · original

@⁠passerbyyhx thanks, that settles the #2821 fix on hardware. Clearing ready on remake alone already covers both cases, B (refused, then placed) and A (taken back, then placed again), and the clear in take_back_pages isn't enough on its own. I'll apply both clears in whichever of #2121 and #2821 lands second: the remake clear is the one that matters, and the take-back clear keeps a stale mark from surviving in between. Good to have the round trip at both 1,048,576 and 1,835,005 title slots.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 03:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7181817663) @⁠passerbyyhx thanks, that settles the #2821 fix on hardware. Clearing `ready` on remake alone already covers both cases, B (refused, then placed) and A (taken back, then placed again), and the clear in `take_back_pages` isn't enough on its own. I'll apply both clears in whichever of #2121 and #2821 lands second: the remake clear is the one that matters, and the take-back clear keeps a stale mark from surviving in between. Good to have the round trip at both 1,048,576 and 1,835,005 title slots.
Author
Owner

@⁠kawaii-shakal on GitHub · 2026-11-26 03:52 UTC · original · edited 2026-11-26 03:55 UTC

Measured on an RTX 5070 Ti (Windows 11, native D3D12): GTA VI in the world at 0.5–2 fps, about 20 submissions a frame, with this PR merged together with #2821.

  • About 2 minutes in, the log shows no room left in the host view heap: slots of further pages read null pages=3906 written=588695 of=737280. Meshes that read those slots render as dark silhouettes.
  • Pages are taken back only once they are older than both MIN_AGE_SUBMISSIONS (300) and MIN_AGE (10 s). At this frame rate that means about 15 frames, or roughly 30 s, without use. Every page the title writes counts as used, so by the time room runs out no page qualifies, and fresh descriptors read null for that whole stretch.

This change helped here. When a write has been refused for lack of a host page since the previous take-back, take_back also takes pages unused for 16 submissions, with no minimum time, up to the high-water mark as before. The stricter ages are still tried first. Over runs of similar length, the count of pages written with no room fell from ≥2048 to ≥512 (the log reports powers of two). It is not a full fix: the working set still overflows the 3,906 host pages at times.

diff (pages.rs, with a test)
@@ -34,6 +34,12 @@ const HIGH_WATER: u32 = 16;
 /// streams in over seconds, and a frame takes a few submissions.
 const MIN_AGE_SUBMISSIONS: u32 = 300;
 const MIN_AGE: Duration = Duration::from_secs(10);
+/// Once writes were refused for want of a host page (the slots they wrote
+/// read null), pages unused for this many submissions go too, with no
+/// minimum time: at a frame or two a second the stricter ages above leave
+/// nothing to take while the title's fresh descriptors read null for half
+/// a minute; a page taken too early costs one submission reading it null.
+const PRESSED_AGE_SUBMISSIONS: u32 = 16;
 
 /// A paged view heap's pages: the host page of each page of slots (0 for
 /// none: [`NULL_PAGE`]), entered in the page table shaders read, and when
@@ -92,6 +98,9 @@ struct Placed {
     /// Free host pages below which pages are taken back, and up to which.
     low: u32,
     high: u32,
+    /// `refused` when pages were last taken back: more since means room ran
+    /// out ([`PRESSED_AGE_SUBMISSIONS`]).
+    refused_seen: u32,
 }
 
 /// Why a page of slots lacks records the title has.
@@ -169,6 +178,7 @@ impl Pages {
                 ended: VecDeque::new(),
                 low: end / LOW_WATER,
                 high: (end / HIGH_WATER).min(free),
+                refused_seen: 0,
             }),
             end,
             table,
@@ -347,17 +357,30 @@ impl Pages {
             return Vec::new();
         }
         // A page stamped `s` was last used before submission `s + 1` ended.
-        let Some(&(old, _)) = p.ended.front().filter(|&&(_, ended)| ended + MIN_AGE <= at) else {
-            return Vec::new();
-        };
-        let before = old.min(now.saturating_sub(MIN_AGE_SUBMISSIONS));
-        let mut stale: Vec<(u32, u32)> = (0..p.title.min(p.host.len() as u32))
+        let strict = p
+            .ended
+            .front()
+            .filter(|&&(_, ended)| ended + MIN_AGE <= at)
+            .map(|&(old, _)| old.min(now.saturating_sub(MIN_AGE_SUBMISSIONS)));
+        // Writes refused since the last time: room ran out, so the age is
+        // relaxed (the stricter one first, where it finds enough).
+        let pressed = p.refused != p.refused_seen;
+        p.refused_seen = p.refused;
+        let want = p.high.saturating_sub(free) as usize;
+        let candidates: Vec<(u32, u32)> = (0..p.title.min(p.host.len() as u32))
             .filter(|&page| p.host[page as usize] >= p.first)
             .map(|page| (self.used[page as usize].load(Ordering::Relaxed), page))
-            .filter(|&(used, _)| used < before)
             .collect();
+        let older = |before: u32| candidates.iter().copied().filter(move |&(used, _)| used < before);
+        let mut stale: Vec<(u32, u32)> = strict.map_or_else(Vec::new, |b| older(b).collect());
+        if pressed && stale.len() < want {
+            stale = older(now.saturating_sub(PRESSED_AGE_SUBMISSIONS)).collect();
+        }
+        if stale.is_empty() {
+            return Vec::new();
+        }
         stale.sort_unstable();
-        stale.truncate(p.high.saturating_sub(free) as usize);
+        stale.truncate(want);
         stale
             .into_iter()
             .map(|(_, page)| {
@@ -545,6 +568,33 @@ mod tests {
         assert_eq!(pages.take_back(t), [(0, 2)]);
     }
 
+    /// Once a write was refused for want of a host page, pages unused for
+    /// `PRESSED_AGE_SUBMISSIONS` go, however short the time; without a
+    /// refusal they stay until both stricter ages pass.
+    #[test]
+    fn refused_writes_relax_the_age() {
+        let mut table = vec![0u32; PAGES];
+        // Host pages 2-4.
+        let pages = pages(&mut table, 5);
+        pages.set_water(1, 2);
+        let mut t = Instant::now();
+        for page in 0..3 {
+            pages.slot(at(page, 0), true);
+        }
+        // No host page left, nothing refused: none, however many submissions.
+        run(&pages, &mut t, PRESSED_AGE_SUBMISSIONS + 4, MS);
+        pages.slot(at(0, 1), true); // page 0 used again
+        run(&pages, &mut t, PRESSED_AGE_SUBMISSIONS - 1, MS);
+        // A write refused: pages 1 and 2 (unused long enough), oldest
+        // first; page 0 was used too lately.
+        assert_eq!(pages.slot(at(5, 0), true), None);
+        t += MS;
+        assert_eq!(pages.take_back(t), [(1, 3), (2, 4)]);
+        // Refused once only: the next submission takes none.
+        pages.slot(at(5, 0), false);
+        run(&pages, &mut t, 1, MS);
+    }
+
     /// Pages placed at once (the dynamic slots) and pages past the title's
     /// are never taken back, however old.
     #[test]

I can open this as a PR against this branch if that is easier.

🤖 Generated with Claude Code (Claude Opus 5.5)

**@⁠kawaii-shakal** on GitHub · 2026-11-26 03:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7182097237) · edited 2026-11-26 03:55 UTC Measured on an RTX 5070 Ti (Windows 11, native D3D12): GTA VI in the world at 0.5–2 fps, about 20 submissions a frame, with this PR merged together with #2821. - About 2 minutes in, the log shows `no room left in the host view heap: slots of further pages read null pages=3906 written=588695 of=737280`. Meshes that read those slots render as dark silhouettes. - Pages are taken back only once they are older than both `MIN_AGE_SUBMISSIONS` (300) and `MIN_AGE` (10 s). At this frame rate that means about 15 frames, or roughly 30 s, without use. Every page the title writes counts as used, so by the time room runs out no page qualifies, and fresh descriptors read null for that whole stretch. This change helped here. When a write has been refused for lack of a host page since the previous take-back, `take_back` also takes pages unused for 16 submissions, with no minimum time, up to the high-water mark as before. The stricter ages are still tried first. Over runs of similar length, the count of pages written with no room fell from ≥2048 to ≥512 (the log reports powers of two). It is not a full fix: the working set still overflows the 3,906 host pages at times. <details><summary>diff (pages.rs, with a test)</summary> ```diff @@ -34,6 +34,12 @@ const HIGH_WATER: u32 = 16; /// streams in over seconds, and a frame takes a few submissions. const MIN_AGE_SUBMISSIONS: u32 = 300; const MIN_AGE: Duration = Duration::from_secs(10); +/// Once writes were refused for want of a host page (the slots they wrote +/// read null), pages unused for this many submissions go too, with no +/// minimum time: at a frame or two a second the stricter ages above leave +/// nothing to take while the title's fresh descriptors read null for half +/// a minute; a page taken too early costs one submission reading it null. +const PRESSED_AGE_SUBMISSIONS: u32 = 16; /// A paged view heap's pages: the host page of each page of slots (0 for /// none: [`NULL_PAGE`]), entered in the page table shaders read, and when @@ -92,6 +98,9 @@ struct Placed { /// Free host pages below which pages are taken back, and up to which. low: u32, high: u32, + /// `refused` when pages were last taken back: more since means room ran + /// out ([`PRESSED_AGE_SUBMISSIONS`]). + refused_seen: u32, } /// Why a page of slots lacks records the title has. @@ -169,6 +178,7 @@ impl Pages { ended: VecDeque::new(), low: end / LOW_WATER, high: (end / HIGH_WATER).min(free), + refused_seen: 0, }), end, table, @@ -347,17 +357,30 @@ impl Pages { return Vec::new(); } // A page stamped `s` was last used before submission `s + 1` ended. - let Some(&(old, _)) = p.ended.front().filter(|&&(_, ended)| ended + MIN_AGE <= at) else { - return Vec::new(); - }; - let before = old.min(now.saturating_sub(MIN_AGE_SUBMISSIONS)); - let mut stale: Vec<(u32, u32)> = (0..p.title.min(p.host.len() as u32)) + let strict = p + .ended + .front() + .filter(|&&(_, ended)| ended + MIN_AGE <= at) + .map(|&(old, _)| old.min(now.saturating_sub(MIN_AGE_SUBMISSIONS))); + // Writes refused since the last time: room ran out, so the age is + // relaxed (the stricter one first, where it finds enough). + let pressed = p.refused != p.refused_seen; + p.refused_seen = p.refused; + let want = p.high.saturating_sub(free) as usize; + let candidates: Vec<(u32, u32)> = (0..p.title.min(p.host.len() as u32)) .filter(|&page| p.host[page as usize] >= p.first) .map(|page| (self.used[page as usize].load(Ordering::Relaxed), page)) - .filter(|&(used, _)| used < before) .collect(); + let older = |before: u32| candidates.iter().copied().filter(move |&(used, _)| used < before); + let mut stale: Vec<(u32, u32)> = strict.map_or_else(Vec::new, |b| older(b).collect()); + if pressed && stale.len() < want { + stale = older(now.saturating_sub(PRESSED_AGE_SUBMISSIONS)).collect(); + } + if stale.is_empty() { + return Vec::new(); + } stale.sort_unstable(); - stale.truncate(p.high.saturating_sub(free) as usize); + stale.truncate(want); stale .into_iter() .map(|(_, page)| { @@ -545,6 +568,33 @@ mod tests { assert_eq!(pages.take_back(t), [(0, 2)]); } + /// Once a write was refused for want of a host page, pages unused for + /// `PRESSED_AGE_SUBMISSIONS` go, however short the time; without a + /// refusal they stay until both stricter ages pass. + #[test] + fn refused_writes_relax_the_age() { + let mut table = vec![0u32; PAGES]; + // Host pages 2-4. + let pages = pages(&mut table, 5); + pages.set_water(1, 2); + let mut t = Instant::now(); + for page in 0..3 { + pages.slot(at(page, 0), true); + } + // No host page left, nothing refused: none, however many submissions. + run(&pages, &mut t, PRESSED_AGE_SUBMISSIONS + 4, MS); + pages.slot(at(0, 1), true); // page 0 used again + run(&pages, &mut t, PRESSED_AGE_SUBMISSIONS - 1, MS); + // A write refused: pages 1 and 2 (unused long enough), oldest + // first; page 0 was used too lately. + assert_eq!(pages.slot(at(5, 0), true), None); + t += MS; + assert_eq!(pages.take_back(t), [(1, 3), (2, 4)]); + // Refused once only: the next submission takes none. + pages.slot(at(5, 0), false); + run(&pages, &mut t, 1, MS); + } + /// Pages placed at once (the dynamic slots) and pages past the title's /// are never taken back, however old. #[test] ``` </details> I can open this as a PR against this branch if that is easier. 🤖 Generated with [Claude Code](https://claude.com/claude-code) (Claude Opus 5.5)
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 03:59 UTC · original

@⁠kawaii-shakal thanks for the run and the idea. You're right about the strict ages: at 0.5–2 fps nothing the title writes gets to 300 submissions and 10 s unused before room runs out, so the gap reads null. I've added a relaxed pass in 979e3a7 (my own implementation, credited in the commit), so there's no need for a separate PR.

What it does (descriptor/pages.rs):

  • A write that finds no host page sets a pressure flag. The next take_back pass clears it, whether that pass takes anything or not, so pressure lasts one pass.
  • In that pass, if room is short (below low water), pages unused for more than PRESSED_AGE_SUBMISSIONS submissions qualify too, with no time minimum, least recently used first, up to the high-water mark. Pages old by the strict ages are always older than that, so they still go first. With no refused write since the last pass, the strict path is unchanged.
  • The view heap pages unused lately taken back line now logs relaxed= (whether that pass took pages younger than the strict ages) and relaxed_total= (pages taken that way so far).

Where it differs from yours: I used 32 submissions, not 16. At about 20 submissions a frame, 16 can take back a page the previous frame read before this frame gets to it. That page then comes back the next time it's read, after one submission of null reads. 32 keeps anything read every frame. If your logs show 16 doing clearly better, it's a one-line change.

Tests: no refusal keeps young pages however full the heap is; after a refusal, pages unused for more than 32 submissions are taken oldest first while one used exactly 32 submissions ago and one used now stay; and the relaxed pass applies once. cargo test -p victory-gpu --lib passes with VICTORY_VIEW_PAGES=1. Without it, one test that also fails on main on this card fails here too. Clippy is clean with and without diagnostics.

Could you rerun on 979e3a7, with #2821 as before? The numbers that would help: when (if ever) no room left in the host view heap first shows up, the highest view heap pages written with no room left pages=, the relaxed_total= on the last take-back line, and the taken_back= against refused= on view heap pages placed again. A high taken_back there would mean the relaxed pass is guessing wrong. If you can, also run 16 against 32 on the same save.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 03:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7182197616) @⁠kawaii-shakal thanks for the run and the idea. You're right about the strict ages: at 0.5–2 fps nothing the title writes gets to 300 submissions and 10 s unused before room runs out, so the gap reads null. I've added a relaxed pass in `979e3a7` (my own implementation, credited in the commit), so there's no need for a separate PR. What it does (`descriptor/pages.rs`): - A write that finds no host page sets a pressure flag. The next `take_back` pass clears it, whether that pass takes anything or not, so pressure lasts one pass. - In that pass, if room is short (below low water), pages unused for more than `PRESSED_AGE_SUBMISSIONS` submissions qualify too, with no time minimum, least recently used first, up to the high-water mark. Pages old by the strict ages are always older than that, so they still go first. With no refused write since the last pass, the strict path is unchanged. - The `view heap pages unused lately taken back` line now logs `relaxed=` (whether that pass took pages younger than the strict ages) and `relaxed_total=` (pages taken that way so far). Where it differs from yours: I used 32 submissions, not 16. At about 20 submissions a frame, 16 can take back a page the previous frame read before this frame gets to it. That page then comes back the next time it's read, after one submission of null reads. 32 keeps anything read every frame. If your logs show 16 doing clearly better, it's a one-line change. Tests: no refusal keeps young pages however full the heap is; after a refusal, pages unused for more than 32 submissions are taken oldest first while one used exactly 32 submissions ago and one used now stay; and the relaxed pass applies once. `cargo test -p victory-gpu --lib` passes with `VICTORY_VIEW_PAGES=1`. Without it, one test that also fails on main on this card fails here too. Clippy is clean with and without `diagnostics`. Could you rerun on `979e3a7`, with #2821 as before? The numbers that would help: when (if ever) `no room left in the host view heap` first shows up, the highest `view heap pages written with no room left` pages=, the `relaxed_total=` on the last take-back line, and the `taken_back=` against `refused=` on `view heap pages placed again`. A high `taken_back` there would mean the relaxed pass is guessing wrong. If you can, also run 16 against 32 on the same save.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-26 04:09 UTC · original

On an RTX 4090 Laptop (621.14), I compared the pressure pass in 979e3a7 with its parent 6f8b5887, using a full heap, generated textures and the runtime direct queue. This tests #2121 on its own.

Submissions since last use at the pass Fresh write refused Result on the new head
32 Yes A kept its slot.
33 No A still kept its slot. The preceding pass had consumed the refusal.
34 Yes B took A's slot. B's first demand read transparent black, its next read green.
33 on the return leg Yes A took the same slot back. Its first demand read transparent black, its next read red.

The shader reported physical page 1027, offset 7 (slot 262919) on all three placements, at both 1,048,576 and 1,835,005 title slots. The control stayed blue. The gated old list read red / transparent black / blue after the queue fence advanced from 32 to 33. The four transfer windows, including idle submissions and pixel readbacks, each took under 60 ms. The logs showed relaxed_total=1 then 2 and placement taken_back/refused of 0/1 then 1/1.

On the parent, the identical short-window test at 1,048,576 slots still read red / transparent black / blue after the new refusal at age 34. A retained 262919, B stayed unmapped and zero pages had been reclaimed.

The original long-window round trip also passed on the new head at both capacities with the filler pages refreshed every 16 submissions. At the old 100-submission refresh interval, the pressure pass correctly reclaimed 244 filler pages while the GPU-marked A stayed resident.

Reproducer and exact test names. The in-game comparison of 16 versus 32 on the same save remains open. AI-assisted with Codex.

**@⁠passerbyyhx** on GitHub · 2026-11-26 04:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7182343804) On an RTX 4090 Laptop (621.14), I compared the pressure pass in `979e3a7` with its parent `6f8b5887`, using a full heap, generated textures and the runtime direct queue. This tests #2121 on its own. | Submissions since last use at the pass | Fresh write refused | Result on the new head | | --- | --- | --- | | 32 | Yes | A kept its slot. | | 33 | No | A still kept its slot. The preceding pass had consumed the refusal. | | 34 | Yes | B took A's slot. B's first demand read transparent black, its next read green. | | 33 on the return leg | Yes | A took the same slot back. Its first demand read transparent black, its next read red. | The shader reported physical page 1027, offset 7 (slot 262919) on all three placements, at both 1,048,576 and 1,835,005 title slots. The control stayed blue. The gated old list read red / transparent black / blue after the queue fence advanced from 32 to 33. The four transfer windows, including idle submissions and pixel readbacks, each took under 60 ms. The logs showed `relaxed_total=1` then `2` and placement `taken_back/refused` of `0/1` then `1/1`. On the parent, the identical short-window test at 1,048,576 slots still read red / transparent black / blue after the new refusal at age 34. A retained 262919, B stayed unmapped and zero pages had been reclaimed. The original long-window round trip also passed on the new head at both capacities with the filler pages refreshed every 16 submissions. At the old 100-submission refresh interval, the pressure pass correctly reclaimed 244 filler pages while the GPU-marked A stayed resident. [Reproducer and exact test names](https://github.com/passerbyyhx/VIctory/blob/9a2713f4ecb6444ab0286968805775910e270c79/crates/victory-gpu/src/descriptor/host/page_retirement.rs). The in-game comparison of 16 versus 32 on the same save remains open. AI-assisted with Codex.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 04:12 UTC · original

@⁠passerbyyhx thanks, that's the boundary exactly as intended:

  • Age 32 with a refusal: kept. Pages must be unused for more than 32 submissions.
  • Age 33 without a fresh refusal: kept. The pressure lasts one pass.
  • Age 34 with a refusal: taken, and the slot hands back the same way on the return leg.
  • On the parent: the same case reclaims nothing.

It's also good to see that at the old 100-submission refresh interval, the pass took the 244 stale filler pages while the GPU-marked A stayed resident. The in-game comparison of 16 against 32 is what's left, for whoever runs the title next.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 04:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7182385055) @⁠passerbyyhx thanks, that's the boundary exactly as intended: - **Age 32 with a refusal:** kept. Pages must be unused for more than 32 submissions. - **Age 33 without a fresh refusal:** kept. The pressure lasts one pass. - **Age 34 with a refusal:** taken, and the slot hands back the same way on the return leg. - **On the parent:** the same case reclaims nothing. It's also good to see that at the old 100-submission refresh interval, the pass took the 244 stale filler pages while the GPU-marked A stayed resident. The in-game comparison of 16 against 32 is what's left, for whoever runs the title next.
Author
Owner

@⁠kawaii-shakal on GitHub · 2026-11-26 04:13 UTC · original

@⁠0xkn0wh3r3 reran on 979e3a7 with #2821 as before (RTX 5070 Ti, Windows 11, native D3D12, same save, ~2.5 min each, into the world). I also ran a build with PRESSED_AGE_SUBMISSIONS = 16, nothing else changed.

32 (979e3a7) 16
first no room left in the host view heap 2:02 after start (written=684297 of=737280) 1:56 (written=682450 of=737280)
highest view heap pages written with no room left pages=256 pages=512
last take-back line total=2074 relaxed_total=243 total=4158 relaxed_total=2440
last view heap pages placed again pages=1357 taken_back=1325 refused=32 pages=2126 taken_back=2048 refused=78

32 is clearly better here. 16 took ten times as many pages through the relaxed pass and had more of them read again. Your reasoning about pages the previous frame read holds. Keep 32.

The take-back is still high with 32, though: taken_back=1325 of 2074 pages taken. Only 243 of those came from the relaxed pass, so most re-placed pages were taken by the strict ages. At this frame rate the working set seems to be just above the 3,906 host pages, and whatever goes gets read again.

(For comparison, my 16-submission version from the earlier comment reached pages=512 on this counter, and before any relaxed pass it was pages=2048.)

🤖 Generated with Claude Code (Claude Opus 5.5)

**@⁠kawaii-shakal** on GitHub · 2026-11-26 04:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7182403743) @⁠0xkn0wh3r3 reran on `979e3a7` with #2821 as before (RTX 5070 Ti, Windows 11, native D3D12, same save, ~2.5 min each, into the world). I also ran a build with `PRESSED_AGE_SUBMISSIONS = 16`, nothing else changed. | | 32 (`979e3a7`) | 16 | |---|---|---| | first `no room left in the host view heap` | 2:02 after start (`written=684297 of=737280`) | 1:56 (`written=682450 of=737280`) | | highest `view heap pages written with no room left` | `pages=256` | `pages=512` | | last take-back line | `total=2074 relaxed_total=243` | `total=4158 relaxed_total=2440` | | last `view heap pages placed again` | `pages=1357 taken_back=1325 refused=32` | `pages=2126 taken_back=2048 refused=78` | 32 is clearly better here. 16 took ten times as many pages through the relaxed pass and had more of them read again. Your reasoning about pages the previous frame read holds. Keep 32. The take-back is still high with 32, though: `taken_back=1325` of 2074 pages taken. Only 243 of those came from the relaxed pass, so most re-placed pages were taken by the strict ages. At this frame rate the working set seems to be just above the 3,906 host pages, and whatever goes gets read again. (For comparison, my 16-submission version from the earlier comment reached `pages=512` on this counter, and before any relaxed pass it was `pages=2048`.) 🤖 Generated with [Claude Code](https://claude.com/claude-code) (Claude Opus 5.5)
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 04:15 UTC · original

@⁠kawaii-shakal thanks for running both on the same save. 32 stays: 16 took ten times as many pages through the relaxed pass (2,440 against 243), more of them were read again, and it peaked at 512 pages refused room against 256.

Your reading of the rest matches mine. 1,325 of the 2,074 pages taken back were read again, and most of those were taken by the strict ages, so at this frame rate the working set sits just above the 3,906 host pages. No page policy fixes that. The one lever left is the dynamic region: its 1,024 host pages (262,144 slots, for tables made fresh for each draw) are placed for good, before any title page. If the title's draws use far fewer dynamic slots than that, shrinking the region on paged hosts would hand the difference to title pages. I'll look at how many dynamic slots a world frame actually holds and report back here.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 04:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7182433430) @⁠kawaii-shakal thanks for running both on the same save. 32 stays: 16 took ten times as many pages through the relaxed pass (2,440 against 243), more of them were read again, and it peaked at 512 pages refused room against 256. Your reading of the rest matches mine. 1,325 of the 2,074 pages taken back were read again, and most of those were taken by the strict ages, so at this frame rate the working set sits just above the 3,906 host pages. No page policy fixes that. The one lever left is the dynamic region: its 1,024 host pages (262,144 slots, for tables made fresh for each draw) are placed for good, before any title page. If the title's draws use far fewer dynamic slots than that, shrinking the region on paged hosts would hand the difference to title pages. I'll look at how many dynamic slots a world frame actually holds and report back here.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 04:19 UTC · original

As promised: 248e4c3 adds a log line that answers the dynamic-region question, with no change in behaviour:

view heap dynamic slots in use peak=<n> of=<dynamic slots> run=<n>

  • peak: the most dynamic slots held at once.
  • of: the size of the region (262,144 on a paged host).
  • run: the longest table any draw asked for.

It's logged when either value passes a power of two. @⁠kawaii-shakal @⁠latentdev, if a run on 248e4c3 (with #2821) could report the highest peak= and run= reached in the world, that settles it. If the peak stays well under 262,144, the region can shrink on paged hosts and the freed pages go to title slots.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 04:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7182496130) As promised: 248e4c3 adds a log line that answers the dynamic-region question, with no change in behaviour: `view heap dynamic slots in use peak=<n> of=<dynamic slots> run=<n>` - `peak`: the most dynamic slots held at once. - `of`: the size of the region (262,144 on a paged host). - `run`: the longest table any draw asked for. It's logged when either value passes a power of two. @⁠kawaii-shakal @⁠latentdev, if a run on `248e4c3` (with #2821) could report the highest `peak=` and `run=` reached in the world, that settles it. If the peak stays well under 262,144, the region can shrink on paged hosts and the freed pages go to title slots.
Author
Owner

@⁠latentdev on GitHub · 2026-11-26 05:40 UTC · original

248e4c3 with #2821 on the RTX 4090: peak under 32,768, run 256

Same setup as before: main 63bcca4 + #1630 + #1832 + #2332 + #2178, this PR at 248e4c3 merged with #2821 at cfbb10a, a warm cache, and 9 minutes of the opening cutscene. To build with #2821, turn_pages needed SHADER_HEAPS.write() instead of .lock(), because the registry is an RwLock there. passerbyyhx's combined branch does the same. Times count from the world's first frame.

view heap dynamic slots in use:

  • peak passed 8,192 at the world's first frame and 16,384 at 3:36. It didn't reach 32,768 (of=262144).
  • run stayed at 256 throughout.

On this card the dynamic region never had more than an eighth of its slots in use. A quarter of it (65,536) would still leave room to spare, and would free 768 pages for title slots.

The rest:

  • Taken back: total=8294 by 7:20, with relaxed_total=6586. From 3:35 on, every logged pass was relaxed and took back 244 pages.
  • Placed again: pages=4121 taken_back=4096 refused=25 at 5:28.
  • No room: no room left in the host view heap appeared at 1:11. view heap pages written with no room left only reached pages=256 written=41182 (5:11). On 6f8b588 it reached pages=2048 written=404408 by 6:49 in my last run, so the relaxed pass cuts the overflow by about eight times here.
  • Stability: no device removal.
**@⁠latentdev** on GitHub · 2026-11-26 05:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7183702860) ### 248e4c3 with #2821 on the RTX 4090: `peak` under 32,768, `run` 256 Same setup as before: `main` 63bcca4 + #1630 + #1832 + #2332 + #2178, this PR at 248e4c3 merged with #2821 at cfbb10a, a warm cache, and 9 minutes of the opening cutscene. To build with #2821, `turn_pages` needed `SHADER_HEAPS.write()` instead of `.lock()`, because the registry is an `RwLock` there. passerbyyhx's combined branch does the same. Times count from the world's first frame. **`view heap dynamic slots in use`:** - `peak` passed 8,192 at the world's first frame and 16,384 at 3:36. It didn't reach 32,768 (`of=262144`). - `run` stayed at 256 throughout. On this card the dynamic region never had more than an eighth of its slots in use. A quarter of it (65,536) would still leave room to spare, and would free 768 pages for title slots. **The rest:** - **Taken back:** `total=8294` by 7:20, with `relaxed_total=6586`. From 3:35 on, every logged pass was relaxed and took back 244 pages. - **Placed again:** `pages=4121 taken_back=4096 refused=25` at 5:28. - **No room:** `no room left in the host view heap` appeared at 1:11. `view heap pages written with no room left` only reached `pages=256 written=41182` (5:11). On 6f8b588 it reached `pages=2048 written=404408` by 6:49 in my last run, so the relaxed pass cuts the overflow by about eight times here. - **Stability:** no device removal.
Author
Owner

@⁠bittertea0323 on GitHub · 2026-11-26 05:52 UTC · original

Ran it in the title on a host that caps the heap: the truncation is gone, and the pages are taken back under the world fast enough to read null

First, the part this pull request actually fixes, measured rather than inferred. On 248e4c3 + 2e0ea66 (the Agility opt-in, without which nothing heap-indexed gets a root signature on Windows 10), RTX 4070 SUPER / driver 591.74 / Windows 10.0.19045:

host view heaps paged=true
view heap paged: the host caps view heaps, title slots are placed by page
                 slots=1245184 host_slots=1000000 pages=3906 fixed=1026

title slot past the host heap:  310,720 → 0        (a whole 180 s run)
heap capped at 1000000:         0
device removed:                 0

1,245,184 title slots, none outside the heap. On main the same run produces exactly 310,720 title slot past the host heap lines — the figure @⁠BaggyALPHA measured, reproducing here too. Your partition eliminates it. That is real and it is the first time this title has run without dropping slots on this GPU.

And the picture is black. Not always: the account-selection screen before the world draws correctly, text and buttons, 10 draws at 30 fps. Entering the world gives ~3,000 draws/frame and a black window, 3–10 s a frame.

The evidence that it is the take-back, not the placement

05:47:38  host view heap pages in use   pages=2049 of=3906 written=92113 of_slots=261888

05:48:36  view heap pages unused lately taken back:
            they read null until placed again
            pages=172  total=172  free=244  in_use=2636
05:48:43  view heap pages placed again: pages=1   taken_back=1  refused=0  in_use=2639
05:48:45  (world frame)
05:48:53  view heap pages unused lately taken back:
            pages=153  total=325  free=244  in_use=2636
05:48:57  view heap pages placed again: pages=16  taken_back=16 refused=0  in_use=269

Two things in those lines:

free=244 while taking back 172 pages. There was room. The take-back is not driven by shortage at that moment, it is driven by the 32-submission age rule. A world frame uses thousands of descriptors across the frame, and a slot used in frame N and again in frame N+40 has been taken back in between — they read null until placed again, exactly as the comment says. Black patches that come and go rather than a stable black.

in_use 2764 → 269 in one take-back. Not a gradual decline; the page set collapses and is then rebuilt over the following frames (placed again: pages=16), so the world alternates between "partly null" and "rebuilding".

For completeness on the earlier line: pages in use 2049 of 3906 with written=92113 of_slots=261888 means the world has not yet touched most of the heap at that point, so the take-back is not reclaiming rarely-used tail pages — it is reclaiming pages the frame loop is actively cycling through.

Two smaller things from the same run, neither of them yours

WARN pipeline: shader does not translate; its pipelines' draws are dropped
                stage="compute" hash=90a0692af4320129
WARN pipeline: shader does not translate; its pipelines' draws are dropped
                stage="compute" hash=82a2ad6d07417d36
dropped without a host pipeline: 34
WARN descriptor::host: an unordered view in a format the host cannot store view=86 own=86
WARN descriptor::host: buffer view empty or past its host copy first=0 count=0 element=4
WARN descriptor::host: unordered buffer view empty or past its host copy
                first=2598480 count=0 element=16

The two untranslated compute shaders are the fork's own 17 refusals, reported separately. view=86 own=86 is the host format question of #2462. The two empty-buffer-view warnings have count=0, so I would not read them as page-table misses, but I am noting them because I cannot rule it out from here.

What this does not establish

I did not isolate whether the black is entirely the take-back. Three other candidates are live in this run and none is excluded:

  • the title's ray-tracing structures are never built (upstream-wide, per the README), which the world's lighting needs;
  • 34 draws dropped for a missing host pipeline;
  • the two untranslated compute shaders above.

What I can say is that the take-back happens inside the world's frame loop, with free pages available, and that the log states the consequence in the code's own words. That is enough for me to bring it to you rather than keep bisecting alone.

What would separate it cheaply

A run with the age threshold raised past anything a world frame reaches (or take-back disabled entirely for one run) on the same build would tell us in 45 seconds whether the black clears. If it does, the age rule needs a floor: a page holding a slot the frame loop touches every 40th frame still needs a floor under its age. If it does not clear, the take-back is exonerated and the three candidates above are where to look.

I can run that if you want the data, but you will know the threshold's intended range better than I do — I would be guessing at a number.

Environment, for reproducing

RTX 4070 SUPER (12 GB, 32-lane), driver 591.74, Windows 10.0.19045 (22H2), Ryzen 7 7800X3D, 31 GB. Built with --features victory-gpu/diagnostics, VICTORY_LOG=info,victory_gpu::descriptor=debug. TdrDelay 10 (the 3 s and 10 s frames here are under it; the earlier 30 s setting was masking things). Title build 7952987A, retail 1.0.2.1, Xbox Series X.

Counts, log lines and timing only — no title data, no shader bytes, no asset paths.

**@⁠bittertea0323** on GitHub · 2026-11-26 05:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7183887599) ## Ran it in the title on a host that caps the heap: the truncation is gone, and the pages are taken back under the world fast enough to read null First, the part this pull request actually fixes, measured rather than inferred. On `248e4c3` + `2e0ea66` (the Agility opt-in, without which nothing heap-indexed gets a root signature on Windows 10), RTX 4070 SUPER / driver 591.74 / Windows 10.0.19045: `````` host view heaps paged=true view heap paged: the host caps view heaps, title slots are placed by page slots=1245184 host_slots=1000000 pages=3906 fixed=1026 title slot past the host heap: 310,720 → 0 (a whole 180 s run) heap capped at 1000000: 0 device removed: 0 `````` **1,245,184 title slots, none outside the heap.** On `main` the same run produces exactly 310,720 `title slot past the host heap` lines — the figure @⁠BaggyALPHA measured, reproducing here too. Your partition eliminates it. That is real and it is the first time this title has run without dropping slots on this GPU. **And the picture is black.** Not always: the account-selection screen before the world draws correctly, text and buttons, 10 draws at 30 fps. Entering the world gives ~3,000 draws/frame and a black window, 3–10 s a frame. ### The evidence that it is the take-back, not the placement `````` 05:47:38 host view heap pages in use pages=2049 of=3906 written=92113 of_slots=261888 05:48:36 view heap pages unused lately taken back: they read null until placed again pages=172 total=172 free=244 in_use=2636 05:48:43 view heap pages placed again: pages=1 taken_back=1 refused=0 in_use=2639 05:48:45 (world frame) 05:48:53 view heap pages unused lately taken back: pages=153 total=325 free=244 in_use=2636 05:48:57 view heap pages placed again: pages=16 taken_back=16 refused=0 in_use=269 `````` Two things in those lines: **`free=244` while taking back 172 pages.** There was room. The take-back is not driven by shortage at that moment, it is driven by the 32-submission age rule. A world frame uses thousands of descriptors across the frame, and a slot used in frame N and again in frame N+40 has been taken back in between — `they read null until placed again`, exactly as the comment says. Black patches that come and go rather than a stable black. **`in_use` 2764 → 269 in one take-back.** Not a gradual decline; the page set collapses and is then rebuilt over the following frames (`placed again: pages=16`), so the world alternates between "partly null" and "rebuilding". For completeness on the earlier line: `pages in use 2049 of 3906` with `written=92113 of_slots=261888` means the world has not yet touched most of the heap at that point, so the take-back is not reclaiming rarely-used tail pages — it is reclaiming pages the frame loop is actively cycling through. ### Two smaller things from the same run, neither of them yours `````` WARN pipeline: shader does not translate; its pipelines' draws are dropped stage="compute" hash=90a0692af4320129 WARN pipeline: shader does not translate; its pipelines' draws are dropped stage="compute" hash=82a2ad6d07417d36 dropped without a host pipeline: 34 WARN descriptor::host: an unordered view in a format the host cannot store view=86 own=86 WARN descriptor::host: buffer view empty or past its host copy first=0 count=0 element=4 WARN descriptor::host: unordered buffer view empty or past its host copy first=2598480 count=0 element=16 `````` The two untranslated compute shaders are the fork's own 17 refusals, reported separately. `view=86 own=86` is the host format question of #2462. The two empty-buffer-view warnings have `count=0`, so I would not read them as page-table misses, but I am noting them because I cannot rule it out from here. ### What this does not establish I did not isolate whether the black is **entirely** the take-back. Three other candidates are live in this run and none is excluded: - the title's ray-tracing structures are never built (upstream-wide, per the README), which the world's lighting needs; - 34 draws dropped for a missing host pipeline; - the two untranslated compute shaders above. What I can say is that the take-back happens *inside* the world's frame loop, with free pages available, and that the log states the consequence in the code's own words. That is enough for me to bring it to you rather than keep bisecting alone. ### What would separate it cheaply A run with the age threshold raised past anything a world frame reaches (or take-back disabled entirely for one run) on the same build would tell us in 45 seconds whether the black clears. If it does, the age rule needs a floor: a page holding a slot the frame loop touches every 40th frame still needs a floor under its age. If it does not clear, the take-back is exonerated and the three candidates above are where to look. I can run that if you want the data, but you will know the threshold's intended range better than I do — I would be guessing at a number. ### Environment, for reproducing RTX 4070 SUPER (12 GB, 32-lane), driver 591.74, Windows 10.0.19045 (22H2), Ryzen 7 7800X3D, 31 GB. Built with `--features victory-gpu/diagnostics`, `VICTORY_LOG=info,victory_gpu::descriptor=debug`. `TdrDelay` 10 (the 3 s and 10 s frames here are under it; the earlier 30 s setting was masking things). Title build `7952987A`, retail 1.0.2.1, Xbox Series X. Counts, log lines and timing only — no title data, no shader bytes, no asset paths.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 05:56 UTC · original

Thank you, this is the run I needed. One correction to how the take-back line reads, then a switch for the experiment you suggested.

free=244 is logged after the take-back, not before it. The line is written once the host pages are given back, and 244 is exactly the high-water mark (3,906 / 16). A take-back only starts when fewer than 3,906 / 32 = 122 host pages are free (LOW_WATER in descriptor/pages.rs), and it takes back just enough to reach 244. So these take-backs were driven by shortage: the title's share of the heap (3,906 − 1,026 fixed = 2,880 pages) didn't hold what the world was using at the time. That fits your reading that the pages taken back are ones the frame loop is still cycling through.

Switch for the experiment: c2e5ebc3 adds VICTORY_VIEW_PAGES_KEEP=1 (diagnostics builds). With it, no page is taken back, and a write past the free pages is refused as before the take-back, with view heap pages written with no room left warnings. If the world is still black with the switch, the take-back isn't the cause and your three other candidates are where to look. If the black changes (for example to stable missing patches instead of flicker), it's the page budget.

Three numbers from that run (or the next one) would decide what to change:

  1. The relaxed= / relaxed_total= fields on the view heap pages unused lately taken back lines. They say whether pages younger than the strict ages (300 submissions and 10 s) were taken, meaning the 32-submission rule after a refused write.
  2. The view heap dynamic slots in use line's peak= and run=. The fixed region keeps 1,024 pages for dynamic slots. If the title's peak is far below that, the region can shrink and give the title several hundred more pages, which is the lever I'd pull first.
  3. The in_use=269 on the last placed again line: 153 pages taken back from 2,636 shouldn't leave 269, so could you check whether that's 2,690 or similar?
**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 05:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7183937587) Thank you, this is the run I needed. One correction to how the take-back line reads, then a switch for the experiment you suggested. **`free=244` is logged after the take-back, not before it.** The line is written once the host pages are given back, and 244 is exactly the high-water mark (3,906 / 16). A take-back only starts when fewer than 3,906 / 32 = 122 host pages are free (`LOW_WATER` in `descriptor/pages.rs`), and it takes back just enough to reach 244. So these take-backs were driven by shortage: the title's share of the heap (3,906 − 1,026 fixed = 2,880 pages) didn't hold what the world was using at the time. That fits your reading that the pages taken back are ones the frame loop is still cycling through. **Switch for the experiment:** c2e5ebc3 adds `VICTORY_VIEW_PAGES_KEEP=1` (diagnostics builds). With it, no page is taken back, and a write past the free pages is refused as before the take-back, with `view heap pages written with no room left` warnings. If the world is still black with the switch, the take-back isn't the cause and your three other candidates are where to look. If the black changes (for example to stable missing patches instead of flicker), it's the page budget. Three numbers from that run (or the next one) would decide what to change: 1. The `relaxed=` / `relaxed_total=` fields on the `view heap pages unused lately taken back` lines. They say whether pages younger than the strict ages (300 submissions and 10 s) were taken, meaning the 32-submission rule after a refused write. 2. The `view heap dynamic slots in use` line's `peak=` and `run=`. The fixed region keeps 1,024 pages for dynamic slots. If the title's peak is far below that, the region can shrink and give the title several hundred more pages, which is the lever I'd pull first. 3. The `in_use=269` on the last `placed again` line: 153 pages taken back from 2,636 shouldn't leave 269, so could you check whether that's 2,690 or similar?
Author
Owner

@⁠bittertea0323 on GitHub · 2026-11-26 06:00 UTC · original

Measuring the page budget on an NVIDIA host: the dynamic range costs 1,024 of 3,906 pages the title needs, and it is used at 3%

Following up on my earlier comment with three measurements that bound what a paged heap can do inside one host heap. Same host as before: RTX 4070 SUPER (12 GB), driver 591.74, Windows 10.0.19045, 248e4c3 + 2e0ea66 (Agility opt-in), --features victory-gpu/diagnostics.

The partition, measured

view heap paged: slots=1245184 host_slots=1000000 pages=3906 fixed=1026
view heap pages in use   pages=2636 free=244      (2636 + 244 = 2880)

So on this card:

host pages                    3,906
fixed (dynamic 262,144 / 256 + null + scratch)   1,026
left for the title's pages                        2,880
title needs (1,245,184 / 256)                     4,864
                                             ─────────
short by                                          1,984 pages (1.7x)

The title wants 4,864 pages and there are 2,880. That ratio is why it cycles, and it matches what I reported before: taken back: pages=172, taken back: pages=153, repeated.

The dynamic range is 3% used

The same build logs a peak:

view heap dynamic slots in use peak=8192 of=262144

8,192 of 262,144. The 1,024 host pages reserved for the dynamic range are holding a set that peaks at one thirty-second of that, while the title is short by 1,984 pages. That is the whole trade in one line.

What happens when the dynamic range gives pages back

I changed only the paged arm's extra (host.rs, the if paged branch) and ran each build 200–220 s:

paged extra fixed host pages for the title taken back furthest reached
DYNAMIC (262,144) 1,026 2,880 325 total 3,510 draws, black
half (163,840) 642 3,264 0 12 draws (menus), 30 fps
MIN_DYNAMIC (65,536) 258 3,648 0 12 draws (menus), 30 fps

The take-back disappears completely at both reduced sizes — that part of the hypothesis holds, and it is the take-back that turns the picture black rather than the truncation.

But I want to be careful about the third column: I do not think the two reduced rows failed to load, I think they had not finished. Their logs show first bind pipeline ... frame=3582 and host pipeline library saved bytes=231,078,944 early=1663 ... created=842 — they were compiling pipelines for the whole run, never reached the world, and my 200 s window was shorter than the compile. The full-DYNAMIC row reached 3,510 draws because its pipeline library was already warm from earlier runs. So "reduced dynamic range breaks the world" is not established by my data and should not be read that way.

What this suggests, if you want it

Two things the numbers point at, both inside your design:

extra in the paged arm does not need DYNAMIC. On this title 8,192 slots peak, so MIN_DYNAMIC (65,536) has 8× headroom and returns 768 pages to the title — 2,880 → 3,648, short by 1,984 → 1,216. Whether that is enough for the world I have not measured (see above), but the direction is free.

The page count itself is the wall. 3,906 host pages is PORTABLE_VIEWS / 256. If the page held more slots the same 1,000,000 would give fewer pages with more slots each — but your comment says 226 of 256 slots per page were live and smaller pages would not fit more, so I take it that 256 is already the better end.

What I cannot see a way around inside one heap: 1,245,184 title slots + a dynamic range + null/scratch is more than 1,000,000, and paging only helps if the live set fits. Here it very nearly does (2,636 of 2,880) but the reserved dynamic pages are what push it over.

Not covered

No run in the reduced rows reached the world, so nothing here says their picture is correct or that the take-back is the only cause of the black — the world also needs ray-tracing structures this tree never builds, drops 34 draws for missing host pipelines, and has the fork's two untranslated compute shaders in this run. My earlier comment has the take-back evidence; this one only adds the page budget and what the dynamic range costs.

Counts, log lines and timings only. RTX 4070 SUPER / Windows 10 / driver 591.74; all three rows from runs on this host, 200–220 s each, VICTORY_LOG=info.

**@⁠bittertea0323** on GitHub · 2026-11-26 06:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7184006181) ## Measuring the page budget on an NVIDIA host: the dynamic range costs 1,024 of 3,906 pages the title needs, and it is used at 3% Following up on my earlier comment with three measurements that bound what a paged heap can do **inside one host heap**. Same host as before: RTX 4070 SUPER (12 GB), driver 591.74, Windows 10.0.19045, `248e4c3` + `2e0ea66` (Agility opt-in), `--features victory-gpu/diagnostics`. ### The partition, measured `````` view heap paged: slots=1245184 host_slots=1000000 pages=3906 fixed=1026 view heap pages in use pages=2636 free=244 (2636 + 244 = 2880) `````` So on this card: `````` host pages 3,906 fixed (dynamic 262,144 / 256 + null + scratch) 1,026 left for the title's pages 2,880 title needs (1,245,184 / 256) 4,864 ───────── short by 1,984 pages (1.7x) `````` **The title wants 4,864 pages and there are 2,880.** That ratio is why it cycles, and it matches what I reported before: `taken back: pages=172`, `taken back: pages=153`, repeated. ### The dynamic range is 3% used The same build logs a peak: `````` view heap dynamic slots in use peak=8192 of=262144 `````` **8,192 of 262,144.** The 1,024 host pages reserved for the dynamic range are holding a set that peaks at one thirty-second of that, while the title is short by 1,984 pages. That is the whole trade in one line. ### What happens when the dynamic range gives pages back I changed only the paged arm's `extra` (`host.rs`, the `if paged` branch) and ran each build 200–220 s: | paged `extra` | fixed | host pages for the title | `taken back` | furthest reached | |---|---:|---:|---:|---| | `DYNAMIC` (262,144) | 1,026 | 2,880 | **325 total** | 3,510 draws, black | | half (163,840) | 642 | 3,264 | **0** | 12 draws (menus), 30 fps | | `MIN_DYNAMIC` (65,536) | 258 | 3,648 | **0** | 12 draws (menus), 30 fps | **The take-back disappears completely at both reduced sizes** — that part of the hypothesis holds, and it is the take-back that turns the picture black rather than the truncation. But I want to be careful about the third column: **I do not think the two reduced rows failed to load, I think they had not finished.** Their logs show `first bind pipeline ... frame=3582` and `host pipeline library saved bytes=231,078,944 early=1663 ... created=842` — they were compiling pipelines for the whole run, never reached the world, and my 200 s window was shorter than the compile. The full-`DYNAMIC` row reached 3,510 draws because its pipeline library was already warm from earlier runs. So **"reduced dynamic range breaks the world" is not established by my data** and should not be read that way. ### What this suggests, if you want it Two things the numbers point at, both inside your design: **`extra` in the paged arm does not need `DYNAMIC`.** On this title 8,192 slots peak, so `MIN_DYNAMIC` (65,536) has 8× headroom and returns 768 pages to the title — 2,880 → 3,648, short by 1,984 → 1,216. Whether that is enough for the world I have not measured (see above), but the direction is free. **The page count itself is the wall.** 3,906 host pages is `PORTABLE_VIEWS / 256`. If the page held more slots the same 1,000,000 would give fewer pages with more slots each — but your comment says 226 of 256 slots per page were live and smaller pages would not fit more, so I take it that 256 is already the better end. What I cannot see a way around **inside one heap**: 1,245,184 title slots + a dynamic range + null/scratch is more than 1,000,000, and paging only helps if the *live* set fits. Here it very nearly does (2,636 of 2,880) but the reserved dynamic pages are what push it over. ### Not covered No run in the reduced rows reached the world, so nothing here says their picture is correct or that the take-back is the only cause of the black — the world also needs ray-tracing structures this tree never builds, drops 34 draws for missing host pipelines, and has the fork's two untranslated compute shaders in this run. My earlier comment has the take-back evidence; this one only adds the page budget and what the dynamic range costs. Counts, log lines and timings only. RTX 4070 SUPER / Windows 10 / driver 591.74; all three rows from runs on this host, 200–220 s each, `VICTORY_LOG=info`.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 06:04 UTC · original

That settles the dynamic range. c1d5a3a2 gives a paged heap MIN_DYNAMIC (65,536) dynamic slots instead of DYNAMIC, the same as a capped heap already gets on main without paging. That's 258 fixed pages and 3,648 for the title, your third row. The peak= line is logged when the peak passes a power of two, so 8,192 means a peak between 8,192 and 16,383: at least 4× headroom. PAGED_TITLE_VIEWS follows it, so the cap on title slots rises by 196,608. The title's 1,245,184 was below the cap either way.

Thanks for flagging that the reduced rows never reached the world: agreed, they show the take-back gone in menus, not a correct world. A run that gets past the pipeline compile (a warm library from the full-range build should carry over, since the pipelines are the same) would show whether 3,648 pages hold the world's live set. If taken back lines still show up there, relaxed= on them tells whether the strict ages or the 32-submission rule took them. VICTORY_VIEW_PAGES_KEEP=1 from c2e5ebc3 is still there to rule the take-back in or out.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 06:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7184074523) That settles the dynamic range. c1d5a3a2 gives a paged heap `MIN_DYNAMIC` (65,536) dynamic slots instead of `DYNAMIC`, the same as a capped heap already gets on `main` without paging. That's 258 fixed pages and 3,648 for the title, your third row. The `peak=` line is logged when the peak passes a power of two, so 8,192 means a peak between 8,192 and 16,383: at least 4× headroom. `PAGED_TITLE_VIEWS` follows it, so the cap on title slots rises by 196,608. The title's 1,245,184 was below the cap either way. Thanks for flagging that the reduced rows never reached the world: agreed, they show the take-back gone in menus, not a correct world. A run that gets past the pipeline compile (a warm library from the full-range build should carry over, since the pipelines are the same) would show whether 3,648 pages hold the world's live set. If `taken back` lines still show up there, `relaxed=` on them tells whether the strict ages or the 32-submission rule took them. `VICTORY_VIEW_PAGES_KEEP=1` from c2e5ebc3 is still there to rule the take-back in or out.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-26 06:23 UTC · original

Tested the 65,536-slot dynamic region on Windows with an RTX 4090 Laptop (driver 621.14). On c23f7085, both title heap layouts completed A → B → A on physical slot 66,311 (page 259, offset 7), using synthetic textures and the runtime D3D12 queue.

Title slots Allocatable physical pages Physical slot of the blue control
1,048,576 3,648 519
2,031,613 (new cap) 3,647 772

The unaligned cap costs one additional fixed page. In both layouts, the old submission read red / transparent black / blue (A / B / control) after its fence completed. On each transfer the first demand read transparent black. After retry, B read green from slot 66,311. When A got that same slot back, it read red. The control stayed blue throughout.

Both the short pressure window (fence 32 → 33) and the strict window (301 → 302) passed. With VICTORY_VIEW_PAGES_KEEP=1, renewed pressure and strict aging both left A red and B unmapped, with zero pages reclaimed or restored. I also repeated the short-window round trip on the integrated demo 11a24276 with #2821 and #3052. Both layouts gave the same slot and colors. This covers descriptor reuse on this device. Whether 3,648 pages hold the world’s live set still needs the in-game measurement.

Fixture on the PR head · Fixture on the integrated demo

**@⁠passerbyyhx** on GitHub · 2026-11-26 06:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7184379468) Tested the 65,536-slot dynamic region on Windows with an RTX 4090 Laptop (driver 621.14). On `c23f7085`, both title heap layouts completed A → B → A on **physical slot 66,311** (page 259, offset 7), using synthetic textures and the runtime D3D12 queue. | Title slots | Allocatable physical pages | Physical slot of the blue control | | ---: | ---: | ---: | | 1,048,576 | 3,648 | 519 | | 2,031,613 (new cap) | 3,647 | 772 | The unaligned cap costs one additional fixed page. In both layouts, the old submission read **red / transparent black / blue** (A / B / control) after its fence completed. On each transfer the first demand read transparent black. After retry, B read green from slot 66,311. When A got that same slot back, it read red. The control stayed blue throughout. Both the short pressure window (fence 32 → 33) and the strict window (301 → 302) passed. With `VICTORY_VIEW_PAGES_KEEP=1`, renewed pressure and strict aging both left A red and B unmapped, with zero pages reclaimed or restored. I also repeated the short-window round trip on the integrated demo `11a24276` with #2821 and #3052. Both layouts gave the same slot and colors. This covers descriptor reuse on this device. Whether 3,648 pages hold the world’s live set still needs the in-game measurement. [Fixture on the PR head](https://github.com/passerbyyhx/VIctory/commit/4724ae68395a4f2b3e0ec8d83d2b89565b84822e) · [Fixture on the integrated demo](https://github.com/passerbyyhx/VIctory/commit/ddc4a65c14c01e37a2788a402c12dcb985a5e68c)
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 06:24 UTC · original

Thanks, this checks the reuse path on c23f7085 directly: the old submission keeps its colors after the take-back, the page goes back and forth on one host page, and VICTORY_VIEW_PAGES_KEEP=1 leaves everything placed.

On the extra fixed page at the cap: it only costs anything for a title whose slot count isn't a multiple of 256. This title's 1,245,184 slots are exactly 4,864 pages, so its dynamic range starts on a page boundary and it gets all 3,648. I've left the cap as it is.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 06:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7184398285) Thanks, this checks the reuse path on c23f7085 directly: the old submission keeps its colors after the take-back, the page goes back and forth on one host page, and `VICTORY_VIEW_PAGES_KEEP=1` leaves everything placed. On the extra fixed page at the cap: it only costs anything for a title whose slot count isn't a multiple of 256. This title's 1,245,184 slots are exactly 4,864 pages, so its dynamic range starts on a page boundary and it gets all 3,648. I've left the cap as it is.
Author
Owner

@⁠bittertea0323 on GitHub · 2026-11-26 06:26 UTC · original

A/B on the same machine, same title, same Agility opt-in: the un-paged tree draws the world and the paged one draws black

I built a control to answer the one thing my earlier comments could not: is the black screen the take-back, or something this tree cannot fix anyway (ray-tracing structures never built, dropped draws, untranslated shaders)? Yesterday I assumed the latter and said so in #1627. That was wrong, and here is the measurement that shows it.

The two builds

Both on this host (RTX 4070 SUPER 12 GB, driver 591.74, Windows 10.0.19045), same retail title build 7952987A, Xbox Series X, both with the Agility SDK export and D3D12Core.dll beside the exe (nothing heap-indexed gets a root signature on Windows 10 without it):

build view heap first world frame reached draws/frame ms/frame picture
try/wave64 (fork, pre-bindless) not paged, no heap-indexing shaders ~50 s after the last keypress 2,260 1,567 correct
248e4c3 + 2e0ea66 (this PR + Agility) paged, slots=1245184 host_slots=1000000 pages=3906 fixed=1026 same point in the title 3,510 ~9,000 black

The un-paged tree renders the title's opening caption card correctly — two lines of large type and the localized subtitle underneath, both legible, both in the right place, on a plain background. I am not posting the picture (it is title content) but the point is that it is a rendered frame of world content, not a menu, and everything in it is where it should be.

The paged tree, at the same point in the title with the same keypresses, draws black at 3,510 draws.

Why this is the take-back and not my three excuses

The earlier candidates are all present in both runs, so none of them can explain the difference:

  • Ray-tracing structures: never built in either tree (the README says so for main, and try/wave64 predates even that). The caption card needs no ray-traced shadows, and it renders correctly on the un-paged tree.
  • Dropped draws: both trees drop draws for missing host pipelines; the un-paged one still puts the caption card on screen.
  • Untranslated compute shaders: try/wave64 translates more programs (it is the older base), so if anything it has fewer refusals — yet the paged tree, with fewer refusals, is the black one.

What differs is exactly one thing: fixed=1026 pages are held by the dynamic range, 2,880 host pages are left for a title that wants 4,864, and the take-back fires 325 times in the run.

The strongest single line from the paged run

view heap pages unused lately taken back: they read null until placed again
    pages=172  total=172  free=244  in_use=2636
...
view heap pages placed again: pages=16  taken_back=16  refused=0  in_use=269

in_use 2764 → 269 in one take-back, with free=244 still available. The page set collapses and is rebuilt while the frame loop is running through it, so slots a draw read in one frame read null 40 frames later. That is a black picture that flickers, which is what I see.

What I am not claiming

I have not proven the take-back is the only defect in the paged path — only that removing the paging removes the black, on identical builds of the same title on the same machine. It is possible the page table entries or the shader-side page lookup have their own problem that a longer run would show after the take-back stops.

I also do not have a run of the paged build that both avoided the take-back and reached the world: my two attempts at shrinking the dynamic range (extra = half, then MIN_DYNAMIC) kept taken back at 0 but did not finish compiling pipelines inside my 200–220 s windows, so they never reached the world to be judged. That experiment is still open and I flagged it as such in my previous comment.

What would settle it

Raising the take-back age past anything a world frame reaches — one run, same build, 45 s to the caption card — tells us in one number whether the black is purely the take-back. The world's descriptor cycle is long enough that 32 submissions is inside it, and this build's own peak of 8192 of 262144 dynamic slots says the pages being taken back are not the ones the take-back was designed to reclaim.

Environment and method as in my earlier comments. Counts and log lines only; no title content, assets or shader bytes in this report.

**@⁠bittertea0323** on GitHub · 2026-11-26 06:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7184426310) ## A/B on the same machine, same title, same Agility opt-in: the un-paged tree draws the world and the paged one draws black I built a control to answer the one thing my earlier comments could not: is the black screen **the take-back**, or something this tree cannot fix anyway (ray-tracing structures never built, dropped draws, untranslated shaders)? Yesterday I assumed the latter and said so in #1627. **That was wrong, and here is the measurement that shows it.** ### The two builds Both on this host (RTX 4070 SUPER 12 GB, driver 591.74, Windows 10.0.19045), same retail title build `7952987A`, Xbox Series X, both with the Agility SDK export and `D3D12Core.dll` beside the exe (nothing heap-indexed gets a root signature on Windows 10 without it): | build | view heap | first world frame reached | draws/frame | ms/frame | picture | |---|---|---:|---:|---:|---| | `try/wave64` (fork, pre-bindless) | not paged, no heap-indexing shaders | ~50 s after the last keypress | **2,260** | 1,567 | **correct** | | `248e4c3` + `2e0ea66` (this PR + Agility) | paged, `slots=1245184 host_slots=1000000 pages=3906 fixed=1026` | same point in the title | 3,510 | ~9,000 | **black** | **The un-paged tree renders the title's opening caption card correctly** — two lines of large type and the localized subtitle underneath, both legible, both in the right place, on a plain background. I am not posting the picture (it is title content) but the point is that it is a *rendered frame of world content*, not a menu, and everything in it is where it should be. **The paged tree, at the same point in the title with the same keypresses, draws black at 3,510 draws.** ### Why this is the take-back and not my three excuses The earlier candidates are all present in **both** runs, so none of them can explain the difference: - **Ray-tracing structures**: never built in either tree (the README says so for `main`, and `try/wave64` predates even that). The caption card needs no ray-traced shadows, and it renders correctly on the un-paged tree. - **Dropped draws**: both trees drop draws for missing host pipelines; the un-paged one still puts the caption card on screen. - **Untranslated compute shaders**: `try/wave64` translates *more* programs (it is the older base), so if anything it has fewer refusals — yet the paged tree, with fewer refusals, is the black one. What differs is exactly one thing: **`fixed=1026` pages are held by the dynamic range, 2,880 host pages are left for a title that wants 4,864, and the take-back fires 325 times in the run.** ### The strongest single line from the paged run `````` view heap pages unused lately taken back: they read null until placed again pages=172 total=172 free=244 in_use=2636 ... view heap pages placed again: pages=16 taken_back=16 refused=0 in_use=269 `````` `in_use` **2764 → 269** in one take-back, with `free=244` still available. The page set collapses and is rebuilt while the frame loop is running through it, so slots a draw read in one frame read null 40 frames later. That is a black picture that flickers, which is what I see. ### What I am not claiming I have not proven the take-back is the **only** defect in the paged path — only that removing the paging removes the black, on identical builds of the same title on the same machine. It is possible the page table entries or the shader-side page lookup have their own problem that a longer run would show after the take-back stops. I also do not have a run of the paged build that both avoided the take-back *and* reached the world: my two attempts at shrinking the dynamic range (`extra` = half, then `MIN_DYNAMIC`) kept `taken back` at 0 but did not finish compiling pipelines inside my 200–220 s windows, so they never reached the world to be judged. That experiment is still open and I flagged it as such in my previous comment. ### What would settle it Raising the take-back age past anything a world frame reaches — one run, same build, 45 s to the caption card — tells us in one number whether the black is purely the take-back. The world's descriptor cycle is long enough that 32 submissions is inside it, and this build's own peak of `8192 of 262144` dynamic slots says the pages being taken back are not the ones the take-back was designed to reclaim. Environment and method as in my earlier comments. Counts and log lines only; no title content, assets or shader bytes in this report.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 06:27 UTC · original

Thanks, the A/B against the un-paged tree is the comparison that was missing. Both changes it calls for are on the current head, c23f7085, which is past the 248e4c3 you ran:

  • Smaller dynamic range (c1d5a3a2): 258 fixed pages instead of 1,026, so 3,648 for the title.
  • VICTORY_VIEW_PAGES_KEEP=1 (c2e5ebc3, diagnostics builds): turns the take-back off entirely. It goes further than raising the age: nothing is ever taken back, and a write past the free pages is refused instead.

So the run that would settle it is c23f7085 to the caption card, once with defaults and once with VICTORY_VIEW_PAGES_KEEP=1. The pipeline library cache should be warm from your full-range runs, since the pipelines don't change, so it shouldn't need the long compile your earlier reduced-range runs hit. If the caption card draws with the defaults, the page budget was the problem. If it only draws with KEEP=1, the take-back still fires in the world even with 3,648 pages, and the relaxed= field on those lines will say which age rule took them.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 06:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7184448071) Thanks, the A/B against the un-paged tree is the comparison that was missing. Both changes it calls for are on the current head, c23f7085, which is past the `248e4c3` you ran: - **Smaller dynamic range** (c1d5a3a2): 258 fixed pages instead of 1,026, so 3,648 for the title. - **`VICTORY_VIEW_PAGES_KEEP=1`** (c2e5ebc3, diagnostics builds): turns the take-back off entirely. It goes further than raising the age: nothing is ever taken back, and a write past the free pages is refused instead. So the run that would settle it is c23f7085 to the caption card, once with defaults and once with `VICTORY_VIEW_PAGES_KEEP=1`. The pipeline library cache should be warm from your full-range runs, since the pipelines don't change, so it shouldn't need the long compile your earlier reduced-range runs hit. If the caption card draws with the defaults, the page budget was the problem. If it only draws with `KEEP=1`, the take-back still fires in the world even with 3,648 pages, and the `relaxed=` field on those lines will say which age rule took them.
Author
Owner

@⁠nathanbzrr on GitHub · 2026-11-26 07:48 UTC · original · requested changes

Reviewed c23f708 on Windows 11 (AMD Radeon RX 7600 + D3D12 Debug + WARP):

  • cargo run -p xtask --locked -- policy: 192 files ok
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings (default & --all-features): clean
  • cargo test -p victory-gpu --lib --locked descriptor -- --test-threads=1 (RX 7600): 36 passed; 0 failed
  • VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --lib --locked descriptor -- --test-threads=1 (RX 7600 + Debug): 36 passed; 0 failed
  • VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --lib --locked descriptor -- --test-threads=1 (WARP + Debug): 36 passed; 0 failed

Two issues found in the reclaim/remake interaction need fixes before merge:

  1. Host::execute (crates/victory-gpu/src/host.rs:1466-1472) runs make_read before turn_pages, letting remakes() null out newly recreated placed textures.
    In Host::execute, crate::descriptor::make_read(&read) runs before crate::descriptor::turn_pages(...). When a previously taken-back page (made[index] == key, slot replaced by page_nulls, kept cleared) is read again in the same submission:
    • make_read first recreates the placed texture in that slot;
    • turn_pages -> place_page -> remakes() then fills made[first..last] with REMAKE, and sync_slots calls mirror(..., false) where later = !for_draw && is_placed_texture(&view) (true), overwriting placed textures back to null_for right after make_read populated them.
    • Notably, view_heap_pages_taken_back_are_placed_again_when_read (crates/victory-gpu/src/host.rs:506-520) invokes turn_pages before make_read, which masks the Host::execute ordering. Running turn_pages before make_read (or preserving placed textures created/kept for the current submission across remakes) and testing the Host::execute order would fix this.
  2. needs_remake() (crates/victory-gpu/src/descriptor/host.rs:1067) returns false for non-texture views on taken-back pages.
    take_back_pages replaces the host page with page_nulls while leaving made[index] == key. When a taken-back page is later placed again via remake_pages (descriptor.rs:212, 236, 244) -> sync_slots -> mirror(..., true), needs_remake() short-circuits when !for_draw || !is_texture(&view). As a result, View::Constant (CBVs), buffer View::Shader (SRVs), and non-texture View::Unordered (UAVs) whose records still match key are skipped instead of being rebuilt into the newly placed host page.

(Side note on descriptor/pages.rs:41, 394: under pressure PRESSED_AGE_SUBMISSIONS = 32 evicts pages unused for 32 submissions regardless of MIN_AGE = 10s, so any long-lived descriptor not re-bound/stamped every frame can still churn if the heap stays near LOW_WATER.)

AI-assisted; synthetic tests only, no game files.

**@⁠nathanbzrr** on GitHub · 2026-11-26 07:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#pullrequestreview-6070251324) · **requested changes** Reviewed `c23f708` on Windows 11 (AMD Radeon RX 7600 + D3D12 Debug + WARP): - `cargo run -p xtask --locked -- policy`: `192 files ok` - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` (default & `--all-features`): clean - `cargo test -p victory-gpu --lib --locked descriptor -- --test-threads=1` (RX 7600): `36 passed; 0 failed` - `VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --lib --locked descriptor -- --test-threads=1` (RX 7600 + Debug): `36 passed; 0 failed` - `VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --lib --locked descriptor -- --test-threads=1` (WARP + Debug): `36 passed; 0 failed` Two issues found in the reclaim/remake interaction need fixes before merge: 1. **`Host::execute` (`crates/victory-gpu/src/host.rs:1466-1472`) runs `make_read` before `turn_pages`, letting `remakes()` null out newly recreated placed textures.** In `Host::execute`, `crate::descriptor::make_read(&read)` runs before `crate::descriptor::turn_pages(...)`. When a previously taken-back page (`made[index] == key`, slot replaced by `page_nulls`, `kept` cleared) is read again in the same submission: - `make_read` first recreates the placed texture in that slot; - `turn_pages` -> `place_page` -> `remakes()` then fills `made[first..last]` with `REMAKE`, and `sync_slots` calls `mirror(..., false)` where `later = !for_draw && is_placed_texture(&view)` (`true`), overwriting placed textures back to `null_for` right after `make_read` populated them. - Notably, `view_heap_pages_taken_back_are_placed_again_when_read` (`crates/victory-gpu/src/host.rs:506-520`) invokes `turn_pages` *before* `make_read`, which masks the `Host::execute` ordering. Running `turn_pages` before `make_read` (or preserving placed textures created/kept for the current submission across `remakes`) and testing the `Host::execute` order would fix this. 2. **`needs_remake()` (`crates/victory-gpu/src/descriptor/host.rs:1067`) returns `false` for non-texture views on taken-back pages.** `take_back_pages` replaces the host page with `page_nulls` while leaving `made[index] == key`. When a taken-back page is later placed again via `remake_pages` (`descriptor.rs:212, 236, 244`) -> `sync_slots` -> `mirror(..., true)`, `needs_remake()` short-circuits when `!for_draw || !is_texture(&view)`. As a result, `View::Constant` (CBVs), buffer `View::Shader` (SRVs), and non-texture `View::Unordered` (UAVs) whose records still match `key` are skipped instead of being rebuilt into the newly placed host page. (Side note on `descriptor/pages.rs:41, 394`: under pressure `PRESSED_AGE_SUBMISSIONS = 32` evicts pages unused for 32 submissions regardless of `MIN_AGE = 10s`, so any long-lived descriptor not re-bound/stamped every frame can still churn if the heap stays near `LOW_WATER`.) AI-assisted; synthetic tests only, no game files.
A page placed again has its slots made from the title's records at the
next heap sync or page turn. That remake now leaves the slots made since
the page was placed: a placed texture made for a read (make_read runs
before turn_pages after a submission) or for a draw was nulled again by
it, so the texture read null one more submission. A view made where its
page found no room went to the scratch page and was held as if made; its
slot now holds nothing, so the remake makes it once the page is placed.

A draw binding a slot of a page taken back places the page at once, for
every kind of view: constant buffers and buffer views were left null for
that submission (only textures placed the page), the page placed again
after it from the shaders' read marks.

Taking a page back forgets the read marks of its slots, and marks
forgotten since the last submission are cleared before the next one
runs instead of after it. A placed texture's slot read again after its
page was taken back was taken as read only two submissions later: its
mark was still seen, and the forget queued by the remake cleared the
next submission's mark. It now reads null in one submission and is made
for the next. Evicted textures read again gain the same submission.

A paged heap without its page of null views (its creation failed) takes
no page back: the host pages it gave back were not cleared.

Tests: the remake in Host::execute's order and through Host::execute
itself, buffer views of a page taken back made again on a read and
placed by a draw, a view written with no room made when its page is
placed.

Found in review by @nathanbzrr (the remake after make_read, buffer
views on a draw) and @pickles976 (the read marks, the null page).
Author
Owner

@⁠pickles976 on GitHub · 2026-11-26 08:13 UTC · original

Wine/NVIDIA offscreen verification:19 owner checks pass; reclamation recovery probe fails

Exact production head c23f70853f3c9887642b0345b127aa08498eef14, reference checkout VIctory-pr2121. Linux6.17, Wine11.0, RTX4060 Laptop8GiB, NVIDIA590.48.1, DXVK3.1.1. Diagnostic-relaxed vkd3d-proton3.2.0 2576c0b4adfae4a+: assertions disabled and allocator/list vtable identity checks removed, null checks retained. Not stock-runtime certification. Rust1.98.1 Windows-MSVC target, one test thread,9GiB/512MiB scope, bounded180s gate/120s probe deadlines.

VICTORY_VIEW_PAGES and VICTORY_VIEW_PAGES_KEEP unset: automatic paging on this capped NVIDIA host. Local changes: selected test skip guards made fail-closed, plus the isolated synthetic probe below; production code unchanged. Shared build freshness verified with explicit compilation from this checkout.

Gate Passed Time(s)
descriptor::pages::tests 11 0.01
paged heap cap 1 0.74
dynamic-slot accounting 1 0.60
owner take-back/remake fixture 1 0.63
paged_view_heap shader dispatch/readback pair 2 1.44
shared tables and stable copy views 1 0.69
submission-miss/write retention 1 0.64
paged null-buffer readback 1 1.16

Fresh GPU builds9.42s/8.87s and shader test builds5.95s/5.99s. No skipped device accepted in the selected hardware gates. DXGI explicitly reports WARP not supported, returning first hardware adapter, so the WARP-labelled passes are not independent software coverage. Logs: verify-pr2121-paging-gates.log, verify-pr2121-paging-dispatch.log under .compat-runtime/logs/.

Reproduced: three null submissions, not one

A local memory::tests::a_reclaimed_texture_returns_after_one_missed_submission probe uses synthetic cs_5_1 HLSL, a real placed RGBA8 texture, the production page table, real GPU-written slot/page feedback, HostList::defer_heap, and the normal Host::execute completion path. It does not inject feedback from the CPU or drain take_reads between submissions.

  1. Place texel [17,34,51,255] at logical slot44325 (page173, offset37); mark its texture used for the normal upload path.
  2. Two actual GPU readbacks return that texel, establishing the slot-read state.
  3. With the GPU idle, force the owner's reclaim policy by raising the water marks and advancing400 synthetic policy ticks/time increments. This is not400 real seconds of title execution. Confirm page-table entry0 and slot no longer kept.
  4. Restore ordinary low water marks and submit the same shader four times, without CPU feedback edits.

Observed GPU readbacks:

[[0,0,0,0], [0,0,0,0], [0,0,0,0], [17,34,51,255]]

Expected under the documented one-submission miss: the second post-reclaim read returns the texel. The assertion fails: left:[0,0,0,0], right:[17,34,51,255]. 0passed/1failed,0.70s, fresh5.78s compile. Log verify-pr2121-texture-recovery-uploaded.log. An earlier probe omitted normal heap upload tracking and failed its pre-reclaim control; that result is not counted as a reclamation defect.

Code path consistent with this readback: HostHeap::take_back_pages drops the texture without invalidating its already-seen slot read. On the first miss, Host::execute consumes slot reads before turn_pages; restoration leaves the placed texture lazy and queues forget_read. The next completion drains that queued forget and clears the new GPU bit; only another submission gets a fresh slot-read event. The existing owner lifecycle fixture manually drains take_reads before injecting its next slot mark, so it misses this order.

Separate allocation-failure hazard (source inspection, not fault-injection tested)

page_nulls creation at descriptor/host.rs:312-329 is fallible. take_back_pages skips its clearing copy when that option is absent (950-960) but still returns the physical pages to Pages::free (963). Pages::place_at reuses them (289-306); a never-before-placed logical page is not queued for a whole-page remake. [INFERENCE] Untouched offsets can retain old resource descriptors instead of nulls. Reclamation should not release an uncleared page for reuse. I did not manufacture memory exhaustion to test this branch.

No title run, world-entry, FPS or full-suite claim for this PR. Both concerns are in the take-back path; the owner-provided diagnostics VICTORY_VIEW_PAGES_KEEP=1 avoids that path by construction, but its runtime control is not yet verified here. Do not interpret the19 passing gates as reclamation correctness certification.

AI use: omp, harness model openai-codex/gpt-6-astra, ran the checks and drafted this report. No upstream code changes or assets attached.

**@⁠pickles976** on GitHub · 2026-11-26 08:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7186341334) ## Wine/NVIDIA offscreen verification:19 owner checks pass; reclamation recovery probe fails Exact production head `c23f70853f3c9887642b0345b127aa08498eef14`, reference checkout `VIctory-pr2121`. Linux6.17, Wine11.0, RTX4060 Laptop8GiB, NVIDIA590.48.1, DXVK3.1.1. **Diagnostic-relaxed vkd3d-proton3.2.0 `2576c0b4adfae4a+`: assertions disabled and allocator/list vtable identity checks removed, null checks retained. Not stock-runtime certification.** Rust1.98.1 Windows-MSVC target, one test thread,9GiB/512MiB scope, bounded180s gate/120s probe deadlines. `VICTORY_VIEW_PAGES` and `VICTORY_VIEW_PAGES_KEEP` unset: automatic paging on this capped NVIDIA host. Local changes: selected test skip guards made fail-closed, plus the isolated synthetic probe below; production code unchanged. Shared build freshness verified with explicit compilation from this checkout. | Gate | Passed | Time(s) | |---|---:|---:| | `descriptor::pages::tests` |11|0.01| | paged heap cap |1|0.74| | dynamic-slot accounting |1|0.60| | owner take-back/remake fixture |1|0.63| | `paged_view_heap` shader dispatch/readback pair |2|1.44| | shared tables and stable copy views |1|0.69| | submission-miss/write retention |1|0.64| | paged null-buffer readback |1|1.16| Fresh GPU builds9.42s/8.87s and shader test builds5.95s/5.99s. No skipped device accepted in the selected hardware gates. DXGI explicitly reports `WARP not supported, returning first hardware adapter`, so the WARP-labelled passes are **not** independent software coverage. Logs: `verify-pr2121-paging-gates.log`, `verify-pr2121-paging-dispatch.log` under `.compat-runtime/logs/`. ### Reproduced: three null submissions, not one A local `memory::tests::a_reclaimed_texture_returns_after_one_missed_submission` probe uses synthetic cs_5_1 HLSL, a real placed RGBA8 texture, the production page table, real GPU-written slot/page feedback, `HostList::defer_heap`, and the normal `Host::execute` completion path. It does not inject feedback from the CPU or drain `take_reads` between submissions. 1. Place texel `[17,34,51,255]` at logical slot44325 (page173, offset37); mark its texture used for the normal upload path. 2. Two actual GPU readbacks return that texel, establishing the slot-read state. 3. With the GPU idle, force the owner's reclaim policy by raising the water marks and advancing400 synthetic policy ticks/time increments. This is **not**400 real seconds of title execution. Confirm page-table entry0 and slot no longer kept. 4. Restore ordinary low water marks and submit the same shader four times, without CPU feedback edits. Observed GPU readbacks: ``` [[0,0,0,0], [0,0,0,0], [0,0,0,0], [17,34,51,255]] ``` Expected under the documented one-submission miss: the second post-reclaim read returns the texel. The assertion fails: `left:[0,0,0,0]`, `right:[17,34,51,255]`. **0passed/1failed,0.70s**, fresh5.78s compile. Log `verify-pr2121-texture-recovery-uploaded.log`. An earlier probe omitted normal heap upload tracking and failed its pre-reclaim control; that result is not counted as a reclamation defect. Code path consistent with this readback: `HostHeap::take_back_pages` drops the texture without invalidating its already-seen slot read. On the first miss, `Host::execute` consumes slot reads before `turn_pages`; restoration leaves the placed texture lazy and queues `forget_read`. The next completion drains that queued forget and clears the new GPU bit; only another submission gets a fresh slot-read event. The existing owner lifecycle fixture manually drains `take_reads` before injecting its next slot mark, so it misses this order. ### Separate allocation-failure hazard (source inspection, not fault-injection tested) `page_nulls` creation at `descriptor/host.rs:312-329` is fallible. `take_back_pages` skips its clearing copy when that option is absent (`950-960`) but still returns the physical pages to `Pages::free` (`963`). `Pages::place_at` reuses them (`289-306`); a never-before-placed logical page is not queued for a whole-page remake. **[INFERENCE]** Untouched offsets can retain old resource descriptors instead of nulls. Reclamation should not release an uncleared page for reuse. I did not manufacture memory exhaustion to test this branch. No title run, world-entry, FPS or full-suite claim for this PR. Both concerns are in the take-back path; the owner-provided diagnostics `VICTORY_VIEW_PAGES_KEEP=1` avoids that path by construction, but its runtime control is not yet verified here. Do not interpret the19 passing gates as reclamation correctness certification. AI use: omp, harness model `openai-codex/gpt-6-astra`, ran the checks and drafted this report. No upstream code changes or assets attached.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 08:31 UTC · original

Thanks @⁠nathanbzrr and @⁠pickles976. All four are addressed in fedb38d (head of gpu/view-heap-pages), each with a test that failed before it, except where noted.

1. make_read before turn_pages nulls the texture it just made (@⁠nathanbzrr). Real. make_read's mirror(.., true) placed the page and made the texture, then turn_pages -> remakes() filled the whole page with REMAKE, and sync_slots -> mirror(.., false) nulled the placed texture again. A draw that placed a page while recording hit the same thing in the heap sync before the submission. I kept the order and changed remakes() instead: it marks only slots that hold no view. A slot made since the page was placed keeps its view, so both orders work. A view written to the scratch page (no room for its page) used to be kept as if made, so it now holds nothing and is still remade. Tests: host::tests::view_heap_pages_placed_by_a_read_keep_the_texture_made_for_it (make_read then turn_pages, as in Host::execute; failed before) and draw::tests::a_placed_texture_in_a_page_taken_back_is_made_after_one_submission_reads_it (through Host::execute itself).

2. needs_remake() skips non-texture views on taken-back pages (@⁠nathanbzrr). The path you describe doesn't happen. remake_pages calls remakes() before sync_slots, and that fills made[first..last] with REMAKE (descriptor/host.rs, remakes). So made[index] != key and mirror rebuilds the slot without consulting needs_remake; sync_slots also passes for_draw = false. The new test confirms it: a CBV, a buffer SRV and a buffer UAV in a page taken back are all made again when a read mark places the page, and that part passed before the fix. The gap is in the draw path. table_entry -> mirror(.., true) on a CBV or buffer view in a page taken back returned early (made == key, not a texture), so the page stayed unplaced and the draw read null until the read marks placed it after the submission. Only textures placed it at once. Now a draw binding any slot of a taken-back page places it, and the heap sync makes its slots before the submission. Test: host::tests::view_heap_pages_taken_back_make_their_buffer_views_again (the draw step failed before, "placed again for the draw").

A. Placed texture back after three null submissions (@⁠pickles976). Real, and the same mechanism you describe. take_back_pages left the slot's read "seen", so the first read after take-back wasn't taken. The remake then queued forget_read, and take_reads cleared the forgotten marks after the next submission had run, which erased that submission's read too. Now taking a page back forgets its slots' read marks, and Host::execute clears forgotten marks before the submission runs (shadow::forget_reads_now), not after. The draw test above runs your sequence: read twice, take back, then four submissions through Host::execute, with a compute shader setting the slot and page read bits on the GPU and no draining between them. Whether the slot holds its texture after each: [false, false, true, true] before, [true, true, true, true] after. So only the first submission after the take-back reads null. Evicted textures that are read again get the same one-submission gain.

B. page_nulls creation failing (@⁠pickles976). Real on inspection. Without the null page, take_back_pages skipped the clear but still put the host pages on the free list. It now returns early when page_nulls (or the host) is missing, so such a heap takes nothing back and refuses writes past the free pages, as before take-back existed. No test: a CPU-only 256-descriptor heap can't be made to fail here.

Side note (32 submissions). PRESSED_AGE_SUBMISSIONS applies only on the first pass after a write found no free host page (pressed is set by the refused write and cleared by that pass). Without a refusal only the strict ages apply (300 submissions and 10 s). For an A/B, VICTORY_VIEW_PAGES_KEEP=1 (diagnostics builds) turns take-back off.

Tests (RTX 5070 Ti, which pages): cargo test -p victory-gpu --lib 250 passed, 0 failed. 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 failed, and both fail at c23f708 too. Clippy with and without diagnostics: 0 warnings. cargo xtask policy ok.

@⁠bittertea0323: the draw-path gap in point 2 fits what you saw in the world. A draw binding a constant buffer or buffer view in a page that had been taken back read null until a later submission placed the page; only textures placed it at once. With take-back running inside the frame loop, that leaves a lot of a frame reading null. If you can, rerun fedb38d to the caption card with defaults, and once with VICTORY_VIEW_PAGES_KEEP=1 for comparison.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 08:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7186693496) Thanks @⁠nathanbzrr and @⁠pickles976. All four are addressed in fedb38d (head of `gpu/view-heap-pages`), each with a test that failed before it, except where noted. **1. `make_read` before `turn_pages` nulls the texture it just made (@⁠nathanbzrr).** Real. `make_read`'s `mirror(.., true)` placed the page and made the texture, then `turn_pages` -> `remakes()` filled the whole page with `REMAKE`, and `sync_slots` -> `mirror(.., false)` nulled the placed texture again. A draw that placed a page while recording hit the same thing in the heap sync before the submission. I kept the order and changed `remakes()` instead: it marks only slots that hold no view. A slot made since the page was placed keeps its view, so both orders work. A view written to the scratch page (no room for its page) used to be kept as if made, so it now holds nothing and is still remade. Tests: `host::tests::view_heap_pages_placed_by_a_read_keep_the_texture_made_for_it` (`make_read` then `turn_pages`, as in `Host::execute`; failed before) and `draw::tests::a_placed_texture_in_a_page_taken_back_is_made_after_one_submission_reads_it` (through `Host::execute` itself). **2. `needs_remake()` skips non-texture views on taken-back pages (@⁠nathanbzrr).** The path you describe doesn't happen. `remake_pages` calls `remakes()` before `sync_slots`, and that fills `made[first..last]` with `REMAKE` (`descriptor/host.rs`, `remakes`). So `made[index] != key` and `mirror` rebuilds the slot without consulting `needs_remake`; `sync_slots` also passes `for_draw = false`. The new test confirms it: a CBV, a buffer SRV and a buffer UAV in a page taken back are all made again when a read mark places the page, and that part passed before the fix. The gap is in the draw path. `table_entry` -> `mirror(.., true)` on a CBV or buffer view in a page taken back returned early (`made == key`, not a texture), so the page stayed unplaced and the draw read null until the read marks placed it after the submission. Only textures placed it at once. Now a draw binding any slot of a taken-back page places it, and the heap sync makes its slots before the submission. Test: `host::tests::view_heap_pages_taken_back_make_their_buffer_views_again` (the draw step failed before, "placed again for the draw"). **A. Placed texture back after three null submissions (@⁠pickles976).** Real, and the same mechanism you describe. `take_back_pages` left the slot's read "seen", so the first read after take-back wasn't taken. The remake then queued `forget_read`, and `take_reads` cleared the forgotten marks after the next submission had run, which erased that submission's read too. Now taking a page back forgets its slots' read marks, and `Host::execute` clears forgotten marks before the submission runs (`shadow::forget_reads_now`), not after. The draw test above runs your sequence: read twice, take back, then four submissions through `Host::execute`, with a compute shader setting the slot and page read bits on the GPU and no draining between them. Whether the slot holds its texture after each: `[false, false, true, true]` before, `[true, true, true, true]` after. So only the first submission after the take-back reads null. Evicted textures that are read again get the same one-submission gain. **B. `page_nulls` creation failing (@⁠pickles976).** Real on inspection. Without the null page, `take_back_pages` skipped the clear but still put the host pages on the free list. It now returns early when `page_nulls` (or the host) is missing, so such a heap takes nothing back and refuses writes past the free pages, as before take-back existed. No test: a CPU-only 256-descriptor heap can't be made to fail here. **Side note (32 submissions).** `PRESSED_AGE_SUBMISSIONS` applies only on the first pass after a write found no free host page (`pressed` is set by the refused write and cleared by that pass). Without a refusal only the strict ages apply (300 submissions and 10 s). For an A/B, `VICTORY_VIEW_PAGES_KEEP=1` (diagnostics builds) turns take-back off. Tests (RTX 5070 Ti, which pages): `cargo test -p victory-gpu --lib` 250 passed, 0 failed. 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` failed, and both fail at c23f708 too. Clippy with and without diagnostics: 0 warnings. `cargo xtask policy` ok. @⁠bittertea0323: the draw-path gap in point 2 fits what you saw in the world. A draw binding a constant buffer or buffer view in a page that had been taken back read null until a later submission placed the page; only textures placed it at once. With take-back running inside the frame loop, that leaves a lot of a frame reading null. If you can, rerun fedb38d to the caption card with defaults, and once with `VICTORY_VIEW_PAGES_KEEP=1` for comparison.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-26 08:32 UTC · original

I checked both points in the review of c23f7085 on Windows with an RTX 4090 Laptop and WARP.

Placed texture. In both directions of A → B → A on physical slot 66311 (4090), the original placed SRV read transparent black on three consecutive GPU submissions and green on the fourth. The neighboring committed SRV was already yellow on the second. This matches the 4060 Laptop result. The earlier round trip I reported here used ordinary committed SRVs and did not exercise this path.

Author-branch fix #8 gets the placed texture back on the second submission on both adapters, including after a demand made while no page was free. Simply moving page restoration ahead of view creation still left the returning A black until the fourth demand. A third, unread placed slot stayed lazy throughout. Failing fixture · Passing fixture.

Buffers. Once the page is placed again, the remake pass rebuilds all three physical buffer slots. The author-branch regression #7 reads separate CBV/SRV values and writes them with a per-dispatch tag through the UAV. A and B got their own data on all three legs and the guard word stayed intact. With the page-wide REMAKE fill removed the test went red before dispatch 3 on both devices. This fixture supplies a page mark explicitly. Separately, the existing translated compute test passed and observed GPU page marks for both its table UAV and direct SRV.

These are synthetic readbacks. The 4070 SUPER default vs. VICTORY_VIEW_PAGES_KEEP=1 caption-card comparison is still open.

**@⁠passerbyyhx** on GitHub · 2026-11-26 08:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7186714692) I checked both points in [the review of `c23f7085`](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2121) on Windows with an RTX 4090 Laptop and WARP. **Placed texture.** In both directions of A → B → A on physical slot 66311 (4090), the original placed SRV read transparent black on three consecutive GPU submissions and green on the fourth. The neighboring committed SRV was already yellow on the second. This matches the [4060 Laptop result](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2121). The earlier round trip I reported here used ordinary committed SRVs and did not exercise this path. [Author-branch fix #8](https://github.com/0xkn0wh3r3/VIctory/pull/8) gets the placed texture back on the second submission on both adapters, including after a demand made while no page was free. Simply moving page restoration ahead of view creation still left the returning A black until the fourth demand. A third, unread placed slot stayed lazy throughout. [Failing fixture](https://github.com/passerbyyhx/VIctory/commit/74155825f2bcfc8f19f92095eb310a9628231aeb) · [Passing fixture](https://github.com/passerbyyhx/VIctory/commit/011fd9634fd4fbc30ccc52bbee1ea7ec46f52dc2). **Buffers.** Once the page is placed again, the remake pass rebuilds all three physical buffer slots. The [author-branch regression #7](https://github.com/0xkn0wh3r3/VIctory/pull/7) reads separate CBV/SRV values and writes them with a per-dispatch tag through the UAV. A and B got their own data on all three legs and the guard word stayed intact. With the page-wide `REMAKE` fill removed the test went red before dispatch 3 on both devices. This fixture supplies a page mark explicitly. Separately, the existing [translated compute test](https://github.com/0xkn0wh3r3/VIctory/blob/c23f70853f3c9887642b0345b127aa08498eef14/crates/victory-shader/src/emit/stride_tests.rs#L426) passed and observed GPU page marks for both its table UAV and direct SRV. These are synthetic readbacks. The 4070 SUPER default vs. `VICTORY_VIEW_PAGES_KEEP=1` caption-card comparison is still open.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 08:33 UTC · original

Thanks, that matches what fedb38d fixes. Your readings were against c23f708, before it. Both points are covered there with this repo's own tests:

  • Placed texture back after three submissions. Taking a page back now forgets its slots' read marks, and Host::execute clears forgotten marks before the submission instead of after. remakes() also leaves slots made since the page was placed alone. draw::tests::a_placed_texture_in_a_page_taken_back_is_made_after_one_submission_reads_it drives Host::execute with GPU-set read bits: [false, false, true, true] before the fix, all true after.
  • Buffers. The remake pass rebuilds them once the page is placed, as you saw. The gap was a draw binding a CBV or buffer view in a taken-back page, which didn't place the page until later. That's fixed and covered by host::tests::view_heap_pages_taken_back_make_their_buffer_views_again.

I wrote the fix separately, so the fork PRs aren't needed for this. A rerun of your fixtures against fedb38d would confirm it on the 4090 and WARP.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 08:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7186745707) Thanks, that matches what fedb38d fixes. Your readings were against c23f708, before it. Both points are covered there with this repo's own tests: - **Placed texture back after three submissions.** Taking a page back now forgets its slots' read marks, and `Host::execute` clears forgotten marks before the submission instead of after. `remakes()` also leaves slots made since the page was placed alone. `draw::tests::a_placed_texture_in_a_page_taken_back_is_made_after_one_submission_reads_it` drives `Host::execute` with GPU-set read bits: `[false, false, true, true]` before the fix, all `true` after. - **Buffers.** The remake pass rebuilds them once the page is placed, as you saw. The gap was a draw binding a CBV or buffer view in a taken-back page, which didn't place the page until later. That's fixed and covered by `host::tests::view_heap_pages_taken_back_make_their_buffer_views_again`. I wrote the fix separately, so the fork PRs aren't needed for this. A rerun of your fixtures against fedb38d would confirm it on the 4090 and WARP.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-26 08:47 UTC · original

I reran the fixtures on fedb38db as requested, on the RTX 4090 Laptop (native paging) and Microsoft WARP (forced paging). Your three new tests passed on both. Our CBV/SRV/UAV physical readback also passed on both, and I closed fork PR #7.

One full-heap case remains. With no physical page free before the demand, A → B → A reused slot 66311. In both directions the placed SRV returned black, black, green, green. The committed neighbor returned black, yellow, yellow, yellow, and the third, unread placed slot stayed lazy. After D1 the page was mapped but only the committed view was held. After D2 both were held. With A resident from the outset, the placed view already read green on D2. These are successive GPU pixel readbacks, including the distinct case where B had previously been sampled while no page was free and its title record was never rewritten.

On the same fixtures, moving make_read after turn_pages fixed the freshly written B and returning A, but the B that had already been sampled with no space still needed D3. Re-arming that one mark when a placed texture had gone to scratch recovered B on D2 as well. The results per adapter were 0/2 on fedb38db, 1/2 with just the reorder, 2/2 with both changes. Unchanged production plus fixtures · Passing fixtures.

The standalone two-file follow-up applies directly on top of your fix. I updated the existing fork PR #8 to contain just that diff. This synthetic test does not establish what happens at the 4070 SUPER caption card.

**@⁠passerbyyhx** on GitHub · 2026-11-26 08:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7187032759) I reran the fixtures on `fedb38db` as requested, on the RTX 4090 Laptop (native paging) and Microsoft WARP (forced paging). Your three new tests passed on both. Our CBV/SRV/UAV physical readback also passed on both, and I closed [fork PR #7](https://github.com/0xkn0wh3r3/VIctory/pull/7). One full-heap case remains. With no physical page free before the demand, A → B → A reused slot 66311. In both directions the placed SRV returned **black, black, green, green**. The committed neighbor returned **black, yellow, yellow, yellow**, and the third, unread placed slot stayed lazy. After D1 the page was mapped but only the committed view was held. After D2 both were held. With A resident from the outset, the placed view already read green on D2. These are successive GPU pixel readbacks, including the distinct case where B had previously been sampled while no page was free and its title record was never rewritten. On the same fixtures, moving `make_read` after `turn_pages` fixed the freshly written B and returning A, but the B that had already been sampled with no space still needed D3. Re-arming that one mark when a placed texture had gone to scratch recovered B on D2 as well. The results per adapter were **0/2 on fedb38db, 1/2 with just the reorder, 2/2 with both changes**. [Unchanged production plus fixtures](https://github.com/passerbyyhx/VIctory/commit/665397355ad28d020758fc74181225602df0098e) · [Passing fixtures](https://github.com/passerbyyhx/VIctory/commit/2b669e9595493639691e2b06a0046d3dbdfed27d). The [standalone two-file follow-up](https://github.com/passerbyyhx/VIctory/commit/bb51742cd5fa5275fce526ba99b0207c4dafa26b) applies directly on top of your fix. I updated [the existing fork PR #8](https://github.com/0xkn0wh3r3/VIctory/pull/8) to contain just that diff. This synthetic test does not establish what happens at the 4070 SUPER caption card.
With no host page free, a placed texture read in a page taken back was
made after the submission before any page was taken back for it: its
view went to the scratch page, and the page placed just after had the
slot made lazily again, so the texture read null for one more
submission than the page's other views. Pages are now turned before the
views read are made (the read marks are taken first), so those views are
made in the pages placed for them.

A page read again with no host page free presses the next pass of take
back as a write refused room does, so a page unused lately is taken back
for it in the same pass. Only the placed texture's refused write pressed
it before.

A placed texture whose view goes to the scratch page has its read mark
forgotten, so its next read is taken: one read while no page was free
was taken once, and the slot was left null when its page was placed.

Read marks forgotten are kept for the eviction pass's window of slots
read: marks are by slot for every heap, and a page taken back in one
heap cleared another heap's read of the same slot, whose texture could
then be given up as unused.

Tests: through Host::execute with no host page free, a placed texture
read in a page taken back (its host page given to another page since)
and one read earlier with no room are made after the first submission,
as a buffer view in the page is; a page read again with no room presses
the next pass; two heaps with records at one slot keep the second's
read for eviction when the first takes its page back.

Found in review by @passerbyyhx (the full heap, the eviction window).
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-26 09:10 UTC · original

Two additional controls distinguish descriptor restoration from a late texture upload in the full-heap result above. On unchanged fedb38db, three outputs in the same D2 submission were black through the recovering slot, yellow through its ordinary neighbor, and green through a permanently resident alias of the very same placed texture. In a separate run without the alias, I changed the title texel from green to blue while A was unmapped, without rewriting its descriptor. The upload count advanced on D1 on both versions. A returned black, black, blue, blue on the author head and black, blue, blue, blue with the two-file follow-up. RTX 4090 Laptop and WARP agreed, with and without the early no-space demand. Reproducible alias and changed-texel controls.

We also found a separate change in the eviction read window. H2 sampled yellow through slot 561 and still held that live resource. If H1 retired a page containing its own record at 561, fedb38db returned only slot 7 for the window. If H1 lacked that record or retired a different page, the result was [7, 561]. On c23f7085, and with the single-file window fix, all three cases returned [7, 561] and the H2 resource. This checks the input to the eviction decision. Actual eviction and game impact were not measured.

Combining the two follow-ups in one binary passed both placed-texture cases and the independent two-heap case on each adapter (3/3 on each).

**@⁠passerbyyhx** on GitHub · 2026-11-26 09:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7187536324) Two additional controls distinguish descriptor restoration from a late texture upload in [the full-heap result above](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2121). On unchanged `fedb38db`, three outputs in the **same D2 submission** were black through the recovering slot, yellow through its ordinary neighbor, and green through a permanently resident alias of the very same placed texture. In a separate run without the alias, I changed the title texel from green to blue while A was unmapped, without rewriting its descriptor. The upload count advanced on D1 on both versions. A returned **black, black, blue, blue** on the author head and **black, blue, blue, blue** with the [two-file follow-up](https://github.com/passerbyyhx/VIctory/commit/bb51742cd5fa5275fce526ba99b0207c4dafa26b). RTX 4090 Laptop and WARP agreed, with and without the early no-space demand. [Reproducible alias and changed-texel controls](https://github.com/passerbyyhx/VIctory/commit/fea316e577b848a19e266ba0fa96b85bb48a46cd). We also found a separate change in the eviction read window. H2 sampled yellow through slot 561 and still held that live resource. If H1 retired a page containing its own record at 561, `fedb38db` returned only slot 7 for the window. If H1 lacked that record or retired a different page, the result was `[7, 561]`. On `c23f7085`, and with [the single-file window fix](https://github.com/0xkn0wh3r3/VIctory/pull/9), all three cases returned `[7, 561]` and the H2 resource. This checks the input to the eviction decision. Actual eviction and game impact were not measured. Combining the two follow-ups in one binary passed both placed-texture cases and the independent two-heap case on each adapter (3/3 on each).
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 09:17 UTC · original

@⁠passerbyyhx thanks for the full-heap case and the eviction-window regression, both are fixed in 0bc5edb. We wrote the fix and the tests ourselves rather than taking your fork PRs (0xkn0wh3r3/VIctory#8 and #9), so those can be closed.

Full heap. The cause was as you found: make_read ran before turn_pages, so with no page free the texture went to the scratch page, and the remake of the page placed right after left it lazy again. Three changes:

  • Host::execute now takes the read marks, turns pages, then makes the views read. That's safe since fedb38d, because the remake leaves made slots alone.
  • A page read again with no host page free now presses the next take-back pass, as a refused write does. Without this, after the reorder nothing pressed in the same pass and the page was placed a submission later.
  • A placed texture whose view goes to the scratch page has its read mark forgotten, so its next read is taken (your sampled-while-full B).

Tests run through Host::execute. Each of D1..D4 is a submission whose compute shader sets the slot and page read bits; the value is whether the slot holds its view after each submission, so true after D1 means it reads correctly from D2:

  • Returning A, with page 2 taken back for it into the same host page. (A, buffer view in the page), fedb38d: (false, true), (true, true), (true, true), (true, true). Now: (true, true) x4. A placed texture in the page that no shader reads stays unmade.
  • B read earlier with no room. fedb38d: false, false, false, false; in this test nothing else asks for room, so the page is never placed. With only the reorder and the read pressure: false, true, true, true. Now: true x4.

Eviction window. Read marks are one bit per slot for every heap, so a take-back in H1 cleared H2's read of the same slot. Marks are still forgotten at take-back, which keeps the one-submission recovery. Any set bit that a forget clears is now kept for reads_since, so it still counts as a read for eviction. This applies to every forget path, not just take-back. draw::tests::a_page_taken_back_keeps_another_heaps_read_of_its_slot_for_eviction uses two paged heaps with placed textures at the same slot, marks the second heap's read and slot 7's, then has the first heap take its page back. reads_since returns [7] at fedb38d and both slots now, and it names the second heap's texture.

cargo test -p victory-gpu --lib: 254 passed (NVIDIA, which pages view heaps). With diagnostics, only placed_uav_dispatch_writes_its_texture fails, as it does at fedb38d. Clippy both ways is clean and cargo xtask policy passes.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 09:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7187728620) @⁠passerbyyhx thanks for the full-heap case and the eviction-window regression, both are fixed in 0bc5edb. We wrote the fix and the tests ourselves rather than taking your fork PRs (0xkn0wh3r3/VIctory#8 and #9), so those can be closed. **Full heap.** The cause was as you found: `make_read` ran before `turn_pages`, so with no page free the texture went to the scratch page, and the remake of the page placed right after left it lazy again. Three changes: - `Host::execute` now takes the read marks, turns pages, then makes the views read. That's safe since fedb38d, because the remake leaves made slots alone. - A page read again with no host page free now presses the next take-back pass, as a refused write does. Without this, after the reorder nothing pressed in the same pass and the page was placed a submission later. - A placed texture whose view goes to the scratch page has its read mark forgotten, so its next read is taken (your sampled-while-full B). Tests run through `Host::execute`. Each of D1..D4 is a submission whose compute shader sets the slot and page read bits; the value is whether the slot holds its view after each submission, so `true` after D1 means it reads correctly from D2: - Returning A, with page 2 taken back for it into the same host page. (A, buffer view in the page), fedb38d: `(false, true), (true, true), (true, true), (true, true)`. Now: `(true, true)` x4. A placed texture in the page that no shader reads stays unmade. - B read earlier with no room. fedb38d: `false, false, false, false`; in this test nothing else asks for room, so the page is never placed. With only the reorder and the read pressure: `false, true, true, true`. Now: `true` x4. **Eviction window.** Read marks are one bit per slot for every heap, so a take-back in H1 cleared H2's read of the same slot. Marks are still forgotten at take-back, which keeps the one-submission recovery. Any set bit that a forget clears is now kept for `reads_since`, so it still counts as a read for eviction. This applies to every forget path, not just take-back. `draw::tests::a_page_taken_back_keeps_another_heaps_read_of_its_slot_for_eviction` uses two paged heaps with placed textures at the same slot, marks the second heap's read and slot 7's, then has the first heap take its page back. `reads_since` returns `[7]` at fedb38d and both slots now, and it names the second heap's texture. `cargo test -p victory-gpu --lib`: 254 passed (NVIDIA, which pages view heaps). With diagnostics, only `placed_uav_dispatch_writes_its_texture` fails, as it does at fedb38d. Clippy both ways is clean and `cargo xtask policy` passes.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-26 09:28 UTC · original

Thanks for fixing both cases. I verified 0bc5edbd on an RTX 4090 Laptop with native paging and Microsoft WARP with forced paging, then closed fork PRs #8 and #9 as requested.

With the physical pool full, both directions of A → B → A reused slot 66311. B returned transparent black on its first submission and green on its second. In a separate run I changed A’s texel from green to blue while its descriptor was unmapped. On the way back, A returned transparent black on its first submission and the new blue on its second, with its committed neighbor yellow. Both adapters agreed. Fresh-texel fixture.

The two-heap eviction window retained H2’s sampled slot 561 and its live owner with each of the three H1 controls, including retiring H1’s overlapping record. The second drain was empty in all three cases.

I also isolated the new read-only pressure condition by consuming the earlier refused-write signal before measuring. At age 32 a GPU demand for B still read null and left A mapped. A fresh demand at age 33 reclaimed the slot, and the following read was green. With an empty submission at 33, A stayed mapped until a fresh demand at 34. No new title descriptor writes in either measurement. Read-pressure boundary fixture.

**@⁠passerbyyhx** on GitHub · 2026-11-26 09:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7188039610) Thanks for fixing both cases. I verified `0bc5edbd` on an RTX 4090 Laptop with native paging and Microsoft WARP with forced paging, then closed fork PRs #8 and #9 as requested. With the physical pool full, both directions of A → B → A reused slot 66311. B returned transparent black on its first submission and green on its second. In a separate run I changed A’s texel from green to blue while its descriptor was unmapped. On the way back, A returned transparent black on its first submission and **the new blue on its second**, with its committed neighbor yellow. Both adapters agreed. [Fresh-texel fixture](https://github.com/passerbyyhx/VIctory/commit/fea316e577b848a19e266ba0fa96b85bb48a46cd). The two-heap eviction window retained H2’s sampled slot 561 and its live owner with each of the three H1 controls, including retiring H1’s overlapping record. The second drain was empty in all three cases. I also isolated the new read-only pressure condition by consuming the earlier refused-write signal before measuring. At age 32 a GPU demand for B still read null and left A mapped. A fresh demand at age 33 reclaimed the slot, and the following read was green. With an empty submission at 33, A stayed mapped until a fresh demand at 34. No new title descriptor writes in either measurement. [Read-pressure boundary fixture](https://github.com/passerbyyhx/VIctory/commit/c5081be1e041a0919431b1682e7e9b0f8a6e1b4c).
Author
Owner

@⁠pickles976 on GitHub · 2026-11-26 11:05 UTC · original

Re-verified on 0bc5edb (Wine 11.0/Linux 6.17, RTX 4060 Laptop 8 GB, NVIDIA 590.48.1, DXVK 3.1.1): the reclamation recovery window I reported at c23f7085 (#2121, three null submissions) is fixed. Same probe, unchanged: real placed RGBA8 texture, real GPU-written slot/page readback marks, HostList::defer_heap + the normal texture upload path, forced reclaim via set_page_water(u32::MAX, u32::MAX) + 400 idle-locked take_back_pages ticks, four submissions through Host::execute with no take_reads draining between them.

GPU texels after reclamation, c23f7085 → 0bc5edb:

[[0,0,0,0],[0,0,0,0],[0,0,0,0],[17,34,51,255]]   c23f7085: three null submissions
[[0,0,0,0],[17,34,51,255],[17,34,51,255],[17,34,51,255]]   0bc5edb: one, as documented

My local samples[1] == texel assertion — the exact condition that failed at c23f7085 — now passes 1/1 in 0.69 s after a fresh 9.01 s compile. The rest of the battery also passes: descriptor::pages::tests 12/12 (grown by one on this head), the paged-heap cap fixture (now asserting the PAGED_TITLE_VIEWS clamp), dynamic-slot accounting, your take-back/remake fixture, lists_share_a_table_and_copies_keep_their_views, the missed-submission copies pair, and the three stride_tests dispatch/readbacks — 23 checks, 0 failures, log verify-pr2121-fixed-recovery.log / verify-pr2121-fixed-gates.log (kept locally with the probe).

Your four new take-back tests (view_heap_pages_taken_back_make_their_buffer_views_again, a_placed_texture_in_a_page_taken_back_is_made_after_one_submission_reads_it, a_page_taken_back_keeps_another_heaps_read_of_its_slot_for_eviction, and the read-back remake) all pass on this host too.

Environment caveats, unchanged from the first report: locally built diagnostic-relaxed vkd3d-proton 3.2.0 (2576c0b4adfae4a+; assertions disabled, allocator/list from_iface vtable identity checks removed, null checks kept) — not stock-runtime certification; skip guards in the battery made fail-closed locally; one test thread; 9 GiB/512 MiB cgroup scope. DXGI under Wine reports "WARP not supported, returning first hardware adapter", so any WARP-labelled run here is the NVIDIA adapter, not independent software coverage. No title run, world-entry, or FPS claim for this PR; the probe and the fail-closed guard edits remain local to my checkout.

AI use: omp, harness model openai-codex/gpt-6-astra, ran the checks and drafted this report. No upstream code changes or assets attached.

**@⁠pickles976** on GitHub · 2026-11-26 11:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7190258561) Re-verified on `0bc5edb` (Wine 11.0/Linux 6.17, RTX 4060 Laptop 8 GB, NVIDIA 590.48.1, DXVK 3.1.1): the reclamation recovery window I reported at `c23f7085` (https://git.gtahub.st/github/Marvisak--VIctory/pulls/2121, three null submissions) is fixed. Same probe, unchanged: real placed RGBA8 texture, real GPU-written slot/page readback marks, `HostList::defer_heap` + the normal texture upload path, forced reclaim via `set_page_water(u32::MAX, u32::MAX)` + 400 idle-locked `take_back_pages` ticks, four submissions through `Host::execute` with no `take_reads` draining between them. GPU texels after reclamation, `c23f7085` → `0bc5edb`: ``` [[0,0,0,0],[0,0,0,0],[0,0,0,0],[17,34,51,255]] c23f7085: three null submissions [[0,0,0,0],[17,34,51,255],[17,34,51,255],[17,34,51,255]] 0bc5edb: one, as documented ``` My local `samples[1] == texel` assertion — the exact condition that failed at `c23f7085` — now passes 1/1 in 0.69 s after a fresh 9.01 s compile. The rest of the battery also passes: `descriptor::pages::tests` 12/12 (grown by one on this head), the paged-heap cap fixture (now asserting the `PAGED_TITLE_VIEWS` clamp), dynamic-slot accounting, your take-back/remake fixture, `lists_share_a_table_and_copies_keep_their_views`, the missed-submission copies pair, and the three `stride_tests` dispatch/readbacks — 23 checks, 0 failures, log `verify-pr2121-fixed-recovery.log` / `verify-pr2121-fixed-gates.log` (kept locally with the probe). Your four new take-back tests (`view_heap_pages_taken_back_make_their_buffer_views_again`, `a_placed_texture_in_a_page_taken_back_is_made_after_one_submission_reads_it`, `a_page_taken_back_keeps_another_heaps_read_of_its_slot_for_eviction`, and the read-back remake) all pass on this host too. Environment caveats, unchanged from the first report: locally built **diagnostic-relaxed vkd3d-proton 3.2.0 (`2576c0b4adfae4a+`; assertions disabled, allocator/list `from_iface` vtable identity checks removed, null checks kept)** — not stock-runtime certification; skip guards in the battery made fail-closed locally; one test thread; 9 GiB/512 MiB cgroup scope. DXGI under Wine reports "WARP not supported, returning first hardware adapter", so any WARP-labelled run here is the NVIDIA adapter, not independent software coverage. No title run, world-entry, or FPS claim for this PR; the probe and the fail-closed guard edits remain local to my checkout. AI use: omp, harness model `openai-codex/gpt-6-astra`, ran the checks and drafted this report. No upstream code changes or assets attached.
Author
Owner

@⁠bittertea0323 on GitHub · 2026-11-26 11:30 UTC · original

## The 0.5-2 fps figure matches what I measured, and it is the number that decides between paging and capped heaps

@⁠kawaii-shakal's run on an RTX 5070 Ti (0.5-2 fps in the world, ~20 submissions a frame, this PR merged with #2821) is the third independent host that puts paging here in the same range. Mine agreed at a lower resolution and a smaller background load, so the two are comparable in kind:

host approach picture fps
RTX 4070 SUPER 12 GB, Win10 19045 this PR, paged, extra=DYNAMIC black 0.1
RTX 4070 SUPER 12 GB, Win10 19045 this PR, paged, extra=MIN_DYNAMIC black did not pass the loader
RTX 4070 SUPER 12 GB, Win10 19045 un-paged tree, capped_dynamic_slots (393,215 title / 606,784 dynamic) correct 5-7
RTX 5070 Ti, Win11 this PR + #2821 ? 0.5-2

That A/B on one machine is in this thread above and is what led me to write it up separately: the un-paged tree with the capped split draws the world at 5-7 fps on the same host, same title, same Agility opt-in, same keypresses, where the paged one draws black.

The take-back is not the only cost; the pages themselves are. With 2,880 usable pages against the 4,864 the title's 1,245,184 slots need, every frame re-places what the age rule dropped, and at 0.5-2 fps nothing the title writes reaches the age threshold before room runs out — which is exactly what @⁠kawaii-shakal saw. At 5-7 fps on my host the arithmetic is no better; the reason the capped split works is that it does not need those pages at all, because the title only ever writes 92,113 of its slots.

What I would suggest, if paging is going to continue

Measure the capped split as the control on the same host and scene, the way I did. If a paged heap cannot beat a heap that simply gives the title fewer slots, the work here is solving a problem the title does not have.

I am not asking for this PR to be closed — it fixes a real truncation, and the reclaim work in a12b972/fedb38d is careful. I am saying the comparison that decides it has not been posted in this thread yet, and on the one host where I could run both, it is not close.

Numbers only; no title content. RTX 4070 SUPER 12 GB / driver 591.74 / Windows 10.0.19045 / Ryzen 7 7800X3D / 31 GB. The write-up and the raw measurements are at https://github.com/bittertea0323/gta6-win10-notes

**@⁠bittertea0323** on GitHub · 2026-11-26 11:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7190818787) ## The 0.5-2 fps figure matches what I measured, and it is the number that decides between paging and capped heaps @⁠kawaii-shakal's run on an RTX 5070 Ti (0.5-2 fps in the world, ~20 submissions a frame, this PR merged with #2821) is the third independent host that puts paging here in the same range. Mine agreed at a lower resolution and a smaller background load, so the two are comparable in kind: | host | approach | picture | fps | |---|---|---|---:| | RTX 4070 SUPER 12 GB, Win10 19045 | this PR, paged, `extra=DYNAMIC` | **black** | 0.1 | | RTX 4070 SUPER 12 GB, Win10 19045 | this PR, paged, `extra=MIN_DYNAMIC` | black | did not pass the loader | | RTX 4070 SUPER 12 GB, Win10 19045 | un-paged tree, `capped_dynamic_slots` (393,215 title / 606,784 dynamic) | **correct** | **5-7** | | RTX 5070 Ti, Win11 | this PR + #2821 | ? | **0.5-2** | That A/B on one machine is in this thread above and is what led me to write it up separately: the un-paged tree with the capped split draws the world at 5-7 fps on the same host, same title, same Agility opt-in, same keypresses, where the paged one draws black. **The take-back is not the only cost; the pages themselves are.** With 2,880 usable pages against the 4,864 the title's 1,245,184 slots need, every frame re-places what the age rule dropped, and at 0.5-2 fps nothing the title writes reaches the age threshold before room runs out — which is exactly what @⁠kawaii-shakal saw. At 5-7 fps on my host the arithmetic is no better; the reason the capped split works is that it does not need those pages at all, because the title only ever writes 92,113 of its slots. ### What I would suggest, if paging is going to continue Measure the capped split as the control on the same host and scene, the way I did. If a paged heap cannot beat a heap that simply gives the title fewer slots, the work here is solving a problem the title does not have. I am not asking for this PR to be closed — it fixes a real truncation, and the reclaim work in `a12b972`/`fedb38d` is careful. I am saying the comparison that decides it has not been posted in this thread yet, and on the one host where I could run both, it is not close. Numbers only; no title content. RTX 4070 SUPER 12 GB / driver 591.74 / Windows 10.0.19045 / Ryzen 7 7800X3D / 31 GB. The write-up and the raw measurements are at https://github.com/bittertea0323/gta6-win10-notes
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 11:32 UTC · original

Agreed that the capped split is the control this needs, on one host and scene. Two things about the paged rows, though:

Both paged measurements predate the fixes that bear on them. Your black world was at 248e4c3. Since then, fedb38d fixed draws that bound a constant buffer or buffer view in a taken-back page: they read null until a later submission placed the page, and only textures placed it at once. 0bc5edb fixed placed textures coming back a submission late with no free page. Both happen inside the frame loop and leave parts of a frame null. @⁠kawaii-shakal's 0.5–2 fps was at 979e3a7, before the smaller dynamic range (c1d5a3a2: 3,648 title pages instead of 2,880) and before both review fixes. So none of the paged numbers in your table are from the current head.

How many slots the title writes differs between runs. Your run logged written=92113, and a 393,215-slot title region holds that. But @⁠kawaii-shakal's run on the RTX 5070 Ti logged no room left in the host view heap at 2:02 with written=684297 of=737280: 684,297 distinct title slots written by then. A capped heap drops every write past its title region; on main that's the 310,720 title slot past the host heap lines you measured. Paging keeps them as long as the live set fits. Which approach is right depends on which of those two cases the world usually is, and the 92k run alone can't settle that.

The run that would decide it, on your host and scene: 0bc5edb (or later), once with defaults and once with VICTORY_VIEW_PAGES_KEEP=1, against your capped split. Please include the host view heap pages in use ... written= lines, so we can see how many slots that scene writes. If paging at 0bc5edb still loses to the capped split there, that's a clear result, and I'd rather know it.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 11:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2121#issuecomment-7190849947) Agreed that the capped split is the control this needs, on one host and scene. Two things about the paged rows, though: **Both paged measurements predate the fixes that bear on them.** Your black world was at `248e4c3`. Since then, fedb38d fixed draws that bound a constant buffer or buffer view in a taken-back page: they read null until a later submission placed the page, and only textures placed it at once. 0bc5edb fixed placed textures coming back a submission late with no free page. Both happen inside the frame loop and leave parts of a frame null. @⁠kawaii-shakal's 0.5–2 fps was at `979e3a7`, before the smaller dynamic range (c1d5a3a2: 3,648 title pages instead of 2,880) and before both review fixes. So none of the paged numbers in your table are from the current head. **How many slots the title writes differs between runs.** Your run logged `written=92113`, and a 393,215-slot title region holds that. But @⁠kawaii-shakal's run on the RTX 5070 Ti logged `no room left in the host view heap` at 2:02 with `written=684297 of=737280`: 684,297 distinct title slots written by then. A capped heap drops every write past its title region; on main that's the 310,720 `title slot past the host heap` lines you measured. Paging keeps them as long as the live set fits. Which approach is right depends on which of those two cases the world usually is, and the 92k run alone can't settle that. The run that would decide it, on your host and scene: 0bc5edb (or later), once with defaults and once with `VICTORY_VIEW_PAGES_KEEP=1`, against your capped split. Please include the `host view heap pages in use ... written=` lines, so we can see how many slots that scene writes. If paging at 0bc5edb still loses to the capped split there, that's a clear result, and I'd rather know it.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2121/head:github-bot/gh-2121'
git switch 'github-bot/gh-2121'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2121'
git switch 'github-bot/gh-2121'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2121'
git switch 'github-bot/gh-2121'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2121'
git switch 'main'
git merge --squash 'github-bot/gh-2121'
git switch 'main'
git merge --ff-only 'github-bot/gh-2121'
git switch 'main'
git merge 'github-bot/gh-2121'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2121
No description provided.