victory-gpu: stall-free per-draw zero-alloc and COM fast paths (2.74×) #801
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!801
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-801"
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?
@mint17 on GitHub · 2026-11-28 06:18 UTC · original
mint17:perf/draw-zero-alloc-com-fast-paths→main· +686 −175 · 2 files · 1 commits · merged 2026-11-28 19:39 UTCSummary
Eliminates hot-path heap allocations, SipHash overhead, and redundant COM reference-count traffic during per-draw recording in
victory-gpuwhile deliberately keeping direct per-viewCopyDescriptorsSimple(1, ...)copies and compact 64-byteFreshTablehash buckets:HostHeap::keep_ref& single-lookupmake_listed(crates/victory-gpu/src/descriptor/host.rs):self.kept[index]to skipAddRef/retirement on identity rebinds, retiring displacedID3D12Resourcehandles strictly outside the slot lock and strictly after descriptor copy / twin update.views.madelookups onmake_listedcache hits with a single lookup while keeping directCopyDescriptorsSimple(1, ...)(no multi-rangeID3D12Device::CopyDescriptorsbatching, avoiding multi-threaded D3D12 driver serialization stalls).raw_at,raw_uav_at, andconstant_attokeep_ref.host_signatureTLS cache (crates/victory-gpu/src/draw.rs):static MADE(matching existing process-lifetime retention) and caches plain&'static ID3D12CommandSignaturepointers inthread_local!viatry_with().AddRef/Releaseon hotExecuteIndirectcalls andmerge::Heldjoin checks, and zero COMReleasecalls on thread teardown.AddressHash+ borrowed&Arc<Shadow>hit path (crates/victory-gpu/src/draw.rs):root_srv_slotsandroot_uav_slotsfrom default SipHash toAddressHashand borrows&Arc<Shadow>on hits (moving without cloning on misses).Few<u32, 16>inState::tables(crates/victory-gpu/src/draw.rs):Few::dedupandPartialEq/Eq/Debugpreserving inline invariants and removes per-drawVec<u32>allocations when selecting descriptor tables.ReadyReaderinVec<ReadyReader>(crates/victory-gpu/src/draw.rs):FreshTableat 40 B (<= 48 B) and itsHashMapbucket at 64 B (<= 64 B), guarded by compile-time layout assertions (avoiding inline-array bucket bloat).Conflict Hygiene
set_targets/State::host_targetsuntouched (conflict-free with #390).git merge-tree --write-treewithorigin/main, #704 (perf/dynamic-slots-bitmap-batch-release), and #720 (feat/heap-worker-race-safe).Benchmark & Verification
draw_zero_alloc_bench, 250,000 draws):44.0 ns/draw(baselineVec+ SipHash +Arc::clone+ 40 B reader) ->16.0 ns/draw(Few+AddressHash+ borrow + 24 B reader) — 2.74× faster.cargo test --locked -p victory-gpu --lib -- zero_alloc_tests descriptor::host::tests draw::record_hash_tests -- --test-threads=1: 54 passed, 0 failed (1 ignored opt-in bench)cargo test --locked -p victory-gpu --lib --features diagnostics -- zero_alloc_tests -- --test-threads=1: 5 passed, 0 failed (1 ignored opt-in bench)cargo clippy -p victory-gpu --all-targets --locked -- -D warnings -A clippy::manual_is_multiple_of(default &--all-features): 0 warningscargo test --locked -p xtask: 6 passed, 0 failed@Dukestar69 on GitHub · 2026-11-28 07:11 UTC · original · approved these changes
Tested locally merged onto
main(63b902f).cargo xtask policypassed (294 files ok).cargo test -p victory-gpu --lib descriptor::passed (63 passed; 0 failed, includingzero_alloc_tests::keep_ref_skips_clone_on_identity_and_retires_on_replacement).cargo test -p victory-gpu --lib draw::passed (12 passed; 0 failed; 2 ignored, includingfresh_table_fits_single_cache_line_bucket,few_dedup_and_eq_preserve_inline_invariant,ready_reader_layout_and_fresh_table_matching_and_clearing, andhost_signature_shares_static_com_pointer_across_threads).Strong per-draw hot-path optimization with clean lifetime/COM-pointer invariants and solid unit coverage. LGTM.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@POMXARK on GitHub · 2026-11-28 07:34 UTC · original
Tested this PR across two 20-minute 3D A/B runs on Windows 11 — PASS on warm-cache 20m run (strong
Prep/heapreduction and+16.7%..+26.9%on heavy 3D draw workloads,-48.9%frames >100 ms, 0 errors).Setup
tearing=true), default4 MiBwindows,VICTORY_GPU_BCPACK=0,VICTORY_WAIT_RESIDENT=0,VICTORY_TEXTURE_ROOM_PERCENT=70,VICTORY_LAND_SKIP=1.v2026.11.27.10(8fc2254) + AVX2/ThinLTO + PR #516 + PR #340 + PR #81 + PR #666 + AVX2Shadow::take/ PR #498 (c41d01d). All production hunks of PR #801 applied cleanly (minor EOF offset only formod zero_alloc_tests).cargo test --locked -p victory-gpu --lib -- zero_alloc_tests descriptor::host::tests draw::record_hash_tests -- --test-threads=1(VICTORY_D3D12_WARP=1) — 55/55 passed (0.79 s).20-Minute 3D A/B Results (Strict 3D-only, Draw-Count-Matched)
c41d01d, 20m)0 / 0 / 00 / 0 / 0hw.csv)328 / 328(100%)325 / 325(100%)100%n=162 / 181)13.1p50 (Prep 63.3,heap 17.9 ms)13.5p50 (Prep 52.7,heap 9.7 ms)Prep -10.6 ms,heap -8.2 ms11.4p50 (87.8 ms,Prep 69.2,heap 19.6)13.3p50 (75.2 ms,Prep 54.3,heap 3.2)+16.7%,max 112.3 -> 93.8 msframe_times(3D)65.0med /85.3p95 /97.7p99 (1,684>100ms)71.4med /78.4p95 /86.8p99 (861>100ms)p95 -6.9 ms,p99 -10.9 ms,>100ms -48.9%n=44 / 47)13.20p50 (Prep 63.0,heap 16.5 ms)13.40p50 (Prep 55.5,heap 9.7 ms)Prep -7.5 ms,heap -6.8 msn=35 / 38)10.40p50 (96.4 ms,Prep 75.7,heap 18.8)13.20p50 (75.8 ms,Prep 56.4,heap 3.8)+26.9%,Prep -19.3 mshw.csv)SharedMax 9,468 MB,CommitMax 30,272 MB,MinRAM 0.75 GBSharedMax 8,860 MB,CommitMax 29,689 MB,MinRAM 1.84 GBSharedMax -608 MB,MinRAM +1.09 GBNote on Run A (first run)
1k–4k:18.80,4k–7k:15.30,7k–10k:11.00,>=10k:10.50 FPS,n=15) before hitting a transientviews made again and slots flipped/ pipeline-compile stall (6.7 s->84 sframe) at13m38sthat tripped the guest's ~30s hang watchdog (0xc0000005write0x0at+0x23cf683, similar to #628).1204 s) with0errors,0exceptions,0GPU>=50ms,0frames>=250 msacross360..1200 s, and100%responsiveness.@nick0451 on GitHub · 2026-11-28 09:21 UTC · original · edited 2026-11-28 10:00 UTC
Tested in the game: RTX 3090 24 GB (driver 610.88), i9-14900K, Windows 11. Release builds, each of #797, #801, #814 and #816 merged on its own onto main at
63b902f.How: the same frozen save, outdoors on a balcony by the water, about 5,900-6,100 draws a frame (corrected: I first wrote "an interior"). Series S, DLSS Performance, frame generation off, standing still. Each build is started once first as a warm-up (a new build's first start is slow), then the five builds are run in turn, three rounds. Each run is 40 s to settle, then 60 s measured, and the figures are medians of the frame lines. An A/A run of main against itself the same way differed by 2-3%, so smaller differences are noise.
63b902fFor this PR: no regression, and +1% fps here, within noise. Preparing is unchanged. The per-draw CPU savings would need a scene where the submitting thread is the limit to show.
In this scene the card is about 95% busy, so the frame is the card's. Work saved on the CPU side would show in "preparing" more than in fps.
No crashes, device losses or
ERRORlines in any build: about 7 minutes in the world each, warm-up included.Tested with an AI assistant (Claude Code); results are from this PC.
@yeedgrthfgv on GitHub · 2026-11-28 09:59 UTC · original
Tested this on a Ryzen 5 9600X (6 cores) with an RTX 5080, Windows 11, Series X 4K output, DLSS Performance, frame generation 2x, THIN on with JOIN_PARTS 8, opening prison scene, about 4,800 draws a frame. Release builds of
63b902fand of this PR (0a68f4a), warm cache, alternating runs, mean fps from 30 to 150 s after the world starts:63b902fSo about +0.3 fps (1 to 2 %), which is inside the run to run spread here (about 1 fps). The preparing time was the same, 28 ms a frame both ways. On this PC the frame is set by the submitting thread's other work, so I could not measure a gain from the recording side.
No crash and no new warning in the three runs with this PR (about 12 minutes). One of the
63b902fruns ended with a device removal (0x887A0006, relay fence) after about 2.5 minutes, so that is not from this PR.