Repository navigation
GPU: page view heaps a host caps below the slots shaders index - #2121
0xkn0wh3r3 wants to merge 16 commits into
Conversation
DenRakEiw
left a comment
There was a problem hiding this comment.
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_releasedandlists_share_a_table_and_copies_keep_their_views) onmain940d32f!cargo test -p victory-shader --lib emit::stride_tests::— 6 passed, 1 failed (directly fixesa_heap_buffer_read_where_no_buffer_view_is_reads_zeroson 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 warningscargo xtask policy— ok (183 files ok)
Huge NVIDIA/Blackwell compatibility win. Looks great!
AI-assisted (Gemini 4 Neon).
|
Independent owned texture check at One source-level failure case: the stride upload returns |
catminou4
left a comment
There was a problem hiding this comment.
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.
Ported Marvisak/VIctory#2121 (GPL-3.0-or-later), commits fb770da and 4426324. A host that refuses a view heap of every index shaders take (NVIDIA takes 1,000,000 slots; the title lays out 1,245,184 and shaders index up to HEAP_VIEWS = 2^21) now keeps the title's order in a virtual heap of 256-slot pages: - each page the title first writes is placed in the host heap and entered in a page table past the view-stride table, which shaders already bind; - translated shaders take every view heap index through that table when `Options::view_pages` is set; the cache key carries it; - draws bind the stride (and page) table of the heap they bind. Our earlier host-cap clamp is kept: `probe_view_count` still sets the non-paged clamp, and a paged heap clamps at HEAP_VIEWS before the page lookup. The test host pages its null buffer views where the device caps the heap (`Host::null_buffer_page`). Adaptation: the PR's two hardware tests assert a device exists; here they skip as every other hardware test does, because this PC has no SM 6.6 device. No game run: the page-count log lines are the check on a title.
|
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 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 A few things I checked that are not in the diff:
What I have not reviewed: the 212 lines of No game data is involved: counts from the title's own log. Written with an AI assistant. |
|
Thanks both, this is very useful. @yualk: the missing-buffer case was real. In @fiestorra: thanks for the 4090 run, and for checking the merges with #2016 and #2027. The probe's line ( |
|
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, On clean main 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 The 1,245,184-slot title heap used 1,000,000 physical slots and logged 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. |
|
On Following @iGoldenNinja's fork replay above, the same on upstream
No game data attached: counters, timings and log warnings only. AI-assisted (Claude Code). |
|
Thanks both, this is the measurement the PR needed. What I take from it:
Whether a different page size helps depends on how full the placed pages are. If most placed pages hold only a few written slots, smaller pages (64 slots) would fit far more of the title. If they're mostly full, the title really writes more than about 740k distinct descriptors, and the next step is reclaiming pages, or growing the title's share at the dynamic region's expense, not resizing them. I'd rather measure than guess. c5d33e8 adds that count: 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. |
|
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:
Separately, I compared unmodified 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. |
Offline measurement on a retail dumpResult: no count change against I merged head 40bd210 onto 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). |
|
Automated triage for the maintainers. Needs work: needs the maintainer's decision. Reviewed head
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 CI: passing. Generated by Claude Code |
|
GTX 1650 (Turing, 4 GB, driver 32.0.16.2124), diag build, Series S,
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. |
Shader tests on NVIDIA AdaI ran
So on Ada this PR fixes Offline, on the retail dump, this PR does not change the counts (posted above). AI-assisted (Claude Code). |
|
Tested the 65,536-slot dynamic region on Windows with an RTX 4090 Laptop (driver 621.14). On
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 |
|
Thanks, this checks the reuse path on c23f708 directly: the old submission keeps its colors after the take-back, the page goes back and forth on one host page, and 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. |
A/B on the same machine, same title, same Agility opt-in: the un-paged tree draws the world and the paged one draws blackI 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 buildsBoth on this host (RTX 4070 SUPER 12 GB, driver 591.74, Windows 10.0.19045), same retail title build
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 excusesThe earlier candidates are all present in both runs, so none of them can explain the difference:
What differs is exactly one thing: The strongest single line from the paged run
What I am not claimingI 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 ( What would settle itRaising 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 Environment and method as in my earlier comments. Counts and log lines only; no title content, assets or shader bytes in this report. |
|
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, c23f708, which is past the
So the run that would settle it is c23f708 to the caption card, once with defaults and once with |
nathanbzrr
left a comment
There was a problem hiding this comment.
Reviewed c23f708 on Windows 11 (AMD Radeon RX 7600 + D3D12 Debug + WARP):
cargo run -p xtask --locked -- policy:192 files okcargo clippy -p victory-gpu --all-targets --locked -- -D warnings(default &--all-features): cleancargo test -p victory-gpu --lib --locked descriptor -- --test-threads=1(RX 7600):36 passed; 0 failedVICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --lib --locked descriptor -- --test-threads=1(RX 7600 + Debug):36 passed; 0 failedVICTORY_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:
Host::execute(crates/victory-gpu/src/host.rs:1466-1472) runsmake_readbeforeturn_pages, lettingremakes()null out newly recreated placed textures.
InHost::execute,crate::descriptor::make_read(&read)runs beforecrate::descriptor::turn_pages(...). When a previously taken-back page (made[index] == key, slot replaced bypage_nulls,keptcleared) is read again in the same submission:make_readfirst recreates the placed texture in that slot;turn_pages->place_page->remakes()then fillsmade[first..last]withREMAKE, andsync_slotscallsmirror(..., false)wherelater = !for_draw && is_placed_texture(&view)(true), overwriting placed textures back tonull_forright aftermake_readpopulated them.- Notably,
view_heap_pages_taken_back_are_placed_again_when_read(crates/victory-gpu/src/host.rs:506-520) invokesturn_pagesbeforemake_read, which masks theHost::executeordering. Runningturn_pagesbeforemake_read(or preserving placed textures created/kept for the current submission acrossremakes) and testing theHost::executeorder would fix this.
needs_remake()(crates/victory-gpu/src/descriptor/host.rs:1067) returnsfalsefor non-texture views on taken-back pages.
take_back_pagesreplaces the host page withpage_nullswhile leavingmade[index] == key. When a taken-back page is later placed again viaremake_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), bufferView::Shader(SRVs), and non-textureView::Unordered(UAVs) whose records still matchkeyare 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.
Wine/NVIDIA offscreen verification:19 owner checks pass; reclamation recovery probe failsExact production head
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 Reproduced: three null submissions, not oneA local
Observed GPU readbacks: Expected under the documented one-submission miss: the second post-reclaim read returns the texel. The assertion fails: Code path consistent with this readback: Separate allocation-failure hazard (source inspection, not fault-injection tested)
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 AI use: omp, harness model |
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).
|
Thanks @nathanbzrr and @pickles976. All four are addressed in fedb38d (head of 1. 2. A. Placed texture back after three null submissions (@pickles976). Real, and the same mechanism you describe. B. Side note (32 submissions). Tests (RTX 5070 Ti, which pages): @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 |
|
I checked both points in the review of 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 These are synthetic readbacks. The 4070 SUPER default vs. |
|
Thanks, that matches what fedb38d fixes. Your readings were against c23f708, before it. Both points are covered there with this repo's own tests:
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. |
# Conflicts: # crates/victory-gpu/src/descriptor/host.rs # crates/victory-gpu/src/shadow.rs
|
I reran the fixtures on 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 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. |
|
Two additional controls distinguish descriptor restoration from a late texture upload in the full-heap result above. On unchanged 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, 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). |
…e next submission 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).
|
@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#8 and #9), so those can be closed. Full heap. The cause was as you found:
Tests run through
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
|
…w round) # Conflicts: # crates/victory-gpu/src/host.rs # crates/victory-gpu/src/shadow.rs
|
Thanks for fixing both cases. I verified 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. |
|
Re-verified on GPU texels after reclamation, My local Your four new take-back tests ( Environment caveats, unchanged from the first report: locally built diagnostic-relaxed vkd3d-proton 3.2.0 ( AI use: omp, harness model |
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:
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 continueMeasure 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 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 |
|
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 How many slots the title writes differs between runs. Your run logged The run that would decide it, on your host and scene: 0bc5edb (or later), once with defaults and once with |
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 slotiat host sloti, so the capped heap kept 934,464 title slots and left the rest out ("title slot past the host heap").HEAP_VIEWS)The fix
A host that refuses a view heap of every index shaders take plus the dynamic slots (
descriptor::host::view_pages, asked once; setVICTORY_VIEW_PAGES=1to page on any host) keeps the title's order in a virtual heap of 256-slot pages:VIEW_PAGE_TABLE), which shaders already have bound. A null made in a page with no place takes none.Options::view_pagesis 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.Limits:
HEAP_VIEWS - 2is capped atPAGED_TITLE_VIEWS(NULL_BUFFER_VIEW - 1 - DYNAMIC, 1,835,005 title slots), with the warningpaged 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.
HostHeap::gpuhands out a handle in it, when a draw binds a slot of it through a table, and when its read mark comes in.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, andshadow::take_page_readstakes and clears the marks of both bitmaps after each submission. The shader cache key changes with the translator's sources.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.view heap pages unused lately taken back(pages,total,free,in_use, andrelaxed(whether that pass took pages younger than the strict ages) withrelaxed_total) andview heap pages placed again(pages,taken_back,refused,in_use). The placed-again line keeps two counts apart (6f8b588):taken_backis pages taken back by reclaiming and then read, written or drawn through (a wrong guess);refusedis pages written when no host page was free that got a place later. A page taken back and then written with no room counts undertaken_back.pagesis 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 heapandview heap pages written with no room leftkeep 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) givespeak, 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), andrun, the longest run of them a table asked for; it is logged wherepeakorrunreaches 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:intake_back_pages): a handle fromgpu()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, andgpu()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, throughHost::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. Atfedb38d:[(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]. Atfedb38d:[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_sincereturns both slots and names the second heap's texture. Atfedb38d:[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_texturefails, as atfedb38d. Clippy with and without--features diagnostics: 0 warnings.cargo xtask policyok.Review fixes (
fedb38d):draw::tests::a_placed_texture_in_a_page_taken_back_is_made_after_one_submission_reads_it(GPU, throughHost::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_readthenturn_pages(the orderHost::executehad atfedb38d; a texture made for a draw before the heap sync is in the same place). Before, the remake nulled the texturemake_readhad 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) andpipeline::placed_uav_tests::placed_uav_dispatch_writes_its_texturefail, and both fail atc23f708too. Clippy with and without--features diagnostics: 0 warnings.cargo xtask policyok.The paged title-heap cap (
07a132db):host::tests::a_paged_heap_of_every_slot_shaders_index_is_capped(GPU, paged host): a title heap ofHEAP_VIEWSslots is capped atPAGED_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 inHostHeap::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 (at6f8b588), 0 failed, 1 ignored, both with and withoutVICTORY_VIEW_PAGES=1. At979e3a7: 244 passed, 1 ignored withVICTORY_VIEW_PAGES=1; without it, 243 passed andviews_bound_while_another_slot_gets_its_texture_do_not_waitfailed, which fails on main on this card too. Clippy with and without--features diagnostics: 0 warnings.cargo xtask policyok.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_oncechecks when the line is logged.cargo test -p victory-gpu --lib: 246 passed, 0 failed, 1 ignored, both with and withoutVICTORY_VIEW_PAGES=1. Clippy with and without--features diagnostics: 0 warnings.cargo xtask policyok.Reclaiming (
cae596c,a12b972), on an NVIDIA card that pages automatically, and withVICTORY_VIEW_PAGES=1:descriptor::pagesunit tests (no GPU):gpu()handle, draw stamp);taken_backonly, pages refused room and placed later underrefusedonly, and a page taken back then refused room undertaken_back(6f8b588);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 throughtake_page_readsandturn_pagesplaces 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 bitsVIEW_PAGE_READS + 4296andVIEW_PAGE_READS + 0are set.cargo test -p victory-gpu --lib: 203 passed, 0 failed, both with and withoutVICTORY_VIEW_PAGES=1.cargo test -p victory-shader --lib: all pass excepta_heap_buffer_read_by_element_takes_the_views_strideandgathers_at_a_level_match_the_hardware, as before.dxil.dllisn't installed here, so the new DXIL was checked by pipeline creation on hardware and WARP, not by the validator.--features diagnostics: 0 warnings.cargo xtask policyok.Earlier:
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 (driver 621.24) and WARP.dynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_viewsnow pass (both fail on main there).memory::tests::a_submission_that_missed_leaves_the_copies_at_onceis paged the same way: itsWRITEshader 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_zerosnow 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-gpuand-p victory-shader: all pass on the RTX 5070 Ti exceptemit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_strideandemit::synthetic_tests::gathers_at_a_level_match_the_hardware, which fail on main there too (the test host's structured views, Shader tests: the test host's structured buffer views are raw (#1835) #1887).Not verified
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 whatview heap pages unused lately taken back,view heap pages placed again(itstaken_back=against itsrefused=) and (if it still appears)no room left in the host view heapwill show. Whether the dynamic region can be smaller on paged hosts is what the largestpeak=ofview heap dynamic slots in usein 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
Shader::heap_handle, so they are paged too.a_submission_that_missed_leaves_the_copies_at_onceis adjusted for paging, as described under Testing.Rebased onto 842b0cb
view_addresses_cover_tables_made_afreshsits next to the paging tests indescriptor/host.rs(the paging tests move todescriptor/pages.rsin the last commit, as before). It passes on the RTX 5070 Ti, which pages.compute_view_marks_rebind_after_depth_twin_conversion(GPU: rebind compute view-mark root descriptors after depth-twin conversion #2155) translates withshader_cache::options(), which is how the runtime translates, instead of buildingOptionsitself.Optionsnow has theview_pagesfield.lower.rsis still under the 512 KiB policy limit.Rebased onto 63bcca4
README.md. No conflicts.