descriptor: place title view slots past a capped (NVIDIA) host heap through a table #638
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/638"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by chemist6913 on 2026-11-28T02:19:44Z.
Summary
On NVIDIA, the host's shader-visible view heap is capped at 1,000,000 descriptors. An RTX 5090 on driver 621.40 refuses 1,000,001 and every larger size. The retail game's view heap has 1,245,184 slots.
HostHeap::newtherefore kept title slots 0..737,855 one to one and left the rest out. Slots 737,855..999,998 hold the dynamic tables and slot 999,999 is the null slot. Every shader-computed (bindless) view index past 737,855 read the null slot, or one of the host's own dynamic slots. Tables were fine, because draws copy those into dynamic slots. The code already said "a title that reaches them needs remapping". This PR adds that remap. Details are in #545.How the game uses its heap: it keeps 400,000–570,000 views past slot 65,536 at once, spread over the whole heap, and turns over about 130,000 a second. Because the views are spread out, a fold (slot mod N) can't keep them apart.
Change
Host side (
descriptor/host.rs,Places). On a host whose view heap is capped atPORTABLE_VIEWS, withVICTORY_VIEW_REMAPnot0:countis now the title's full count, and dynamic slotkis indexcount + k, as on uncapped (AMD) hosts.unmake,make_null, and buffer views left null to wait for a draw). Places are reused oldest-first. If the pool is ever empty, the write goes to a sink place that no index reads, and a warning is logged once.cpu(index)maps through this;cpu_at(place)is the raw handle (used byfill_null);gpu_handlemaps too.SLOT_STRIDES_COUNT + iholds the place of view indexi, and is written when a place is given or given back.Translator side (
emit/shader.rs). Withset_view_remap(true):SLOT_STRIDES_COUNT - 1;heap_handle_atclamps the index as before, then reads its place from that dword, throughSLOT_STRIDESif the shader binds it, elseSLOT_TABLE_STRIDES, so the heap buffer sweep isn't started by this.The remap flag is part of the shader cache key (
mod.rs) and ofhost_settings(bit 31 of the limit).victory translate --warmtakesVICTORY_VIEW_REMAP=1alongsideVICTORY_VIEW_LIMIT=2097151, to warm for such a host.Hosts that take bigger heaps (AMD) are unchanged:
view_remap()stays false.Testing
On RTX 5090, Series X profile, 1440p, opening cutscene through the diner, about 15 runs of 90–110 s.
cargo check -p victory --features diagnostics: clean.cargo test -p victory-gpu: 441 passed, 2 failed.cargo test -p victory-shader: 287 passed, 3 failed.mainhere:indirect::tests::host_list_budget_starts_empty_at_each_submission,indirect::tests::warp_batch_charges_every_execution, twoemit::recttests and one hardware barycentric test.main. The game runs above were on that older base, not on this branch.Not measured: frame rate. Every view-heap handle now costs one more raw-buffer load, usually uniform. A before/after on another NVIDIA card would be welcome.
Not fixed by this: the phone screen in the diner (#545). That turned out to be an exposure issue, and the findings are in the issue.
🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ArturoWolff on 2026-11-28T02:46:37Z.
Additional NVIDIA card comparison as requested. Tested your exact PR head
b0228f071a4effcc516a3baebec5ef62704791d2(basea4d05e7fd0af904130809c334a6008d62c24db6a) on an RTX 4060 desktop 8 GB / 16 GB system RAM, Linux, NVIDIA 620.73.04, GE-Proton11-14 / vkd3d-proton 3.2.0 (cae8353ed7959c4+). Both arms use the same locked MSVC release executable, with the previously tested Linux compiler, pipeline-library and physical-backing compatibility integrations retained unchanged (patch SHA-256a9143500aeb8611e66f90130534831f8f02156299e3133f970224ef50e7ae919, provenance and baseline in #628).Both actual retail launches used identical cloned profile seed, fresh engine/driver caches, Series X
1080to1440, full requested RT/water passes, no explicit omitted shaders or Bink skip, full write-back and waits, DLSS/FG off for the comparison, same DXC 1.9.2609 and mixed 448 MiB backing allowance. Effective logged graphics settings differed only inVICTORY_VIEW_REMAP.Enabled arm logged
title_slots=1245184 as_is=65536 pool=672318 dynamic_at=737855, and the table was selected from the first shader. Both arms had two successful DXC fallback attempts, no missing clamp/compare/native-library warnings, one unsupported Wave64 translation, and no host guard stop, new OOM kills or kernel GPU faults. Temporary backing retired empty. Both visually reached loading artwork then a black FPS overlay; no recorded input or live world. Both still fail during the same first-story prestream phase described in #628.This confirms activation of the intended remap path on an 8 GB RTX 4060 under Proton, but does not establish in-world descriptor correctness, reuse safety, peak pool occupancy, or gameplay FPS. It also does not fix this particular loading failure. The new watchdog findings in #628 make normal GPU completion and synchronization a more useful next investigation than removing rendering features. Thanks for making this independently selectable.
AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by jessebuffington on 2026-11-28T03:20:27Z.
Tested on an RTX 2060 6 GB (Linux, Proton Experimental, Series S profile, DLSS off) against the intro-prestream crash in #628. The remap was active (title slots from 65536 on are placed in a pool of 672318, and no more views past it read a null slot), and the picture was fine up to the stall. But the crash is unchanged: frames stop as FSR 4 starts with the first story cutscene, and the title's watchdog fires about 95 s later. So #638 doesn't fix #628 on this setup. Details and logs are in #628.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Machad3x on 2026-11-28T06:11:51Z.
Test results for this PR on our fork. It is cherry-picked as-is and switched on with
VICTORY_VIEW_REMAP=1, together with the RT fault-page keep, the slot-fresh check and the unseen-writes rotation.Setup: RTX 3080 Ti, driver 621.40, Windows 11 Pro build 26300, Ryzen 7 5700X. RT on (
VICTORY_BVH_BUILDER=1). Each run is 240 s on the opening interior scene, with a valid (non-compile) rerun. Values are averages over the last 120 s.VIEW_REMAPLog excerpt (on, one 5 s line):
The cost seems to come from giving places back and taking them again every frame. Reusing a place while the view's record is unchanged would likely remove most of the +23 ms preparing and +20 ms GPU. The switch stays off by default on our side.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by bigboss22869 on 2026-11-28T20:54:00Z.
A small follow-up this PR could carry, for the frame replay tool.
With the places table on,
victory replay <capture> --retranslate <folder>still translates as for a host without it, so shaders retranslated for a capture of an NVIDIA run do not match the capture's own (their view indices are not placed). On my fork I added a switch for it inapps/victory/src/replay.rs, next toVICTORY_HOST_WAVE:With
VICTORY_HOST_WAVE=32 VICTORY_HOST_VIEW_REMAP=1, a retranslated set replays a capture from an RTX 5070 Ti with the same picture as the capture's own shaders (71 dB against the recorded frame both ways). That makes--compare --shaders ... --shaders-b ...usable on NVIDIA for comparing translation forms on the card.It cannot be a PR against
mainon its own, sinceset_view_remapcomes with this PR. Feel free to take it in here; otherwise I can open it once this one is merged. The commit is in https://github.com/bigboss22869/VIctory-RTX5070Ti (branchrtx5070ti,42961750).A data point for the PR itself: it has run here all day on an RTX 5070 Ti 16 GB (Windows 11, Series X profile, 1440p), 81 scripted runs and several play sessions, with no "no free place for a title view slot" warning and no device removal in the logs.
AI-assisted (Claude Code); the runs are mine.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by futurepro62 on 2026-11-29T01:35:53Z.
A before/after on another NVIDIA card, as asked: RTX 5070 Ti (16 GB), Windows 11 26300, Series X profile, 4K output, DLSS Performance, frame generation 4x.
Result: with this PR the game was unplayable. In the world it sat at about 2 fps (frames of 440–490 ms) for over 20 seconds at a time. Without it, on the same build, it runs at about 18–20 fps. The remap itself worked: the log shows
title slots from 65536 on are placed in a pool of 672318, and no pool-exhaustion warning appeared.The cost is on the CPU, not the card. Per-frame lines from the two sessions, first minutes in the world:
VICTORY_THINline)settlesline)So each translated list call costs about 6 times more with the remap. My guess is the host-side place mapping on every descriptor write: the title writes about 15,000–20,000 view slots a frame, and up to about 47,000 in the slow stretch (
writes of view slots per frame). That's not measured per function.Caveats:
main. It was the fork'smainfrom earlier today, plus #339, #348 (with the fallback-order fix posted there), and a port of Marvisak/VIctory#3619. #638 merged onto it without conflicts.The base build is the same on both sides, and this PR was the only change between the two sessions. Rolled back for now. Happy to run a build with timing around
Placesif that helps.🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by futurepro62 on 2026-11-29T03:18:40Z.
Correction to my report above: with a longer run, this PR is playable here. The "about 2 fps / unplayable" result came from a session with only about 1.5 minutes in the world, dominated by the spikes right after loading. I shouldn't have called it unplayable from that.
Same card (RTX 5070 Ti 16 GB, Series X profile, 4K output, DLSS Performance, frame generation 4x). Medians and means over the in-world frame-time and
VICTORY_THINlines:The 71 ms median is the frame-generation pacing on this setup, so the median matches the build without the PR. The cost shows in the per-call time and the mean.
The second run was on an exe whose pipelines had not been made ahead (
victory warm), so part of that cost is pipeline compiles during play. In a CPU profile of 60 s of it (ETW, symbols from the PDB),HostPipeline::newand the driver's compiler took about 14.5% of the busy CPU time. The PR's own code barely shows:HostHeap::place_backabout 0.6% andHostHeap::cpuabout 0.7%. All contended mutexes together were under 2%. The largest share, about 35%, is list translation (list::thin::Recording::run, mostlydraw::State::bind), which isn't specific to this PR.Picture:
I'm keeping it in my build for now and will report more after longer play with warmed pipelines.
🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by futurepro62 on 2026-11-29T03:26:42Z.
Method for my two reports above, so they can be checked and repeated.
Hardware and settings
RTX 5070 Ti 16 GB, Windows 11 26300,
shaders.rpfof 1.0.2.1. Launched with the fork'sPLAY_FRAMEGEN.cmdmode 6 (Series X profile, big pools, High priority), with the F1 menu's saved choices on top: 4K output, DLSS Performance, DLSS frame generation 4x.Builds (all on fork
main9300875from 2026-11-28)103661ae8e2dfc), #348 at5df24f4plus a local fallback-order fixcb325c5(posted in #348), this PR atb0228f01f10565weatherParticle:CS_BeginUpdate)Confound: the baseline has the #3619 port and the builds with this PR don't. It changes a single weather-particle program.
Runs and switches
victory-nvidia-20261128-154834.logVICTORY_SLOT_EVICT=1at its default 85%...-153204.log...-190912.logVICTORY_SLOT_EVICT_PERCENT=78;victory warmnot run for this exe, so pipelines were compiled during playThe baseline and the second #638 run were in different places in the game.
How the numbers were computed (from the logs,
VICTORY_LOG=warnplus the default info lines)victory_gpu::frame_timeslines (one per few seconds). "In the world" means windows whose median is over 20 ms (menus and loading run faster). I report the median and mean of those window medians. These are the game's own frames, before frame generation: 71.4 ms is the pacing on this setup, about 14 game fps (56 shown with 4x frame generation), so the median hides differences and the mean shows them.list calls translated by threads of ours per frame: N in T mslines. Over windows with N > 20,000: sum of T divided by sum of N. T is summed over all threads.CPU profile (second run, 60 s while driving)
wpr -start CPU -filemode, elevated (samply's own recorder needs xperf, which isn't installed), then 60 s laterwpr -stop game.etl. That gave 3.8 GB.samply import game.etl --save-only -o prof.json.gz(samply 0.13.1).victory.exeprocess to the nearestvictory.exeframe on its stack. So time inside ntdll, D3D12 or the driver counts toward the function that called it. It resolves addresses withdbghelp.dllagainst the build's own PDB, and drops samples whose nearest frame is a wait (Condvar::wait, park, sleep). Percentages are of the remaining "busy" samples: 693,151 of 2,217,780.Results from that:
list::thin::Recording::run34.5% (of itdraw::State::bind25.7%),HostPipeline::new14.5% (compiles, because the exe wasn't warmed),HostHeap::place_back0.6% andHostHeap::cpu0.7% self time, and all contended mutexes under 2%.🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by chemist6913 on 2026-11-29T04:35:33Z.
Merged current
main(e1f2eb60) into this branch (41f3187c) and resolved its conflicts. Two of them changed behavior:main'sdynamic_slots_foris kept as it is. Under the remap, the view limit isSLOT_STRIDES_COUNT - 1, which is pastPORTABLE_VIEWS. That would send it down the uncapped branch and hand ~852,000 of the 1,000,000 places to dynamic tables, leaving the pool too small. So under the remap,dynamic_slotsreturnsDYNAMIC, orVICTORY_DYNAMIC_SLOTSclamped to[DYNAMIC, PORTABLE_DYNAMIC_CAP]. Heaps made with an explicit null (main's new tests) are unaffected. RaisingVICTORY_DYNAMIC_SLOTSunder the remap shrinks the pool by the same amount: 393,216 leaves a pool of 541,246.unmake.mainnow keeps a neutral view in the slot for 2D textures. That view is written at the slot's place, so the place is given back only when the slot was actually made null.On the merged tree (RTX 5090):
cargo build --locked --release -p victory: clean.cargo test -p victory-gpu: 589 passed.cargo test -p victory-shader: 392 passed, 3 failed. They are the sameemit::rectand barycentric hardware tests that fail on unmodifiedmainon this PC.Thanks to everyone who ran this on other cards. The per-frame give-back and re-take cost reported on the 3080 Ti is a fair point. Keeping the place while a view's record is unchanged is the obvious next step. It is not in this update.
🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by chemist6913 on 2026-11-29T04:48:34Z.
Closing this one. It does what it says: title view slots past 737,855 no longer read the null slot on NVIDIA. But nobody saw a picture difference:
Against that, there is a measured cost. On the 3080 Ti, frames went from 67 to 114 ms, and on the 5070 Ti list translation cost more CPU time per call. It doesn't fix the issues people are hitting either: the phone screen in #545, and the intro crash in #628.
A fix for an invisible bug that costs frame time isn't worth merging. If a scene ever turns up that visibly depends on views past slot 737,855, the branch stays on my fork (
fix/nvidia-view-heap-remap, merged withmainat41f3187c). Its starting point should be the 3080 Ti tester's idea: keep a slot's place while the view's record is unchanged, instead of giving it back and taking it again every frame.Thanks to everyone who tested it on their cards.
🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by bigboss22869 on 2026-11-29T09:32:31Z.
A data point after the close, from the RTX 5070 Ti that ran this branch for two days (my comment above).
I measured one build with the places table on and off (
VICTORY_VIEW_REMAP=1/0): Series X profile, native 1440p, no DLSS, a scripted run at one spot with the camera still, the runs interleaved.The draw counts were the same (8,300-8,400 a frame). I saw no picture difference at that spot, with the camera turned all the way round as well, and none in a play session afterwards. So this agrees with the reason for closing: about 4 ms a frame here for nothing visible. The cost is where @futurepro62 guessed: with the remap about 95,000 view slots a frame are left to the draws against 41,000 without it, and 756,000 slots are looked at against 482,000.
Our fork runs with it off by default now (https://github.com/bigboss22869/VIctory-RTX5070Ti, branch
rtx5070ti,63032eff). If a scene turns up that needs views past the cap, I can test the "keep a slot's place while its record is unchanged" idea on this card.AI-assisted (Claude Code); the runs are mine.
Pull request closed