Host-side performance & diagnostics findings: descriptor fingerprints, heap-view pass, and a 115 ms/frame lock #1149
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#1149
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?
@liuycsbxbxn on GitHub · 2026-11-25 21:39 UTC · original
Results at a glance
RELEASINGlockVICTORY_COPY_PLAIN=1on the submitting threadTwo of those numbers (the lock waits) did not move frame time when removed — they are
contention, not critical path. That is itself the useful finding.
0001 — offline tools: name a shader, dump IR, count foldable patterns
Three additions to the offline tools, no runtime behaviour change.
translate --warm <file>prints<hash> @0x… <archive name>for every container ittakes. A run logs cost by pipeline hash; without this line a cost cannot be read back as a
shader. This is how the cost/name table was produced — the top of which is
MS_VS_PedTransformPreSkinD7.4 ms/frame,CS_GenerateShadowMasks_Checkerboard_NoHair6–9 ms,
MS_VS_CascadeShadows_draw5.1 ms.VICTORY_DUMP_IR=<dir>writes the translated IR of each program as text;VICTORY_TRANSLATE_ONLY=<hash,…>(already existed) narrows a run to the shaders ofinterest. Three shaders: 0.4 s, 7,090 IR instructions.
emit/bitcode/census.rscounts three foldable patterns in the emitted module —bitcastofbitcast, anextractof the same lane of the same value twice, and aselectwhose arms are one value or whose arm is chosen by a constant.Over all 25,636 programs / 95,055,345 instructions of
shaders.rpf:Conclusion worth keeping: the existing clean-up passes already remove these. A peephole
pass for them would find nothing — so nobody needs to write one. The counters stay as a
regression guard (three extra columns in the census table).
0002 — host-side performance and lock diagnostics
descriptor/host.rs):RwLock<Vec<AtomicU64>>instead of
Mutex<Vec<u64>>, one atomic per record. Profile: waiting on that mutex28.9 → 0.97 ms/frame. Frame rate unchanged — the waiters were not the critical path;
the change removes contention, not time.
draw.rs,host.rs):(the 16-pass full rescan still re-reads them all) — 37.5 → 29.5 ms/frame (median of 62
samples in one scene);
base + index * step— walk19.4 → 17.1 ms;
frame line. Measured skip rate 9–32%; the rest are descriptors the title really
rewrites (about 12,000 a frame, 1.6 µs each including one host view creation), so 10 ms is
out of reach this way.
VICTORY_LOCK_STATS=1(diagnostics): waits bucketed by mutex address, the five worstprinted with the frame line. It found that one static lock,
RELEASINGinqueue.rs,accounts for 115 ms/frame (3–4 waits of 28–43 ms) because it is held for a whole burst of
parts.
VICTORY_RELEASE_TRY=1(off by default): a caller that finds another thread releasingreturns at once, leaving its queues to that thread. The 115 ms of waiting drops to zero and
the frame time does not move — again, the waiters were never the critical path. Left in
as an experiment switch only.
VICTORY_TEX_HASH_EVERY=<n>(default 8 = unchanged): interval of the guard'swhole-texture hashes for view-memory textures. 16 halves the hashing for 0.75 ms/frame,
at the cost of a longer window in which a write through another view goes unseen — so 8
stays the default.
The one existing setting worth turning on
VICTORY_COPY_PLAIN=1— a copy of title memory becomesrep movsbwith an exceptionhandler that falls back to the kernel when a page is gone.
| submitting thread | default | `VICTORY_COPY_PLAIN=1
@spk-c on GitHub · 2026-11-26 01:08 UTC · original
The distinction between contention and critical-path cost is useful here. On our RTX 4090 / Ryzen 9 9950X3D / Windows 10 release reference (ad3f267), three consecutive periodic windows with zero pending pipelines showed:
#1231 adds
VICTORY_HEAP_PROFILE=1(off by default), splitting the buffer-heap work into descriptor scan/mirroring (including locks), grouping spans per shadow, and refresh. It complements the lock measurements here; it does not replace them. Reference notes.These are changing streaming workloads, not controlled comparisons. The timers overlap, and heap wall time is not necessarily time on the frame's critical path. The instrumentation passed fork CI; a matched runtime phase comparison is still outstanding. AI-assisted analysis and implementation.
@liuycsbxbxn on GitHub · 2026-11-26 13:04 UTC · original
Thanks - that table is the right correction to make. Across three consecutive windows the heap pass moves 89.4 -> 38.3 -> 49.2 ms, so a single-scene median says less than it looks like it does.
What 37.5 -> 29.5 actually are: a paired A/B on the same scene and the same window sequence, median of 62 samples each side, one machine - the delta is comparable inside that run, not an absolute figure. Your 4090/9950X3D numbers put the absolute level far higher, which fits.
We agree on the critical-path point, and it is the same result the locks gave: removing 115 ms of
RELEASINGwaits moved frame time by nothing. Heap wall time deserves the same suspicion, and #1231 splitting it into scan/mirroring (with locks), span grouping and refresh is exactly the instrument for the matched phase comparison you say is outstanding - I can't run it here (no dump, no card, Intel iGPU only), so my numbers only ever describe one scene on one machine.Worth knowing when weighing CI too: on a clean fork of
mainthe repo's own CI fails at the Clippy step before the tests (manual_is_multiple_of/ dead-code), so red CI on this tree is not a signal about a change.Still open from the report: would the two patches (0001 tools, 0002 host performance) be welcome as a PR, or better kept as switches in a fork?