VICTORY_CARD_BUFFERS_MIN_KB=64 starves >=1 MiB buffers out of VRAM when CARD_BUFFERS_MB=1024 (RTX 4080 measurements) #1160
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?
Imported from fxceless/victory-fork. Originally posted by Proudnoob4 on 2026-11-25T22:13:07Z.
AI-assisted testing (Gemini in OpenCode); measured locally on my own machine.
Summary
When
VICTORY_CARD_BUFFERS_MIN_KB=64(c36971b) is combined withVICTORY_CARD_BUFFERS_MB=1024, small 64 KiB buffers fill the 1024 MB budget first and starve large (≥1 MiB) buffers out to PC RAM. On an RTX 4080 16 GB (Series X profile), that flipsMIN_KB=64from a massive GPU win into a severe regression (129.5 msGPU lists instead of36.4–42.0 ms).Measured comparison (RTX 4080 16 GB, Windows 10 22H2 + Agility 1.620.2, i5-13600K)
All runs use the same diagnostics release build (
9c184b3+ bundled perf PRs including#1014CARD_HASH_WIDE,#1029,#1032,#1097,#1117,#1138), warm cache, Series X profile,VICTORY_CARD_BUFFERS_MIN_KB=64,VICTORY_CARD_HASH_LEN=1:cardmetertitle listsframelogall other listsCARD_BUFFERS_MB=1024(noINDIRECT_WINDOW)1,025 MB)151 MB)122.6 MB/frame(121.6 MBin ≥1 MiB)131.8 ms129.5 msCARD_BUFFERS_MB=1536(noINDIRECT_WINDOW)1,213 MB)0 MB), 0 ≥1 MiB0.0 MB/frame95.7 ms95.9 msCARD_BUFFERS_MB=1536+INDIRECT_WINDOW=1+INDIRECT_GATHER=11,210 MB)0.0 MB/frame42.0 ms36.4 msFor reference, our prior stack on
ca8829fwithVICTORY_CARD_BUFFERS_MIN_MB=1andVICTORY_CARD_BUFFERS_MB=1024had28.8 MB/frameCPU shader-write compare and59.8 ms(cardmeter60.0 ms) GPU title lists.Secondary note:
VICTORY_CARD_WINDOWS_MB=1024+VICTORY_WINDOW_UPLOAD=1when ReBAR GPU upload heaps are unavailableOn this Windows 10 22H2 / RTX 4080 setup,
GPU upload heapsloggedsupported=false. EnablingVICTORY_CARD_WINDOWS_MB=1024alongsideCARD_BUFFERS_MIN_KB=64(CARD_BUFFERS_MB=2048) hitno room on the card for one of 4096 KiB; so far 263 on the card (1024 MB), 512 turned down for the card's room, which slowedcardmeterGPU lists to88.0 ms.Suggestion
When
VICTORY_CARD_BUFFERS_MIN_KBis set below1024:VICTORY_CARD_BUFFERS_MBfor ≥1 MiB buffers (e.g., refuse sub-1 MiB card placements once headroom falls below ~256–384 MB) so small buffers cannot crowd out the large buffers that shaders hit hardest, orVICTORY_CARD_BUFFERS_MIN_KB < 1024andVICTORY_CARD_BUFFERS_MB <= 1024(recommending1536+on 12–16 GB cards).With
CARD_BUFFERS_MB=1536+#1014(CARD_HASH_WIDE),VICTORY_CARD_BUFFERS_MIN_KB=64is a huge win on RTX 4080:send-and-hashstays at6.9 ms,compareat1.4 ms, and title GPU lists drop to36.4–42.0 ms(44.7 mstotal GPU =22.4 fpsSeries X GPU ceiling).Imported from fxceless/victory-fork. Originally posted by Ym1r1710 on 2026-11-25T22:18:33Z.
Same here on an RTX 5080 16 GB (Series X,
9c184b3merged, CARD_BUFFERS_MB left at the default). Two runs with MIN_KB=64 against two without, same build and scene:The worse part: in both MIN_KB=64 runs the world turned black a few seconds after entering it (only the controls hint left on screen) and stayed black through world+800. The two control runs were normal. I didn't try a bigger CARD_BUFFERS_MB, so I can't say if that fixes the black screen too.
Imported from fxceless/victory-fork. Originally posted by Proudnoob4 on 2026-11-26T07:11:25Z.
Confirming
Ym1r1710's visual corruption finding on an RTX 4080 16 GB (Windows 10, Series S) even with a largerVICTORY_CARD_BUFFERS_MB=2048budget (controlled A/B in the opening prison cell scene):VICTORY_CARD_BUFFERS_MIN_KB=64+VICTORY_CARD_BUFFERS_MB=2048: 6 one-frame black shard / corruption flashes in 20 s (~18/min) — dark patches on Lucia's shirt and orange streaks across the yard — at24.9 fpsmedian.VICTORY_CARD_BUFFERS_MIN_MB=1+VICTORY_CARD_BUFFERS_MB=1536(same binary, same scene): 0 flashes in 90 s at21.9 fpsmedian.So even when
CARD_BUFFERS_MBis raised to 2 GB (avoiding ≥1 MiB starvation), lowering the threshold to 64 KB still introduces one-frame stale/corrupt buffer flashes on NVIDIA. KeepingVICTORY_CARD_BUFFERS_MIN_MB=1eliminates them cleanly.Imported from fxceless/victory-fork. Originally posted by m335671 on 2026-11-26T08:35:06Z.
A data point from a 12 GB card, RTX 4070 (Windows 11, Series X profile, first room, idle, one launch per row). It agrees with the cap explanation, and with a large enough cap it's a clear win here.
Our tree (diagnostics build,
main9c184b3+ #1093 + #1096 + #215 + #799 withVICTORY_WAVE_LDS_LOOSE=0;VICTORY_INDIRECT_WINDOW=1 VICTORY_LEVELS_ON_DEMAND=1 VICTORY_JOIN_PARTS=1 VICTORY_BACK_OWN_VIEW=1 VICTORY_COPY_PLAIN=1 VICTORY_INDIRECT_GATHER=1 VICTORY_CARD_REHASH_RUNS=1 VICTORY_TEXTURE_NO_WAIT=1 VICTORY_TEXTURE_BACK=1 VICTORY_AMBIENT=0.6). Last eight frame-log lines once settled:MIN_MB=1, 1024 MB)MIN_KB=64+CARD_BUFFERS_MB=1536+CARD_HASH_LEN=1With the second row,
3885 in the card's memory 1210 MB, none left in the PC's memory. No exception and no device removal. The end capture looks the same as the default one. I only have that one capture, though, so I can't rule out the one-frame flashes reported above.The other side of it. A build whose launcher sets
MIN_KB=64while capping card buffers at 512 MB (card_buffers_max_mb=512in its log) ran this room at 2.7–2.9 fps, about 300 ms on the GPU. WithoutMIN_KB=64it ran at 6.1–6.3 fps, about 95–105 ms. That's the same starvation as in the first post, only worse with the smaller cap.So on 12 GB it looks safe to use only together with a cap that holds every copy (about 1.2 GB here).
AI use: the runs were done on my machine. Claude Code (Claude Opus 5.5) ran them, read the logs and wrote this comment.
Imported from fxceless/victory-fork. Originally posted by Proudnoob4 on 2026-11-26T08:52:20Z.
SOLVED —
VICTORY_FETCH_CHECK=1eliminates theMIN_KB=64black-shard flashes on RTX 4080 (32.0 fpsmedian,34.4 fpsmax,0/60corrupted frames)!We found and verified the root cause of the 1-frame black-shard flashes we previously reported with
VICTORY_CARD_BUFFERS_MIN_KB=64:host/torn.rs): WithVICTORY_RELAY_COPY=1, the copy queue fetches small<1 MiBdynamic buffers back while a later flight is clearing/refilling them, landing torn intermediate bytes into the CPU side that later upload back over valid data.VICTORY_CARD_BUFFERS_MIN_KB=64+VICTORY_CARD_BUFFERS_MB=2048+VICTORY_FETCH_CHECK=1+VICTORY_SKIP_WC_BACK=1+VICTORY_SKIP_WC_COMPARE=1.VICTORY_SKIP_WC_BACK=1+VICTORY_SKIP_WC_COMPARE=1keeps write-combining buffers off the copy-back path (0.3 MB/framecopy-back), soVICTORY_FETCH_CHECK=1only has to verify~52pieces/frame.VICTORY_FETCH_CHECK=1actively caught and repaired0.9–3.5torn 64 KiB pieces per frame (100%recovered whole on re-fetch!).Measured 10-minute RTX 4080 16 GB (Windows 10, i5-13600K, Series S
render_scale=0.6667, RT skipped)n=109/114)MIN_MB=1,CARD_BUFFERS_MB=153676.5 s25.70 fps(38.9 ms)25.90 fps28.400.9 MBMIN_KB=64,CARD_BUFFERS_MB=2048,FETCH_CHECK=170.1 s32.00 fps(31.2 ms)32.00 fps(worst33.4 ms,0stutters>55 ms)34.400.3 MB0/60black flashes across two 15 s / 2 fps burst contact sheets (t=420..435,t=520..535), native frosted glass intactGPU wait dropped to
0.0 mson the GPU (13,375 MiBpeak VRAM,104.7 W,2805 MHz) — shifting the frame from GPU-bound to 100% CPU-bound (24.2 mspreparing +6.7 mscopy-back).Imported from fxceless/victory-fork. Originally posted by Proudnoob4 on 2026-11-26T14:39:16Z.
CRITICAL correction to our Pass 13 comment + verified root-cause fix (
VICTORY_SKIP_WC_MIN_KB, default1024KiB)After posting Pass 13 above, 5 consecutive 10-minute follow-up runs (
Pass 14,14b,14c,14don the exact same commit6733ddf, and14e) revealed that Pass 13 was a lucky 1-of-6 run: combiningVICTORY_CARD_BUFFERS_MIN_KB=64with unguardedVICTORY_SKIP_WC_COMPARE=1/VICTORY_SKIP_WC_BACK=1actually causes 66–72% full-screen black frames (spreading NaN/firefly blackout while 2D HUD stays crisp) and silently drops ~600–744 draws/frame.Exact root cause (measured from GTA 6 buffer census + 10-min A/B matrix)
Under
VICTORY_CARD_BUFFERS_MIN_KB=64, GTA 6 creates4,258carded buffers (711.1 MB):4,179are< 1 MiB(4,056< 64 KiB,6964–256 KiB,54256 KiB–1 MiB), and4,045of those (45.8 MB) live inside GTA 6's0x948a00000..0x998700000write-combining (0x2404) heap.79are>= 1 MiB(665.3 MB), of which ~40 are WC buffers.Piece-landing arithmetic across our controlled 10-minute A/B runs on RTX 4080 / Win10:
>= 1 MiBnon-WC card copies:54pieces/frame (1.3 MB)< 1 MiBWC buffers:263pieces/frame (3.3 MB) — MUST NOT BE SKIPPED. Skipping them drops~744 draws/frame(4,562 -> 3,818) and causes66–72%black frames.>= 1 MiBWC buffers:516pieces/frame (39.0 MB) — SAFE TO SKIP. Skipping them saves39.0 MB/frameand-7.9 mscopy-back with0/230black frames across 8 runs.Fix: gate
SKIP_WC_COMPAREandSKIP_WC_BACKby buffer size (VICTORY_SKIP_WC_MIN_KB, default1024KiB)In
crates/victory-gpu/src/census.rsandhost.rs:skip_wc_min_bytes()readingVICTORY_SKIP_WC_MIN_KB(default1024KiB =1 MiB).host.rs(card_beforedeclared.retain): only drop WC compare ifshadow.span().1 >= skip_wc_min_bytes() && all_wc(ranges).census::skip_back(copy_bytes, declared, bytes): returnfalsewhencopy_bytes < skip_wc_min_bytes().This preserves the exact
MIN_MB=1safety boundary for WC skipping while letting< 1 MiBbuffers live in fast VRAM (MIN_KB=64). (Especially important on Windows 10 WDDM 2.7 whereGPUUploadHeapSupported=false, soSMALL_BUFFERS_BAR_MBcannot place< 1 MiBbuffers in ReBAR.)Controlled 10-minute verification matrix (RTX 4080 16 GB, i5-13600K, Win10, Series S
render_scale=0.6667, RT skipped,t=140..600sn=230frame scan)BLACKframes (n=230)6733ddf)MIN_KB=64, unguardedSKIP_WC_COMPARE=133.8533.9(35.6)3,818(-744!)54(1.3 MB)74%152/230(66% BLACK)MIN_MB=1(1024 KiB),SKIP_WC_COMPARE=125.5525.6(28.1)4,562317(4.6 MB)99%(~39 ms)0/230(60/60bursts)MIN_KB=64,SKIP_WC_COMPARE=0,SKIP_WC_BACK=026.8526.9(28.2)4,525833(43.5 MB)77%0/230(59/60bursts)MIN_KB=64,FETCH_CHECK=1,SKIP_WC_COMPARE=1,SKIP_WC_MIN_KB=102432.0032.00(32.70,0>55 ms)4,505317(4.5 MB)61%(~18 ms)0/230(120/120bursts)Pass 15 highlights:
MIN_MB=1(25.55 -> 32.00 fpsmedian,31.3 msmed /32.3 msmax in tail-40,0stutters>55 ms).4,505draws/frame) and identical copy-back volume (317pieces /4.5 MB) toMIN_MB=1.VICTORY_FETCH_CHECK=1checked309.3pieces/frame and caught + recovered2.55torn pieces/frame (100%recovered whole).99%(~39 ms) to61%busy (~18 ms) — completely shifting the bottleneck from GPU tovictory-submit(32.8 msCPU).Imported from fxceless/victory-fork. Originally posted by anon31-006459 on 2026-11-26T17:08:53Z.
A Linux data point for the
MIN_KB=64artefacts, matching yourSKIP_WC_BACKfinding.Setup: RTX 3070 Ti 8 GB, NVIDIA 595.104.02, Proton Experimental 11.0-20261112. Fork main
ac25549merged into Zayfway'sperf/exopus-recipe, withVICTORY_SKIP_WC_BACK=1 RELAY=2 CARD_HASH_LEN=1 MERGE_GAP=64 MERGE_RUNS=4096 CARD_WINDOWS_MB=1024, Series S. (RELAY_COPYandFETCH_CHECKnot set.)With
CARD_BUFFERS_MIN_KB=64: constant flicker in the prison. Frames alternate between lit, untextured and black, and characters lose their heads with only the eyes, lips and earrings drawn. It happens in every run with it (runs 9, 10, 12 and 13). A run with the older #1820 set, withoutMIN_KB, was clean.Bisected by switch groups, one run each:
FILLS_PLAIN/STEP_INDEXoff: no change.MIN_KB,HASH_LEN,MERGE_GAPandMERGE_RUNSoff: stable.HASH_LENand the merges back on, onlyMIN_KBoff: stable (run 16).So
MIN_KB=64alone, withSKIP_WC_BACK=1on as in your Pass 14. I have not tried yourVICTORY_SKIP_WC_MIN_KBfix yet.The same symptom also appeared in a build of the cool_fox line (
grimygunnz/nvidia-3070-VI), whose launcher setsCARD_BUFFERS_MIN_KB=64too.AI-assisted (Claude Code, Claude Opus 5.5); observations from runs on my machine.
Imported from fxceless/victory-fork. Originally posted by grosterr on 2026-11-26T22:17:53Z.
An independent confirmation of Proudnoob4's size gate (Pass 15), from a 12 GB card: RTX 3060 12 GB, Ryzen 7 5700X, 32 GB RAM, Windows 11, Series S profile, prison prologue. Tree: fork main
52ac4ec+ #868 + #1081 + #798 + #1352 and others, release build.Every run used
CARD_BUFFERS_MIN_KB=64 CARD_BUFFERS_MB=1536 SKIP_WC_BACK=1 SKIP_WC_COMPARE=1, on top of our usual switch set (LEVELS_ON_DEMAND INDIRECT_WINDOW INDIRECT_GATHER COPY_PLAIN JOIN_PARTS BACK_OWN_VIEW CARD_HASH_WIDE ASYNC_SUBMIT QUEUE2 ...,RELAYat its default).SKIP_WC_BACKonlySKIP_WC_BACKandSKIP_WC_COMPARESo on this card it is the compare skip that matters, as in your Pass 14d. Gating only the copy-back changed nothing visible: with the gate, that run skipped no copy at all. In run 3 the frame splits into preparation 55 ms, copies 28, card 10-18, copy-back 7. On the Series X profile, our previous build (without these switches) measured about 180-190 ms, with 79 ms on the card and 56 ms of copy-back. The frame is now limited by the submitting thread, not the card.
We did not need
FETCH_CHECK(we do not setRELAY_COPY), and saw no flashes in run 3 without it.Our version of the gate is one variable for both skips,
VICTORY_SKIP_WC_MIN_KB(default 1024, the name used above): copies below it are always compared and always come back. Since #868 has neither skip gated, it may be worth adding there. Happy to open that as a small PR against #868's branch if its author wants it.Imported from fxceless/victory-fork. Originally posted by giacbiologicbomb on 2026-11-27T15:53:08Z.
Another 12 GB data point that agrees with the cap explanation, plus the default that seems to cause it on this card class.
Machine: RTX 5070 12 GB (DXGI local budget 11,175 MB, driver 621.40), 16 GB system RAM, Windows 11, Series X, warm cache. Frame lines once the world had settled, medians of the second half of each run, one run per row, so treat the ranges as indicative.
card buffer limitsin the logMIN_KB=64,CARD_BUFFERS_MBunsetMIN_KB=3084(value in the wrong field), MB unsetCARD_BUFFERS_MB=3084, one withMIN_KB=2048Why I think it is the default, not the card: in the tree I read,
default_card_limits_mb()returns (16 MiB, 512 MB) for budgets up to 12 GiB, andVICTORY_CARD_BUFFERS_MIN_KBonly lowers the minimum, not the cap. So withMIN_KB=64every buffer qualifies but only 512 MB of copies fit, and the rest stays on the CPU. The number to watch isof them N MB in copies of 1 MiB or morein theshader writes looked for on the CPUline: 0 means every large copy is on the card. The older tree'scard_limits()has a comment saying it was raised from 16/512 to 1/1024 so that smaller buffers' shader writes are found by the card's hashes too.Caveats: different trees per row, so this is not an isolated switch test; I did not measure VRAM use with the larger cap; the reporter saw some textures not loaded in the best run, so I'm not claiming the image is right. Process private memory peaked at 21-22 GB on this 16 GB machine in the best runs (22.5-24 GB in the others), with free memory touching ~0 in all of them.
AI-assisted (Hermes Agent, Claude); no game data.