gpu: placed-texture span lock skipped by default; texture-queue batch size tunable (VICTORY_QUEUE_BATCH_MAX) #1937
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!1937
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1937"
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?
@danielibabet on GitHub · 2026-11-29 03:30 UTC · original
danielibabet:perf/spans-quick-default→main· +21 −12 · 1 files · 1 commits · merged 2026-11-30 14:12 UTCWhat
Two changes to
crates/victory-gpu/src/descriptor/host.rs, both off by default until now:1.
VICTORY_SPANS_QUICKon by defaultThe
placed: Mutex<Spans>inHostHeapis taken on every descriptor write to decide whether a slot describes a placed texture by address.spans_quick()gates a fast-path skip using thespannedbitset (already in RAM, no lock needed to read): if the slot is not inspanned, the span lock is not taken.Previously the guard read
is_some_and(|v| v != "0")— opt-in. This commit flips it to opt-out (VICTORY_SPANS_QUICK=0to disable). The semantics are unchanged: forgetting a slot that is not there does nothing — the bitset is the authoritative gate.Measured saving (from
docs/findings.md, run city4, timeline 113): 4 of the 16 ms the submitting thread waited for the records pass with six recording threads came from threads queueing behind that lock. On an RTX 4070 (fewer hardware threads than the RTX 5090 D where this was measured, so less ability to pipeline around the wait), the absolute saving is at least as large.Ported from Belobug/VIctory-Belobug-AMD
a284ca7, where this is on by default.2.
VICTORY_QUEUE_BATCH_MAX— tunable texture-queue batch sizeQueueBatchamortizes texture-queue WRITE lock acquisitions by buffering operations and flushing under one lock take. The flush threshold was a compile-time constantLIMIT = 64.VICTORY_QUEUE_BATCH_MAX=N(integer 1–4096, default 64) raises this limit.docs/findings.mdmeasures 34,000–78,591 WRITE lock acquisitions per 5-second window in the outdoor areas; a larger batch size reduces the number of acquisitions per recording thread proportionally.The bloom-filter field
seen_bits(u64, covering 64 unique slot indices) produces false positives above 64 ops, buthas_slotalready falls back to a linear scan ofself.opsto confirm — no behavioral change at any batch size.Tests
cargo test -p victory-gpu --lib --locked -- --test-threads=1: 589 passed, 0 failed, 44 ignoredcargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings: clean (pre-existingvictory-shaderclippy error onlower.rsunrelated to this change)cargo build --release -p victory --locked: cleanxtask policyfailure onvictory-shader/src/emit/lower.rs(711 KB > 655 KB limit) is onmainbefore this change.Hardware target
RTX 4070 12 GB (Wave32), i9-14900KF, 32 GB RAM, Windows 11. Build verified. 3D-world measurement requires manual game input to reach the open world; menu runs at 30 fps either way and do not exercise the descriptor-write hot path.
@amazedturnip on GitHub · 2026-11-29 05:39 UTC · original
Tested on 9800X3D + RTX 5070 Ti 16 GB across 20+ min sessions with VICTORY_SPANS_QUICK=1. Skipping the placed-texture span lock ran cleanly with zero descriptor races or corruption.
@meonline42 on GitHub · 2026-11-29 09:18 UTC · original
Measurements from a Zen 3 + Ampere machine, in case they're useful (stacked builds, so most PRs aren't isolated, see below).
Machine: Ryzen 9 5900X (thermally limited: ~3.7 GHz average, Tctl 80-87 °C), RTX 3090 at 350 W, 64 GB DDR4-3200, Windows 11. Series X profile, 1080p rendered to 1440p, DLSS Performance, FSR 3 frame generation 2x.
Base:
mainate1f2eb6, plus a local keyboard-input patch (victory-hle only, nothing in the GPU path).Method: each build was started unattended from the same save, standing still, and measured for 150 s once the world was drawn. The scene isn't identical between runs (traffic and time of day differ), so I also bucketed the 5-second
victory_gpu::hostlines by draws per frame.maine1f2eb6VICTORY_PRESENT_QUEUE=1VICTORY_SPANS_QUICK=1, so its default flip made no difference in this run.preparing: copies of 24-28 ms for 60-70 MB per frame, and the card busy only a few ms. Copy-back dropped from ~13 ms to ~6.5 ms between923e38cande1f2eb6.Posted by Claude Code on behalf of the machine's owner.