VICTORY_WC_BAR=runs: write only the dwords the title changed into the mapped copy (fixes the #553 flicker) #1927
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1927"
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 vdkipnis on 2026-11-29T03:07:53Z.
Fixes #553
What it changes
#553 found that
VICTORY_WC_BAR=1takes a large share of host-copy cost away, but the whole screen flickers. The cause is the onewc_bar()'s own doc comment names:#553 suggested writing only what the title wrote, not whole pages. This builds that, as a new value:
VICTORY_WC_BAR=runs.=1is unchanged.Referenceinshadow.rs).Shadow::copyof such a copy goes tocopy_changed. It compares title memory with the reference using the existingword_runs(AVX2 where it can), and writes only the differing dwords into the mapping and the reference.placed_copy: puts the bytes into the reference too, because the submission writes them into the mapping.=runs, only copies of at leastVICTORY_WC_NO_BACK_MIN_KBare mapped. Smaller ones the title reads back keep two sides, for the reason in #355; this is the same cutoff #481 proposes for=1.Why it should be right
Limits and known gaps
send_changed()documents, andVICTORY_SEND_CHANGEDis off by default since a run where it broke a room's light and geometry. I did not see such breakage here, but one run cannot rule it out. If it shows up, the buffer it happens in needs to stay on two sides.=1, not new:=1.VICTORY_WC_NO_BACK_MIN_KB. The launchers set 1024; unset it is 0, and small read-back buffers would be mapped too.=1used none; the default two-sided path uses the same.=1go black with white flicker on an RX 7800 XT; whether that is the same cause and whether=runshelps there is unknown.wc_mapped_formaps only while a fifth of the budget is free.mapped_card_bufferreturns none and the copies stay on the default path. I read that path but did not run it.=1helped. I have not measured=runsthere.VICTORY_PORT_CONSTANTS=1on top, this card got much slower (frame 70 ms against 48, the card waiting about 17 ms a frame on PCIe reads, as in #1223). I take that to be port #1 on a x8 link, not this change, but the two were not separated.VICTORY_INPLACE,VICTORY_WINDOWS_BAR_MBorVICTORY_SEND_CHANGED.How it was tested
d4b5d51plus two local switches, both on in the before and the after runs:VICTORY_LDS_WRITE_ONLY_OK=1: without it, #43's analysis refuses theInstanceCulling:CS_Tree_BatchCull_*programs on this 32-lane host, and trees are culled until right in front of you.568c5e5d. The only conflict there was both sides adding a test module at the end ofshadow.rs.VICTORY_WC_BARunset), 4 min, 31 frame lines with 500+ draws:VICTORY_WC_BAR=runs), 10 min, 77 lines, same save and route:cargo test: passed for the crates it touches.cargo test --locked --release -p victory-gpu --lib -- wc_bar_runs_tests write_combinedgives 3 passed:take_changed_intokeeps shader writes outside the changed dwords, on aligned and unaligned stretches;write_combined_regions.cargo clippy -p victory-gpugives no warning in the changed code.Checked for overlap
=1, also inwc_bar; compatible, and=runsapplies the same cutoff.WC_BARon AMD, not tested here.Vibe coded with an AI assistant (Claude); one run on one PC. Treat it as unreviewed until someone who knows
shadow.rshas tested it properly.🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by vdkipnis on 2026-11-29T03:14:01Z.
Update: textures look broken on my end. Please treat this as unconfirmed.
In a longer session with
VICTORY_WC_BAR=runs, a lot of textures simply stopped loading. We don't know yet whether this change caused it.VICTORY_TEXTURE_BUDGET_MB=9000, not this change.first-upload room decisions: 0 allowed, ~50,000 refused by an explicit byte limitevery 5 s once texture copies reach that cap.resource.rs, an explicit limit is absolute and doesn't count the mapped buffers.=runsand the texture cap removed, so the build's own guards handle texture memory. If textures load there, the cap was the problem. If they don't, this change is the suspect.The goal is to get this working without breaking textures, if that's possible at all. Whether the approach is feasible is still an open question. I'll report back here either way. Until then, please don't rely on the performance numbers above.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by POMXARK on 2026-11-29T03:45:24Z.
@vdkipnis Quick testing heads-up for anyone A/B testing
VICTORY_WC_BAR=runson this PR:Before collecting A/B numbers, check
nvidia-smi -q | findstr /I "BAR1"and confirm the log printscard memory the CPU maps supported=true.On our RTX 5080 test rig, BIOS Resizable BAR was off by default (
BAR1 Total : 256 MiBinstead of16384 MiB), which makesD3D12_FEATURE_D3D12_OPTIONS16::GPUUploadHeapSupportedreturnfalseand causesVICTORY_WC_BARto silently fall back to standard staged copies!Enabling Above 4G Decoding + Re-Size BAR Support (with CSM disabled) in BIOS expands BAR1 to full VRAM and unlocks Tier A
D3D12_HEAP_TYPE_GPU_UPLOAD(direct CPU writes into GDDR for the ~4.46 GB write-combined pools).We opened a central community testing thread to collect ReBAR-ON vs ReBAR-OFF numbers (plus Tier B
OpenExistingHeapFromAddressfallback benchmarks for256 MiBBAR1 systems): https://github.com/trustno1-coder/VIctory-NVIDIA/discussions/1947Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by vdkipnis on 2026-11-29T05:54:14Z.
Follow-up, as promised: parking this.
I ran the test from my last comment:
=runswith the texture cap removed, so the build's own guards manage texture memory. Results on an RTX 4060 Ti 16 GB, PCIe 4.0 x8, ReBAR on (supported=truein everyWC_BARrun):WC_BAR=runs: textures loaded properly. After about 6 minutes the card ran out of VRAM: DLSS reported "out of VRAM", the gun menu flickered, then nvlddmkm event 153 and the device was lost. It did the same with the texture line lowered to 70%, after about 13 minutes.On my setup, the texture memory in latest upstream (
d4b5d51) is unusable whether or not this change is applied. That rules out a clean test of this PR here. The mapped buffers are a constant ~471 MB, which may be what tipped the no-cap runs over, but I can't separate that from upstream's own texture overflow.So I'm leaving this as an open draft and not working on it further. The flicker fix and the fps gain looked real to me (ReBAR verified active), but treat this as unproven until someone tests it on a build with stable texture memory. The diff is small (
shadow.rs, off unlessVICTORY_WC_BAR=runs), if anyone wants to pick it up.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by POMXARK on 2026-11-29T06:07:15Z.
@vdkipnis Tested PR #1927 (
VICTORY_WC_BAR=runs) live in-game on Ryzen 7 5700X + RTX 5080 16 GB (BIOS ReBAR ON,BAR1 = 16,384 MiB, Agility SDK1.614.1, PCIe 3.0 x16, DLSS Quality + FG 4x) vs identical ReBAR-OFF baseline (10-minute matched runs; note: tested on our local fork branch withSETTLE_UNLOCKED,DUE_WHEEL,AHEAD_GAP_KB=512,XMEM_CPU_UNWATCHED,CARD_MULTI_BATCH,LIST_VIEWS_FRAME; only variable changed was ReBAR ON +VICTORY_WC_BAR=runs):wc_bar_runs_tests2/2 PASS.card memory the CPU maps supported=true,102WC BAR runswindows (comparing450–613 MB/5 s, writing only6–22 MBchanged dwords — 95–98% skipped).VICTORY_WC_BAR=runs):12.00 -> 15.00 FPS(+25.0%,82.8 -> 68.1 ms)1k–4k:15.00 -> 21.00 FPS(+40.0%,67.5 -> 46.8 ms)4k–7k:13.00 -> 15.50 FPS(+19.2%,75.8 -> 65.6 ms)7k–10k:8.00 -> 8.00 FPS(125.5 -> 123.8 ms)>=10k:10.50 -> 11.00 FPS(+4.8%,96.8 -> 94.3 ms)9.2 -> 10.4 FPS(+13.0%p50 /+19.5%mean),Prep 91.5 -> 72.0 ms,copies 53.3 -> 42.2 ms (-20.8%),write watch 4.7 -> 2.3 ms (-51%)DXGI Sharedmed7,417 -> 6,165 MB (-1.25 GB),buf_card_mb 1,097 -> 420 MB,MinRAM 0.29 -> 1.10 GB, VRAM max12,265 -> 12,807 MiB; trade-off: Commit max29,322 -> 30,277 MB (+955 MB)due to the CPUReferencecopy.Full write-up also posted in #1947 — awesome fix for #553!
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Bazovsky on 2026-11-29T11:00:58Z.
A data point from an RTX 5090 (32 GB) + Ryzen 9 9950X3D: 2560x1440, DLSS Quality, frame generation off, ray tracing off, started with
victory play(soVICTORY_WC_NO_BACK_MIN_KB=1024).e1f2eb6with this PR merged in, one exe, the switch alone changed, 190 s runs in turn with other variants. A loaded save standing in the first playable scene (about 4,800 draws a frame), seconds 60 to 140 of 3D counted:VICTORY_WC_BAR=runsMeasured unattended by an AI assistant (Claude Code) on my PC.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Headache3318 on 2026-11-29T17:55:09Z.
Data point from 3x RTX 4090 (24 GB, ReBAR verified 32 GiB BAR1 via
pci=nocrs, driver 620.73) + Arch, bare Proton GE11-14, leak v1.0.2.1, fork v2026.11.28.03 → 29.01 (AI-assisted: Hermes Agent).VICTORY_WC_BAR=runswas the single biggest CPU-side win we measured before the wall moved to the GPU: the per-frame report line "texture refreshes per frame" went 36.2 ms → 3.2 ms when we added it (withVICTORY_SETTLE_UNLOCKED=1 VICTORY_AHEAD_GAP_KB=512 VICTORY_WIDE_THREADS=8). Same story as @Bazovsky's "taking the bytes out of the CPU sides" column, at much larger absolute scale — on this title the copy path was the first wall; afterrunsthe GPU became the limiter at last.One multi-GPU warning for anyone following this thread's earlier
nvidia-smibudget talk:nvidia-smibudget is not ground truth here — a second card parked at 23 GB by other apps (our case: an LLM host on card 2) while the game sits on a free card, and the title still logsbudget 590 MBfor the right adapter (own_memory_mb=24564in the same log). Trustlspci -vvBAR sizes, never the budget line — and note the F2 advisor on 29.01 stopped blaming copies entirely once the shader backlog drained; on our box the copy wall became invisible behind the compile storm, which may be why others see smaller deltas.Full Linux multi-GPU recipe (nocrs + ReBAR, vkd3d device pinning, gamescope index trap, preload) is in #1898.
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.