Profile: opt-in VICTORY_PROFILE (frame times, memory, caches, loads; frames.csv, a Perfetto trace and an on-screen overlay) #130
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!130
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-130"
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?
@Sunkiller-qc on GitHub · 2026-11-24 00:48 UTC · original
Sunkiller-qc:perf-profiler→main· +4090 −12 · 32 files · 11 commits · openAn opt-in profiler, so performance and hang reports (#71, #16/#29) can start from aggregate numbers that anyone can collect and paste without game data. It now also covers the GPU side of #71: the worst GPU commands, dropped and zero-group work per frame, and a live log that names the command the GPU is stuck in before a TDR.
Status: rebased onto
mainat70564ae. On Windows with Rust 1.98.1,cargo buildandcargo clippy --all-targetsare clean, both plain and with--features victory-gpu/diagnostics.cargo testpasses forvictory-profile(33 tests),victory-hleandvictory.victory-gpuhas 76 passing and 2 failing (descriptor::host::tests::dynamic_slots_are_held_until_releasedandmemory::tests::lists_share_a_table_and_copies_keep_their_views); both fail the same way on70564aealone. Not yet run in game against a hang.What it does
VICTORY_PROFILE*variable is set whenvictory runstarts. When it's off, each hook costs one relaxed atomic load. It works in any build, release included.VICTORY_PROFILE=1: a summary every 5 s in the log (targetvictory_profile):resource::texture_counts;ReadFiles);VICTORY_GPU_TIMING=1and DRED markers (diagnostics build): the worst 8 GPU commands of the period and of the run. Each row has max / median / total ms, runs, the list's GPU time, and the command as its marker names it (indirect kind 2 max 1 [compute ...],mesh 3 [mesh ..., pixel ...]), with hex values blanked. It also shows the slowest submission with its list count and pipelines.VICTORY_PROFILE=<dir>(refused inside the repo) also writesframes.csv(one row per frame, now withdroppedandzero_groups) andtrace.json(Perfetto).VICTORY_PROFILE_OVERLAY=1: an on-screen panel (F3 toggles it) with the same frame, memory and cache data.VICTORY_PROFILE_DUMP=30,90: a full report at those seconds, with every thread's stack in a diagnostics build. One is also logged inhost::fail.VICTORY_PROFILE_LIVE=1(=framefor one line per frame,=<file>for a path): one line a second on the console and in<dir>\live.log(or%TEMP%\victory-live.log), withsync_dataafter every line so the file survives a TDR. Each line has CPU and GPU time per frame, the slowest submission and command of the window, the last marker the GPU finished (or the one it is in), dropped and zero-group work per frame, and VRAM and shared memory against their budgets. Warnings are written at once (at most 10 a second):SLOW COMMANDandSLOW SUBMISSIONoverVICTORY_PROFILE_LIVE_SLOW_MS(default 100),STALLwhen no marker passes forVICTORY_PROFILE_LIVE_STALL_MS(default 1000, then at each doubling), andFAILUREwhen the host GPU fails.How it uses what's on main
VICTORY_GPU_TIMING's timestamps (HostList::slowest), and command names come from the DRED markers (HostList::note). They are aggregated, not measured again. The slowest submission lists its pipelines the same way as the "slow host submission" log.WriteBufferImmediatefor direct queues, each marker also writes two words (commands begun, commands finished) into a mapped read-back buffer for its list. They are cleared at submit and read by the live thread while the submission is in flight. The DRED breadcrumbs keep giving the post-removal view, and this gives the same position while the run is still alive.draw.rs's drop sites (one helper instead of six adds) andlist.rs's indirect drop. Zero groups are counted for direct draws and dispatches only. For indirect arguments, the docs point toVICTORY_CAPTURE_FRAMES+VICTORY_DUMP_TARGETS, which already log them.6d021fe(world frame cost) changes page tables and copy statistics and does not overlap.Design
victory-profile, depending only onvictory-core,tracingandwindows-sys. Each call site's macro looks up its stat once into a staticOnceLock; after that, updates are relaxed atomic adds. A background thread writes the summaries; another (live mode only) ticks every 100 ms.VICTORY_GPU_TIMINGthey can move a hang.Known limits
@jeremygold02 on GitHub · 2026-11-24 04:28 UTC · original
Tested head
0ba0851dea0f9452c104c4f71888232dd1958fd1:cargo test -p victory-profile --lib -- --test-threads=1— 24 passed, includingoverlay::tests::colors_in_every_format,stats::tests::nearest_rank_percentiles, andtests::settings_from_the_variables; these cover overlay pixel encodings, summary statistics, and settings parsing (overlay, stats).cargo test -p victory-hle --lib -- --test-threads=1— 86 passed, including existing XMem reporting and allocation tests.cargo check -p victory-gpuandcargo check -p victory— both passed, compiling the changed GPU overlay and app startup call sites (GPU overlay, app startup).No GPU unit tests or title run was performed, so live GPU interaction and on-screen overlay appearance remain unverified.
@Marvisak on GitHub · 2026-11-25 00:25 UTC · original · edited 2026-11-25 15:54 UTC
Automated triage for the maintainers.
This pull request no longer merges cleanly into
main(conflicts inapps/victory/src/run.rs,crates/victory-gpu/src/host.rs,crates/victory-gpu/src/texture.rs). It will be reviewed once it is rebased onto the currentmain. The earlier verdict (needs-work) was for an older state ofmain.Generated by Claude Code
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.