GPU: reserve 2^18 dynamic slots on capped view heaps and trim fresh tables (#747) #1349
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1349"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by wbkepler on 2026-11-24T17:34:47Z.
Summary
Implements #747:
DYNAMIC(2^18= 262,144) dynamic view slots on capped 1M heaps viacapped_split()(737,856mirrored +262,144dynamic, safe for small limits) so NVIDIA world indirect/mesh tables do not starve.draw.rsto[first_used, last_used](clamped to mirrored count sobase = first - startnever underflows) and includes(start, end)in the per-list cache key.Verification
cargo clippy -p victory-gpu --all-targets -- -D warnings— passedcargo clippy -p victory --features diagnostics --all-targets— passedcargo test -p victory-gpu— passedcargo xtask policy— passedImported from Marvisak/VIctory. Originally posted by shortselow-byte on 2026-11-24T19:32:05Z.
For triage: this conflicts with #955 (
git merge-treeagainst the current heads, indescriptor/host.rs), and the two make incompatible choices about the same slots.capped_split(PORTABLE_VIEWS)gives(1_000_000 - 262_144, 262_144)=(737_856, 262_144), the whole 1M heap, and the uncapped path keepscount + DYNAMICwith allDYNAMICslots dynamic.dynamic = DYNAMIC - 1(orMIN_DYNAMIC - 1when capped) andguard = total - 1.Merged as they are, there is no slot left for #955's guard on a capped heap. Whichever lands second needs one slot less in one of the two ranges (e.g.
DYNAMIC - 1dynamic slots) so the guard stays outside both.This PR on its own, at
eb5fea7onmainffe310e, isolated target directory, Windows 11, Rust 1.98.1 MSVC, AMD Radeon RX 6900 XT: workspace 345 passed, 0 failed, including its three new tests; both clippy runs clean.Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T20:09:07Z.
Review: COMMENTED
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; this is source review plus the PR's own Windows tests.
Capped view heaps (NVIDIA 1M descriptor limit) now reserve the full DYNAMIC=2^18 dynamic budget out of the cap instead of shrinking to MIN_DYNAMIC=2^16: capped_split(limit) gives (limit - min(DYNAMIC, limit-1), ...) so mirrored title slots keep at least one slot and small limits never underflow (0→(0,0), 1→(1,0), 1024→(1,1023)). Uncapped heaps still try count+DYNAMIC first. Rationale documented (#59, #747: world tables starving on capped heaps). Trade-off: mirrored prefix shrinks from ~960K to ~768K on a 1M cap — worth a sentence in the PR description, but the direction is right. Unit tests cover the split boundaries; the GPU test skips cleanly without a host.
Imported from Marvisak/VIctory. Originally posted by devgosling on 2026-11-24T20:48:31Z.
Tested on an RTX 5080: the PR fixes the dynamic-slot starvation, but the world still hangs (0x887A0006) about as soon as before.
Setup
nvlddmkmlogs the errors), Windows 11 Pro 262007952987Adiagprofile with--features diagnostics,VICTORY_D3D12_DRED=1, default loop limit, no TDR registry changes. The D3D12 debug layer isn't installed, so this is DRED-only.mainatffe310e. PR:eb5fea7, which sits directly onffe310e. One run each, same settings.cargo test -p victory-gpupasses on this GPU with the PR: 53 passed, including the three new tests.Results
ffe310eeb5fea7(this PR)capped at 1000000 count=1245184capped at 1000000 count=1245184 mirrored=737856 dynamic=262144no free dynamic descriptor slots/no dynamic slots for its tablesdropped=1024before the hang)title slot past the host heapms=5648 lists=27ms=4730 lists=31mesh 159 [mesh 4adfa13bea1c556a]mesh 50 [mesh 29f7805ffefc2e63, pixel 19acd330dacc8f32]A third baseline run with
VICTORY_SHADER_LOOP_LIMIT=4096(ffe310e) also starved the dynamic slots (dropped=16384) and then hung on a single list (ms=4683 lists=1).So on this GPU the dynamic-slot exhaustion comes with the hang, but it isn't what causes it. With the starvation gone, the hang is still a
DispatchMeshhang with no page fault, and the mesh shader changes from run to run. That looks like the same thing as #1216 and #1670. These are single runs, so the timing difference between them doesn't mean much.Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-24T21:00:13Z.
In-world evidence for keeping 2^18 on capped heaps, from a fork that runs
maininto the world on NVIDIA (RTX 4070, capped at 1,000,000 views): fxceless/victory-gta6, the comment onDYNAMICindescriptor/host.rs.main's capped fallback, 2^16 (MIN_DYNAMIC, from #336), ran out in the world: "no free dynamic descriptor slots".The fork also found a second cost, which may matter for @devgosling's hang above. With slots free but in pieces, each refused table searched the whole ring before giving up: 0.33 ms each with 131,072 slots, and 1.0 s of the recording threads in a frame that refused 3,143 tables, all under the lock every table takes. It keeps a free-slot count, plus the shortest table length that last found no run, and refuses longer tables without searching until slots are given back.
Reading only, nothing run. AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by adnanoos on 2026-11-24T22:08:19Z.
RTX 5060 Laptop GPU: this PR stops every "no dynamic slots" drop and the world reaches the G-buffer
Setup. NVIDIA GeForce RTX 5060 Laptop GPU (heap capped at 1,000,000; the title asks 1,245,184), driver 32.0.16.2124, Windows 11 Pro 26200, title 1.0.2.1, Series X mode. Release build with
--features diagnostics. The base is #1520 (2190efe) + theresync_title_writesbound from #994's thread + #452 + #1010. Computeeeed82b877b44b5fis skipped (VICTORY_SKIP_PIPELINES) in both runs, because it hangs the GPU here otherwise. Targets were dumped withVICTORY_DUMP_TARGETSat world frames. 8-minute runs, one each.eb5fea7)mirrored=672320 dynamic=262144(see the merge note)a draw or dispatch dropped: no dynamic slots for its tablesRender targets.
So on this GPU the PR takes the world from "not drawn" to "drawn but not lit". The remaining black is the lighting stage, as in #1317 and #638.
Merge note. On #1520,
HostHeap::newalso reservesaliasesslots. To merge this PR there, I usedcount + DYNAMIC + aliasesfor the wanted size andcapped_split(PORTABLE_VIEWS - aliases)for the capped case. Themirrored=672320above comes from that.Frame rate in the world drops (1.19 → 0.37 fps) because far more is drawn. No device removal in either run.
Imported from Marvisak/VIctory. Originally posted by wbkepler on 2026-11-24T22:25:14Z.
Superseded by #1779, which redoes this on current
main(70564ae).mainchanged around this since the branch was cut: heaps are now at leastHEAP_VIEWS(2^21) slots and translated shaders clamp to that and read the null buffer views at2^21 - 2, neither of which exists in a capped 1,000,000-slot heap. #1779 keeps what this PR did (the full 2^18 dynamic range on a capped heap, tables made afresh trimmed to their first used entry) and adds the part this one could not cover: the clamp bound and the null buffer views fitted to the heap the host actually makes.Leaving this open for the maintainers to close; it conflicts with
mainand will not be rebased.AI-assisted (Claude Code); checked on Windows 11 / RTX 5090.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:23:41Z.
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-gpu/src/descriptor/host.rs,crates/victory-gpu/src/draw.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
upstream-sync referenced this pull request2026-11-25 03:03:28 +00:00
upstream-sync referenced this pull request2026-11-25 04:07:01 +00:00
Imported from Marvisak/VIctory. Originally posted by kais7654 on 2026-11-25T14:20:49Z.
Rebased and opened for review at the linked PR (author preserved on the
commit, @wbkepler / @wrothgaril credited). Main moved since
ffe310e(the marks upload, the tests module in draw.rs), so the conflicts are
resolved keeping main's flow — the 2M mirrored floor, the
MIN_DYNAMICmiddle branch — and only the deeply capped path changesto
capped_split(PORTABLE_VIEWS). Verified on an RTX 5070 Laptop GPU(driver 616.87) whose host refuses the 2M heap right now: the capped
path runs live with the full 2^18 reserve, and the whole victory-gpu
suite passes.
AI-assisted (Mistral Vibe).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.