8 GB RTX 4060 Laptop at f85101b: card at 99% from the first world frame, texture queue never drains (15-19k waiting) - run report, switch matrix, profiler hints #898
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork#898
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@bai557 on GitHub · 2026-11-25 12:14 UTC · original
8 GB RTX 4060 Laptop at
f85101b: the card is at 99 % from the first world frame, the texture queue never drains (15–19 k waiting) — run report, switch matrix, profiler hintsReporter's machine (every number below was measured here, not on the README's 4070):
b99f876b74d4a77f03af5f878223b27bd647b5c35a79d5decd9f716504239e93, Series X profilef85101b, release build, rustc 1.98.1 (the pin), MSVC 14.43VICTORY_DISPLAY_MODE); the title's ownsettings.xmlwas left at 3840×2160 except where notedOnly local change: 12 lines in
crates/victory-shader/src/emit/mod.rs(§6). Everything else isf85101bas merged.What works here
Boot, first-boot screens and menus at 30 fps; the prologue world renders with characters, textures, sky and HUD; autosave works; no device loss or crash in any of the release runs below (the longest was 21.9 min, ended by closing the window). The problems are the memory budget and the frame time, not stability.
1. The card is full from the first world frame and the queue never drains
From a default-switch run:
The arithmetic on this machine is about
4.3–5.5 GB textures + ~2.8 GB render targets (4 K internal) + 0.9 GB buffer copies ≈ 9 GBagainst a 6.6 GB card, and about 5.8 GB of GPU resources are already in shared (system) memory.waitingstays at 15,000–19,000 for the whole run andpassed over unmappedat 7,000–13,000, so which content is missing depends on which textures happen to win a place (see §3, E2).2. Measurements (world frames, averages of the last 10–20 frames)
9376fd6,JOIN_COPIES=1ROOM=70f85101b, C +ASYNC_SUBMIT=1QUEUE2=1MERGE_GAP=1ASYNC_SUBMIT+QUEUE2cut copying back from 238 to 78 ms (−67 %) and let 33 % more draws through; they cost 24 ms inpreparingon this CPU. Dropping the title's own internal resolution to 1080p andMERGE_GAP=1then took another 20 ms offpreparing. Net: 348.6 → 305.4 ms.Waiting / passed-over-unmapped at the same points: C 15,535 / 7,351 · n1 16,504 / 9,889 · n3 17,495 / 13,532.
3. Switch matrix — negative results too, in case they save someone else a run
CARD_BUFFERS_MIN_MB=1CARD_FETCH_INFLIGHT=1JOIN_COPIES=1LEVELS_ON_DEMAND=1ROOM=70texturesup to 2691 ms for 41.9 MB (≈64 MB/s). The policy is visibly right — buildings that are missing in the default runs are resident here — the cost is not. See §5.CARD_BUFFERS_MB=256+CARD_ROOM_FOR_TARGETS_MB=1536waitingrose to 23,922; copying back up to 979 ms.manualMipBias=1.0+maxTexUpgradesPerFrame5 → 2waiting19,232. My mistake: 2 upgrades a frame is a throttle, not a relief.--console series-sconsole Xbox Series S, 30 fps, but 8 draws/frame for 20 minutes:textures: 0 slots, 0 waiting, no content ever loads, and Enter presses change nothing.4. Hint: the submit thread waits 84 % of the frame, 95 ms of it in
queue::release_held_nowVICTORY_PROFILE=1, diag build, the n1 switch set:and at the same time
The second line is cumulative over the session, so it is mostly the startup translation flood (it is why reaching the world takes minutes here), not steady state. The first line looks like steady state: a 24-thread CPU, and the layer's own submit thread spends half the frame inside its own lock/condvar.
5. Hint: tiling's cost is per texture refresh, not per mapping
Three measurements that narrow it down:
tiles.rsgive_lockedmaps a level only while!given.levels[level] && now(level), so unchanged levels are never re-mapped.blake3_hash_many_avx23.12 ms (2 % of the submit thread).Staging::refreshis: 23.28 ms with,refresh_now20.61 ms own, plus lock time on it. And in the frame counters,texturesruns at 807–1128 ms for 43–112 MB in on-demand runs.Hypothesis, not verified: a level that gets no tiles returns
missingfromTiled::uploaded, the caller has the upload recorded again later, and the next attempt re-reads, re-detiles and re-copies the texture — while there is still no room — so the whole refresh repeats every frame for a few megabytes of actual upload. If that is the shape, the fix might be: retry only the tile mapping, and whileroom()is false do not re-record the upload at all.6. The RT builder: 3 of 53, and what happens when the gate is forced
At
9376fd6(not retested atf85101b):All three fail with
a first-lane read where not every lane runs(0x23c,0x258), andVICTORY_WAVE_WHY=1says why they keep 64-lane waves:[LDS in a group over 32, an LDS read and write in one lane-branch region, v_readlane], groups of 128 and 256 threads.widen) is refused for them:wave-wide branches in a thread group of several console waves is not supported— 2 or 4 console waves share the group, so a group barrier inside a per-lane branch would wait for threads that never come. My local patch (§ title) is what madewidenbe attempted for builder programs at all; it changes nothing else and is behindVICTORY_WAVE_WIDE_BUILDER=0.VICTORY_FIRSTLANE_OWN=1the gate does close —the ray-tracing structure builder runs: all of its programs have host pipelines pipelines=53— and then the title dies: withVICTORY_BVH_QUARANTINE=1, 11 s later on0xC0000005 … read 0xffffffffffffffff; without quarantine, 13 such faults. That matches theshortcut:note on the builder (the title reads sizes and counters back and gets none, and a stage that stores where it should not reaches the title's own objects).7. Two small things
f133e35efed2a48a,a lane mask exchanged where not every lane runs.CreateComputeShaderwithE_INVALIDARG:02384a60fda6f2d0,2cc4c197ee29e291,2da4beb386509b77,369cbe906ea72764,5dc3b25986622949,6b82bc7d22016cb5,6f225b641c5b0708. Together with the shader above they cost ~355 draws a frame (0 being made).Questions
VICTORY_LEVELS_ON_DEMANDmeant to be usable today, and is the ~20 ms per texture refresh (≈64 MB/s for 43–112 MB a frame) the cost you expect, or a known gap?release_held_now/queue::lockcontention withASYNC_SUBMITsomething you see on your machine, or does it only show on a small CPU?Logs, the profile report and the exact switch sets for every run are available on request. No game files, shader bytecode or memory dumps are attached.
(Report and analysis prepared with AI assistance: the runs, the logs and the numbers were produced on the reporter's own machine, and an AI agent wrote this up from them.)
@bai557 on GitHub · 2026-11-25 12:19 UTC · original · edited 2026-11-25 12:22 UTC
Follow-up: the eight failing programs, per hash
victory translate --warmon just those eight hashes, withVICTORY_HOST_WAVE=32 VICTORY_WAVE_WHY=1(61.4 s on 4 threads):Seven of the eight translate, and keep 64-lane waves — which is why
CreateComputeShaderrefuses them withE_INVALIDARGon a 32-lane NVIDIA part (the list in the report above). One does not translate at all.The one that does not translate
f133e35efed2a48a—GFX10 code at 0x1eb4: a lane mask exchanged where not every lane runs is not supported(thewithout skipsform stops at the same place).The seven that translate and stay at 64 lanes: the shapes the lowering names
0x1a34,0x3a14local waves: not the allocation idiom: a count or sum over the wave used as data0x274a count or sum over the lanes below used without a reserved base0x21c,0x5e0,0x768,0x778a value that depends on the wave on some paths only0xdc70local waves (APPROXIMATE): a lane mask read as data in a half-wave0x9a84local waves (APPROXIMATE, any mask): a constant lane mask in a half-waveVICTORY_WAVE_WHY=1on the same eight:The shapes are the ones §6 of the report lists for the builder's three stages: a lane mask as data, a wave count used as data,
v_readlane.What the seven refused pipelines cost here, per frame:
dropped 355 without a host pipeline (0 being made) and 1 indirect.(Analysis prepared with AI assistance, from the run's own logs.)
@bai557 on GitHub · 2026-11-25 12:36 UTC · original
Follow-up:
widenfor a group of one console wave — four pipelines made, then the device was lostOn this machine (8 GB RTX 4060 Laptop,
f85101bplus the 12-line local patch named in the report, extended by one switch:widenis attempted for compute programs whose thread group is one console wave,threads.iter().product() <= 64, off by default asVICTORY_WAVE_WIDE_ONE=1).Refusals fell from 7 to 3. With the switch on, these four translate into host pipelines that
CreateComputeShaderaccepts:So four of the seven do lower to 32-lane waves in the wave-wide (barrier) form.
The run then lost the device, as runs 121-124 did:
Windows logged
nvlddmkmevent 153 at the same second (20:34:13 local), i.e. a TDR; the card came back and the driver reports OK. Before the loss the run held 2.8–3.1 fps at 3,2xx draws/frame, so the four pipelines were being used.That is the shape I can measure from here: the wave-wide form reaches four of the seven (and, per §6, the builder's three), and its group barriers inside per-lane branches take this GPU down — on a second machine, for the same reason the switch is off by default.
(Analysis prepared with AI assistance, from the run's own logs and the Windows event log.)
@bai557 on GitHub · 2026-11-25 12:48 UTC · original
Follow-up: a cycle guard on the wave-wide form — one of the seven recovered, no device loss
The unguarded form in the previous comment lost the device. This one adds a guard to the same local switch (
VICTORY_WAVE_WIDE_ONE=1):widenstops when any block whose lowering asked for every lane lies on a cycle (a path from it leads back to it —on_a_cycle, plain reachability overStructured::exits).Result, 5.5 minutes in the world, Series X profile,
ASYNC_SUBMIT=1QUEUE2=1JOIN_COPIES=1ROOM=70WAVE_WIDE_ONE=1:and
VICTORY_WAVE_WHY=1on the ones the guard stopped:So on this machine: the device removal of the unguarded form comes from a group barrier standing on a cycle, and one of the seven programs (
2cc4c197ee29e291) has no such block — it has a host pipeline now, with the run stable. Six pipelines and one program are still refused or untranslated; their named blocks are on cycles, where this form cannot place a barrier.(Analysis prepared with AI assistance, from the run's own logs and the Windows event log.)
@bai557 on GitHub · 2026-11-25 13:09 UTC · original
Follow-up: a uniformity-aware guard — two of the seven recovered, still no device loss
The cycle guard in the previous comment refuses every block on a cycle. This one refuses only cycles whose control flow is per-lane:
barrier_allowedwalks the blocks reachable from the named block and the blocks that reach it, takes their meeting (the cycles), and allows the barrier when every branch on those cycles is uniform (Bools::support(when)is allAtom::Uniform). On a uniform cycle both halves take the same iterations, so the barrier is reached by all of them.Result at
f85101b+ the local switches, 4.2 minutes in the world:Two observations from the numbers: with the strict guard 343 draws were dropped a frame and with this one it is still 343 (the two recovered pipelines are not among the ones that drop them), and the frame here was 391 ms against 302 ms in the run with the strict guard — scene and draw count differ between the two runs, so I do not read that as a cost of the pipelines.
(Analysis prepared with AI assistance, from the run's own logs and the Windows event log.)
@bai557 on GitHub · 2026-11-25 13:27 UTC · original
Correction to the two comments above: the log does not support the barrier reading
The unguarded run's log line at the moment the device went says:
Nothing of the layer's was running on the card when the device went, and the log has no
slow host submissionline near it (the frames before it waited 72–86 ms for the card). So the two comments above overstate their case: the run with the cycle guard surviving is not evidence that the wave-wide barriers caused that removal, and the cause of that removal is still open here — a driver-side fault raised while the submitting thread was only preparing a submission fits the log at least as well.The measurements stand on their own: 7 → 6 refused with the strict guard and 7 → 5 with the uniformity-aware one, 343 draws a frame dropped in all three runs, and the eviction experiment below.
(Analysis prepared with AI assistance, from the run's own logs and the Windows event log.)
@Daolyap on GitHub · 2026-11-25 13:39 UTC · original
Same picture here on an RTX 3070 8 GB (driver 32.0.16.1692, 32 GB RAM, Windows 11) at
f85101b: the card's budget is about 6.7 GB, andresource::room()keeps 3,072 MB for render targets (VICTORY_CARD_ROOM_FOR_TARGETS_MB) on top of the 90 % line. Once the world's targets exist (2.8-3.0 GB of them here) textures picked by index wait for good: 6-10 thousand title textures never got a host copy, 2,300-3,300 passes a run ended "short of room", and the cell walls and floor stayed black.I tried a local experiment that lets them go to system memory instead of waiting:
host_texture_as, a texture the title fills (no target, depth or UAV flags, not reserved) made whileroom_lately()is false goes into a custom heapCPUPageProperty: NOT_AVAILABLE,MemoryPoolPreference: L0(GPU-only access to the PC's memory), bounded by a byte budget (VICTORY_TEXTURE_SYSMEM_MB, given back inHostTexture::dropby checking the heap properties).draw.rsheap_textures, such a slot is not counted as refused while that budget has room.Results, same build with the switch on and off, levels on demand on, relay off:
Happy to put this up as a PR if the approach is wanted. AI-assisted (Claude Code).
@UwUCammie on GitHub · 2026-11-25 22:30 UTC · original
I tried levels on demand on a Series X profile with a 20 GB RX 7900 XT (RADV 26.3.1, Wine 11.22). In the first room the final memory sample showed 327 MB backing 1,482 live textures, 3,057 MB of mip backing avoided and 896 MB of tile-pool heaps. Those figures measure different things: freed physical VRAM can’t be inferred from the 3,057 MB alone.
On the same integration binary and scripted route, levels on demand gave 624 successful presents in 73.76 s (8.46 FPS, 4,905 draws/frame), compared with 752 in 74.31 s with ordinary textures (10.12 FPS, 4,829 draws/frame). Both finished 230 s without device loss. One run per setting, with no image comparison. The backing savings also show up on this larger card, but this pair didn’t show a frame-rate improvement.
@spk-c on GitHub · 2026-11-26 01:08 UTC · original
A small CPU-side result relevant to the large texture backlog, independent of the VRAM capacity problem. On a Ryzen 9 9950X3D / Windows 10, we tested bounded selection of up to 4,096 due slots instead of sorting the entire due queue. Synthetic inputs (all entries due, one-third retries), 24 alternating measurements per mode, upper medians:
Exact selection/order parity passed on mixed mutations and large all-fresh/all-retry/mixed queues. Benchmark details.
I checked #733 and #221: both already implement partial selection in
TextureQueue::due, and #221 additionally folds census counting into the scan. Our experiment substantially overlaps them, so I would not open a third implementation; these numbers are independent supporting data for the approach, not benchmarks of either PR's exact code.Small queues may regress; the reference application was still running during the CPU benchmark. No controlled end-to-end FPS result, no improvement in VRAM capacity or residency claimed. AI-assisted implementation and measurement write-up.
@Danigamer05 on GitHub · 2026-11-26 01:27 UTC · original
Another 8 GB data point, with a different cause than a full card: here the texture queue is held back by the room
resource::roomkeeps for render targets, while about 2 GB of the card stay unused.Machine: RTX 2080 SUPER 8 GB (budget 7,219 MB, driver 621.01), Ryzen 7 3700X, 32 GB RAM, Windows 11,
--console series-s, diagnostics build.Tree:
main9c184b3+ #1002 + #1112 + #798 + #1081 (without #798 and #1081 the S profile drew only black frames on this card). Switches: the run 253 set from the README. Every run is 960 s from launch, the same save and the same scripted input, and ends in the cell-window scene. The numbers are the median of the last 90 s.ROOM_FOR_*VICTORY_TEXTURE_ROOM_PERCENT=92(with local half resolution)VICTORY_TEXTURE_ROOM_PERCENT=92 VICTORY_CARD_ROOM_FOR_TARGETS_MB=0 VICTORY_CARD_ROOM_FOR_BUFFERS=0What changes on screen: with the defaults the cell around the window is solid black. With the two reserves off, the wall, the bunk and Lucia's shirt have their colours in every screenshot from 240 s to the end, in both runs. The close-ups in the opening cutscene still show dark faces either way, so this does not fix #1022.
Why, as far as I can read it:
room()countstargets_room_kept()(3,072 MB less the host textures the host writes now) andcard_room_kept()as used. On the S profile the targets never come near 3 GB, even less at a lower render scale, so most of the reserve is never given back. On an 8 GB card the queue then stops at about 4.5 to 5.1 GB of 7.2 GB.Possible fix: scale the default with the card's budget or the profile (as #1122 does for the texture floor), or release what is left once the world's targets stop growing.
Caveats: single runs per setting, except two with the reserves off. One scene only. The switches add about 1 GB of card use. I saw no device loss in these runs, but Windows had only about 3 GB of commit left (pagefile on a nearly full drive), so I would not call it safe on smaller-memory PCs yet.
Numbers and text only. AI-assisted (Claude Code).