Repository navigation
feat(agc): add a detailed second page to the performance overlay - #10487
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed head 1eabf2385bea808887181ab8f11a8a6adce0557e.
I checked the page cycle and reset path, the page-2 once-per-second sampler and trace on/off behavior, the counter deltas, and the layout/composer changes. The overlay reads trace totals through a try-lock and retains its last sample if that session lock is busy; per-thread trace totals are atomically collected. I did not find a blocking correctness issue in the reviewed diff.
Hosted convention, eligibility/intake, register-context, relinker, write-watch, and ASan checks currently pass. The hosted Linux and Windows product jobs are skipped. The PR describes additional lavapipe and RTX 3070 tests, screenshots, and performance runs; I did not reproduce those hardware, timing, or device-specific results locally, so this approval does not independently validate those reported measurements.
815dfe1 to
e9698e7
Compare
…ntent The panel was fixed at OverlayMetrics::Columns, 27 columns, and always kept rows for the frame-time graph. OverlayContent now carries its column count and whether it has a graph, and the panel's width, height, fit test and scale come from them. ComposeOverlay still fills 27 columns with a graph, so the existing panel is drawn as before, line for line. LayOutOverlay refuses a panel with no columns, a graph on a panel narrower than its 120 frames, and frame times on a panel without a graph. The 5x7 font gains %, +, -, _, J, Q, Y and Z, from the same HD44780 character set as its other glyphs, and OverlayFontCharacters lists every character it can draw. Tests: every listed character has a glyph no wider than 5 pixels, non-empty unless it is the space, and unlike any other; characters outside the list are refused; a 48-column panel without a graph is laid out and scaled at 1280x720, 1920x1080, 3840x2160 and 320x180; a 140-column panel at 3840x2160 shrinks from scale 5 to 4; a too-long line, a 20-column graph and frame times without a graph are refused.
F10 now cycles through three states: off, the existing overlay (page 1) and a detailed page (page 2), then off again. ANYPS5_OVERLAY=2 starts on page 2; 1 and 0 or unset keep their meaning, and any other value still throws, now naming 0, 1 and 2. OverlayPageAfter is the cycle, the starting page plus the F10 presses modulo 3. Toggle stores the page it gives under a mutex and PerformanceOverlay::Page loads it, so Visible, which every present calls, stays one load as before. Each change of page resets the statistics, as a toggle did. Page 2 has its own composer, ComposeOverlayDetails, a pure function of one OverlayDetailSample. It fills a 46-column panel without the graph. Every value is optional, and a line whose sources are all missing is left out; a line with some missing shows only the values it has. Each line names its unit. Names from elsewhere (threads, trace phases, the title, the present mode) go through OverlayText, which upper-cases them and turns characters the font has no glyph for into spaces; phase names are cut to fit the line. Page 1 is unchanged, line for line. On page 2, NotePresent keeps the frame statistics and fills the sample with the frame rate, the last frame's time, presents per second and the pipelines created in the last second. It reads nothing else, and it skips page 1's memory reads and packet sums. The next commit adds the driver and system counters. NotePresent latches the page, so Record draws the page NotePresent sampled. Tests: ANYPS5_OVERLAY 2 and 3, 02 and -1; the cycle from each starting page through three presses and past 2^64 presses; page 2 of a full sample, line for line, of an empty sample, and of a sample with missing sources; every character either composer can emit has a glyph; page 2 laid out at 1280x720, 1920x1080, 3840x2160 and 640x360, every line drawn, no graph, and a 60-line page shrunk to scale 3 at 3840x2160. On lavapipe, under the Khronos validation layer with no message: page 2 drawn at 1280x720 bit for bit, and F10 through a real overlay: page 1, page 2 drawn from its own composer, then hidden, with the statistics reset at each change.
Page 2 now samples its sources once a second, in NotePresent, while it shows; nothing of it runs while the overlay is hidden or on page 1. - Busy share per queue worker, the top 5 phases in ms per frame and queue 0's waits (memory, lock, GPU) come from the trace's per-thread totals. Showing page 2 turns recording on with buffering off, so a timed scope only adds to its thread's totals; leaving it turns recording off again. Toggle switches it under a mutex, and ANYPS5_OVERLAY=2 switches it on at start. An APS5_TRACE_* run keeps its own recording untouched, and page 2 then shows these lines only while that trace records. A driver thread names itself when it starts (BindThread without APS5_TRACE_* stores the name only) and binds on its first timed scope while page 2 shows; unnamed threads are not bound. - Render passes per frame: the draw path counts a begun pass in the trace totals while page 2's totals are on (PerformanceTrace::Count). - Flips/s and the draw cache's hit rate come from the driver through a source it registers at start (the draw cache's lock is only tried); the pipeline store's hit rate from PipelineStoreTotals; the compile backlog from the shader preparation and library prebuild pools (tried locks). - Dropped frames per second are the presents that found no free swapchain image; repeated ones are presents of the display buffer shown just before. The device passes the buffer's address, its present mode and the drops. - Commit charge against the commit limit: GetPerformanceInfo on Windows, Committed_AS and CommitLimit from /proc/meminfo on Linux; page faults per second from PageFaultCount or getrusage. - Host imports: their count and bytes against the budget, on devices that import host memory. - CPU copies: address-based builds count the bytes they copy in a per-thread counter (a relaxed load and store, folded once a second) with the largest build of each second against the address-copy cap. - Unimplemented-function calls: libc counts NotImplemented_nid_no_patch calls; refused shaders are the APS5_SKIP_REFUSED_DRAWS set's size. - Title ID (when the title has a param.json) and present mode. The tests cover the trace deltas, hit rates, present-mode names, the /proc/meminfo parser and the OS reads, the per-thread copy counter's fold, the counted unimplemented call, the trace switch with page 2 and lazy binding without buffering, and on lavapipe the sampler end to end with a fake driver source, its reset when page 2 is left, and the cost of a present hidden, on page 1 and on page 2.
USAGE.md's performance overlay section now gives F10's cycle (off, page 1, page 2, off) and ANYPS5_OVERLAY=2, a table with one row per line of page 2 that names each source and the system it comes from, and what the page costs: the trace totals it turns on while it shows, and the checks and counters that run while the overlay is hidden or on page 1. ENVIRONMENT.md's ANYPS5_OVERLAY row lists page 2.
e9698e7 to
b2d8709
Compare
|
Re-checked: the four commits are unchanged, and the branch is now free of merge commits.
|
What
F10 now cycles the performance overlay through three states: off, page 1 (unchanged), page 2 (new), then off again.
ANYPS5_OVERLAY=2starts on page 2,1on page 1, and0or unset leaves it off. Any other value is refused withANYPS5_OVERLAY must be 0, 1 or 2. Each change of page resets the statistics.Page 2 (46 columns, read once a second while it shows; a line or part whose source isn't available in the run is left out):
FPS,FRAMEBUSY %per queue workerworker_busy_pctcounts themtop_phases_ms_per_frameaggregates themQ0 WAIT MS/FRAME: MEM … LOCK … GPU …RENDER PASSES/FRAMEPIPELINES: COMPILING n NEW/S nHIT %: DRAW CACHE … PIPELINES …FLIPS/S,PRESENTS/S,DROPPED/S,REPEATED/SCOMMIT: used/limit GB FAULTS/SK32GetPerformanceInfoandPageFaultCount; Linux/proc/meminfoandgetrusageHOST IMPORTS: n used/budget GBCPU COPIES: x MB/S CAP: y%UNIMPLEMENTED: n/S n TOTAL,REFUSED SHADERS: nNotImplemented_nid_no_patchbefore it throws, and the refused-shader set underAPS5_SKIP_REFUSED_DRAWSTITLE: id PRESENT: modeCost. Page 2 is meant to cost nothing unless it shows:
main, plus aRecording()check per render pass begun, the copy counter in address-based builds that copy, one relaxed add onNotImplemented_nid_no_patch's throw path, and one 8-byte store per presented display buffer. Threads the trace names keep their name in a thread-local once, at start.main, plus two compares per present. Trace totals stay off.APS5_TRACE_*run behaves as today: page 2 only reads the totals that trace already records.Headless, 5 alternating runs each (Xeon 2.10 GHz VM, lavapipe), medians:
mainPage 2's real cost is the last row: each timed scope on a driver thread reads the clock while it shows.
Left out: the upscaler mode (#10043 isn't merged), the shader disk-cache hit rate (its totals are fenced off from other sources in CMake, so I didn't wire them; reviewers can say whether page 2 may read them), and GPU-time lines (no GPU query is added;
Q0 WAIT … GPUis the CPU's wait for the GPU).Docs:
docs/user/USAGE.mddescribes the cycle, every page-2 line with its source on Windows and Linux, and what runs in each state;docs/dev/ENVIRONMENT.md'sANYPS5_OVERLAYrow lists page 2.The commits:
Tested
Screenshots, Planet of Lana (PPSA19450) on Windows with an RTX 3070, this PR's head 1eabf23, page 2 started with
ANYPS5_OVERLAY=2:Page 2 in play, and its panel at native size:
Page 2 at the title menu:
The in-play spot above with the overlay off:
Planet of Lana (PPSA19450), page 2 against the overlay off, on the same RTX 3070 Laptop GPU (clocks not held), this PR's head 1eabf23, 1920x1080 window: B A A B, 540 s per arm, from the title's boot. In play (+420 to +500 s), page 2 averaged 19.8 presents/s and 13.89 ms of GPU busy per present, against 20.15 and 13.56 ms with the overlay off. That's −1.7 % presents/s and +0.33 ms per present, inside the spread between arms (18.7-21.0 presents/s). The menu (+90 to +150 s) varied more between arms (33.7-41.8 presents/s), so it gives no reading of the cost. The second half of the run was faster in both conditions, and the B A A B order cancels that.
The tests, in the existing overlay test executables:
agc_performance_overlay_statistics: parsing, the cycle (including past 2^64 presses), the page-2 composer and layout at four sizes, the trace deltas, hit rates, present-mode names, the OS reads, the copy counter across threads, the unimplemented count, the trace switch on and off;agc_performance_overlay(Vulkan): page 2 drawn bit for bit at 1280x720, the F10 cycle with its resets, and the sampler end to end.mainand on this PR, apart from the live VRAM value.GitHub's runners (run 40055350747, ×5, at this PR's head;
main's tree doesn't build these tests, as they use the new API):agc_performance_overlay,_statistics,_device_selection,_device_selection_cpu,agc_performance_trace,agc_driver_present_mode,agc_driver_presentation_pass).agc_performance_overlay,_device_selection,agc_driver_presentation_pass) skip, since the runner has no Vulkan device.APS5_SKIP_TIMING_TESTS=1.Linux, CI's configure flags (lavapipe, on a cloud machine): the overlay, trace and present tests
--repeat until-fail:20, 8 tests, 20 of 20 each; CI's Linux job mirrored: 1,927 tests, of which 1,837 pass, 86 skip and 4 fail, the four being that machine's IPv6 tests. Each commit's own overlay tests pass at that commit.Validation layer (Khronos 1.3.275, lavapipe),
mainef0d8ae and this PR overagc_performance_overlay,_device_selection,_device_selection_cpu,agc_driver_present_mode,agc_driver_presentation_passandagc_resident_present:agc_driver_depth_plane_fill) reports the knownVUID-VkDeviceCreateInfo-pNext-pNexton both, so the layer was reporting. No newVUID-.Validation layer on an RTX 3070 Laptop GPU (Khronos layer from the LunarG SDK 1.4.363, NVIDIA 617.42, Windows 11, GPU at P0), this PR's head 1eabf23,
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandANYPS5_NO_SHADER_CACHE=1, overagc_performance_overlay,_device_selectionandagc_driver_presentation_pass, twice:VK_LOADER_DEBUG=layer);VUID-or other validation message in the output. No control test with a known message ran on this GPU, so this rests on the layer's default reporting; the lavapipe control above shows the layer reporting there.0937d4c, a merge of
main2742004. The one conflict was inGuestBufferMemory.cpp'sAcquireRegistered. fix(agc): an address-based build evicts idle imports instead of copying past the cap #9514 reads the address-copy cap there through its own copy of theAPS5_ADDRESS_COPY_MAX_MIBlookup, which this PR moves intoaddressCopyLimit(). The merge takes the cap fromaddressCopyLimit(), which returns the same value, and keeps this PR's per-thread copy count and fix(agc): an address-based build evicts idle imports instead of copying past the cap #9514's eviction. So fix(agc): an address-based build evicts idle imports instead of copying past the cap #9514's separate copy of the lookup is gone, and the rest of the PR's own diff is unchanged.^agc_performance_overlay, the presentation-pass, present-mode, resident-present and performance-trace tests, and fix(agc): an address-based build evicts idle imports instead of copying past the cap #9514'sagc_address_copy_capandagc_address_copy_cap_remembered. Linux: 10 run, 10 pass, 0 skip, 0 fail. Windows: 10 run, 6 pass, 4 skip (no Vulkan device), 0 fail.^agc_driver_guest_memory_lifetime,agc_driver_host_import_lifetime,agc_driver_host_import_mutation_raceandagc_driver_host_import_failure_handles. Linux: 14 run, 14 pass, 0 skip, 0 fail. Windows: 13 run, 2 pass, 11 skip (no Vulkan device), 0 fail.guest_raise_in_system_calltimed out at 30 s once, 221st of 223; this PR changes nothing in libkernel. The import-path run's suites pass on both. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.815dfe1, a merge of
main14c99b5 (run).main's perf(agc): wait for the display keys' writer before a present takes the device lock's time #10160 adds a wait for the DCC key writer inVulkanDevice.cpp'sPresentDisplayBuffer, on the lines where this PR records the presented address; the merge keeps both, recording the address first.main's e75a166 already includes<optional>inDriver/Diagnostics.cpp, so this PR's include there merges into it; this PR's other changed lines are the same as before the merge. The 10 focused tests (the present, overlay and trace tests,agc_resident_presentand theagc_address_copytests) pass 10 runs in a row. Linux: 10 run, 10 pass, 0 skip, 0 fail. Windows: 10 run, 6 pass, 4 skip, 0 fail; the four skipped (agc_driver_presentation_pass,agc_performance_overlay,agc_performance_overlay_device_selectionandagc_resident_present) need a Vulkan device, which the Windows runner lacks. Suites: libc and libkernel pass on Linux (145 and 210) and on Windows (172 and 230). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)VulkanDevice.cpp; this PR goes after them and adapts to each when it merges). perf(agc): wait for the display keys' writer before a present takes the device lock's time #10160 merged, and this branch now merges it; fix(agc): start the context at its reset state for color targets and viewports #10420 was closed