Repository navigation
Profile: opt-in VICTORY_PROFILE (frame times, memory, caches, loads; frames.csv, a Perfetto trace and an on-screen overlay) - #130
Open
Sunkiller-qc wants to merge 11 commits into
Open
Sunkiller-qc wants to merge 11 commits into
Sunkiller-qc wants to merge 11 commits into
Conversation
This was referenced Nov 24, 2026
Contributor
|
Tested head
|
Closed
github-actions Bot
added a commit
to KevinPratap/VIctory
that referenced
this pull request
Nov 24, 2026
…ory, caches, loads; frames.csv, a Perfetto trace and an on-screen overlay)
github-actions Bot
added a commit
to KevinPratap/VIctory
that referenced
this pull request
Nov 24, 2026
…ory, caches, loads; frames.csv, a Perfetto trace and an on-screen overlay)
…, memory) VICTORY_PROFILE=1 logs a summary every few seconds: frame intervals with avg, p50/p95/p99, max, 1% low, hitches and stutters; the work per frame; process memory and resident bytes; cache hit rates; the timed scopes that took longest; the biggest and slowest loads. VICTORY_PROFILE=<dir> also writes frames.csv (one row per presented frame) and trace.json (Chrome trace events for Perfetto). Off, every hook is one relaxed load. Nothing calls it yet; the aggregation is unit-tested without a GPU.
… VRAM) With VICTORY_PROFILE set: every presented frame (its present number, as VICTORY_CAPTURE counts, size, format, draws and dispatches since the last one, time spent presenting), each submission's preparing and fence wait, shader translations and pipeline creations timed, the shader container table and the disk cache as caches, texture refreshes (unchanged textures as hits), descriptor heaps, upload buffers, resident GPU memory and host textures, the adapter's video memory and budget, and a full dump before a host GPU failure ends the run.
…start it victory run calls victory_profile::init. With VICTORY_PROFILE set: ReadFile and fread timed with their bytes, big (1 MiB) or slow (5 ms) reads named as file loads, every DirectStorage request a load under the title's name for it and by what it decodes, XMemAlloc/XMemFree timed, the default allocator's resident bytes, XMemVirtualAlloc bytes, XMA frames and Opus packets timed.
VICTORY_PROFILE_DUMP=<seconds>,... now also runs the VICTORY_STACKS dump, so one report has the frames, memory, caches and where each thread is. The dump before a host GPU failure does not suspend threads.
…LE_OVERLAY) The panel is plain data in victory-profile: its lines from the last 120 frames and the samplers, an embedded 5x7 font as '#' strings, a graph of the frame intervals, and the rows in the back buffer's format (RGBA8, BGRA8, RGB10A2, RGBA16F). Redrawn at most four times a second. Off unless VICTORY_PROFILE_OVERLAY=1 or VICTORY_PROFILE=overlay; tests for the text, the font, the layout and the encodings.
The presenter copies the panel from a kept upload buffer into the back buffer's corner with CopyTextureRegion, after the frame and before the present: no shaders or pipelines. F3 while our window has focus shows and hides it. Host pipeline lookups count as cache hits and misses.
… live lines (VICTORY_PROFILE_LIVE) For the world hangs of Marvisak#71: the noted commands' GPU times (with VICTORY_GPU_TIMING) kept by a key without title values, their worst by max with median, total, runs and their list's time; the slowest submission of each period with its pipelines; draws and dispatches dropped or of zero groups per frame (frames.csv gains two columns). VICTORY_PROFILE_LIVE=1 (or =frame, or a file) writes a line a second to the console and to a file synced at each line: CPU and GPU time per frame, the slowest submission and command, the last GPU marker done or the command the GPU is in, dropped and zero-group work, video and shared memory against their budgets. Warnings come at once for a command or submission over VICTORY_PROFILE_LIVE_SLOW_MS and for the GPU on one marker over VICTORY_PROFILE_LIVE_STALL_MS. Tests for the keys, the tables, the settings, the lines and the stall watch.
…ve GPU markers With VICTORY_GPU_TIMING, each list's timed commands go to the profiler; every submission's GPU wait and pipelines; dropped draws, dispatches and indirect executions, and those of zero groups. With VICTORY_PROFILE_LIVE in a diagnostics build with VICTORY_D3D12_DRED, each list has two words in read-back memory the GPU writes before each noted command and at the end (WriteBufferImmediate, marker in and out), read while the submission runs: the live thread names the command the GPU is in before a removal, where the device-removed data only tells after. A host failure is written to the live file at once.
Sunkiller-qc
force-pushed
the
perf-profiler
branch
from
November 24, 2026 22:52
0ba0851 to
1a807d2
Compare
Owner
|
Automated triage for the maintainers. This pull request no longer merges cleanly into Generated by Claude Code |
github-actions Bot
added a commit
to KevinPratap/VIctory
that referenced
this pull request
Nov 25, 2026
…ory, caches, loads; frames.csv, a Perfetto trace and an on-screen overlay)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An 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