perf(agc): remove fixed per-draw clock reads, owner copies and allocations #16753

Merged
chitters2004 merged 38 commits from upstream-pr/16753 into main 2026-11-21 20:55:18 +00:00
chitters2004 commented 2026-11-07 15:14:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by chitters2004 on 2026-11-07T15:14:09Z.


What

Every recorded draw paid fixed costs that do not depend on what it draws: clock reads with profiling off, owner copies, and host allocations for its own bookkeeping. This change removes them from the common draw and dispatch.

Clock reads with draw profiling off. DrawTimer, refreshResidentTarget, ShaderResources::buildPrepare and buildComplete, Driver::dispatch, Driver::resolveGroupAhead and the CPU reads of indirect draw records each called std::chrono::steady_clock::now() even when the result was only used for profiling. They now read the clock only when the profile that reports them is on: the draw profile for the draw, dispatch and indirect sites, and the shader build profile (BuildProfiled()) for buildPrepare and buildComplete. The indirect read times are counted only then. The committer's per-commit clock reads in DrawPipeline.cpp follow APS5_PROFILE_DRAW or APS5_PIPELINE_STATS, the switches that print its per-commit times; they are environment switches, and the build profile does not turn them on.

Owner copies during recording. RecordedDraw holds the draw's ShaderResources by reference instead of copying its shared_ptr, and shapePipeline passes the cached pipeline on without copying it. Pipeline::AcquireFramebuffer compared each cached owner by locking its weak_ptr; it now keeps the owner's address beside the weak_ptr and compares the address and the control block (owner_before both ways), so a lookup takes no reference. An owner whose address is reused by a different object still misses.

Host allocations per draw.

  • Owners retained once per batch. keepRecordedDraw no longer allocates a Kept object per draw. Recorder::Retain adds the draw's resources, pipeline, framebuffer, index and vertex buffers and resident targets to the batch's kept list, skipping an owner the batch already holds (an open-addressing table keyed by the owner's address and control block, reset by an epoch when a batch opens). Recorder::ReserveRetention sizes the list and table once per draw. The owners live until the batch completes, as before.
  • Attachment lists inline. A new InlineList<T, N> keeps up to N items in place and moves them to a vector only past N. It holds the dynamic rendering color attachments (8), the pass attachments (16), the store flags, target slices and resident targets (8), and the color export slots that DecodeState and DrawRejection compute (8).
  • Draw bindings only when needed. PrepareDrawBindings allocates its DrawBindings only when the draw keeps a snapshot, or when its object has re-bound a texture after a cache eviction (rebound): the object's own descriptor set then no longer matches its textures, so every later draw of it writes fresh sets. The first form of this commit missed the second case and dereferenced a null DrawBindings on such a draw; 21419394cb creates it, and the rebound case of agc_driver_table_index_validation covers it.
  • Storage images in thread-owned storage. A new ShaderResources::StorageImages(out) fills a thread-owned vector instead of returning a new one per draw.
  • Dispatch vectors sized once. Driver::dispatch reserves its user data and snapshot lists, and keeps its one or two shader memory regions in a fixed array.
  • refreshResidentTarget takes its lookup as a template parameter instead of a std::function.
  • Four code comments that described the removed Kept object (Draw.cpp, Pipeline.cpp) are removed.

No behaviour changes.

Overlap, checked on 2026-11-07 against main 46552cb461 with tools/pr_overlap.py and by hand: the tool reports four open pull requests that change lines this branch changes (#7369, #9508, #16115, #16413) and 84 more that conflict with main and share files with it (57 of the 88 have a commit since 2026-10-24; I read the hunks of 17). #14051 (labelled needs rebase) also makes the clock reads of DrawTimer and its new planDraw depend on profiling, the same idea as the clock commit here, as part of a larger split of prepareDraw; whichever lands second keeps one form of the DrawTimer lines. Nothing else implements the same thing. #16115 adds passGeneration beside the retention members of Recorder and changes the start of Recorder::ensureOpen, where the retention reset is at the end; its attachment memo copies color target vectors on a miss, so the allocation census should run on top of it once both are in. #7369 and #9508 change other lines of DrawWithRecipe, prepareDraw and recordPreparedDraw; #13863, #13920 and the device image table stack (#7642, #10193, #13928, #13929) change keepRecordedDraw, Recorder::ensureOpen and Driver::dispatch and will rebase onto Recorder::Retain. Rechecked against 4977f64052: the tool now confirms #7369, #10920, #16115, #16413 and #16572 (Draw.cpp, beside the attachment and pipeline-key code); none implements the same thing.

Tested

Reviewed head eb92a8c70d9. The replay, GTA and census-by-commit numbers below were measured on 656c08e951. The census limits were re-derived on b7f0ab6e98f (section below). Since 656c08e951, the driver code changed only by main merges, 21419394cb (draw bindings on a re-bind) and two review commits with no runtime change: b7f0ab6e98f drops a no-op std::move, and eb92a8c70d9 makes the draw record a non-copyable BorrowedDraw.

Head 656c08e951 on main 4977f64052; the merges since, up to fcee5cb0b8, bring main in and add 21419394cb (draw bindings on a re-bind) and its test.

Retention test after the main merge. main's #16760 creates draw-input copies with TRANSFER_SRC as well as their vertex or index usage, and the buffer pool hands a buffer back only under its exact usage. agc_driver_recorded_draw_retention probed the pool with plain vertex and index usage, so on Windows it reported that recorded vertices survived completion, and its checks before completion could not have found the buffer either way. The test now reads each recorded input's usage from its vkCreateBuffer, requires it to carry the bound role, and probes with that usage before and after completion; the driver change is untouched. Fork CI on head 6479bab223 (run 43750013318): Linux 8 of 8; Windows 5 pass, including agc_driver_recorded_draw_retention, and the three draw allocation tests skip as they do on Windows on the earlier head; 0 VUID- lines.

Review follow-up (census per-site bound, cleared target in the rebound test; test files only). Linux, GCC 13, Release, Mesa lavapipe 25.2.8, Khronos validation layer 1.4.363.1 with synchronization validation on (VK_KHRONOS_VALIDATION_VALIDATE_SYNC=1), ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer: ctest -R '^(agc_driver_table_index_validation|agc_driver_draw_allocations|agc_driver_draw_allocations_draw_pipeline|agc_driver_draw_allocations_plan_verify)$' -V on fcee5cb0b8 and on the follow-up, same machine: 4 of 4 passed on both; the loader inserts the layer for agc_driver_table_index_validation (the census tests unset VK_INSTANCE_LAYERS by design); no VUID- or SYNC-HAZARD line and no was not found but was requested by env var VK_INSTANCE_LAYERS in either log. Mutants: a draw that is skipped after the re-bind passes the earlier rebound test (the target still holds the settle draws' key texel) and fails the new one; one restored per-draw allocation is above.

Refreshed onto main 4977f64052. Head 656c08e951; git range-diff against the same patches on 46552cb461 shows them unchanged (11 commits, =). Local RTX 3080 gate on both, same environment as below (ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation), built one after the other in one build tree, with the focused AGC set of all five pull requests of this series (237 tests on this head, 232 on main): both 100 % passed, no VUID- line in either log or in replay subprocess logs, and neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS. Fork CI on the rebased head against 4977f64052: run 42374111231: Linux 40 of 43 passed, 3 skipped; Windows 38 of 44 passed, 5 skipped, and agc_driver_recorder failed, as it does on main. The new agc_driver_draw_allocations tests pass on Linux and skip on Windows by design: the driver allocates through its own operator new in a DLL the census cannot interpose. No VUID- line on either side, conventions check passed. The measurements and full runs below were on the previous base 46552cb461; the code they measured is unchanged.

Vulkan validation. RTX 3080, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ctest --test-dir build -R 'agc|write_tracking|guest|indirect_draw|draw_finisher|depth_bias|draw_pipeline' -V on this branch's patches on 46552cb461, the same patches as 656c08e951 (3204 tests), and on main 46552cb461 (3199 tests). Every test failing in either full run was then rerun alone on both builds, one build at a time with nothing else on the GPU, using ctest -R with the union of the 16 names and the same environment: on both, 15 of 16 passed and only agc_driver_direct_write_completion failed, which fails on main too (#15547); the other failures of the full runs were timeouts and 0xc0000409 exits under load from concurrent gates and did not reproduce alone. Both full logs hold the same 18 VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 lines and no other VUID-; neither contains was not found but was requested by env var VK_INSTANCE_LAYERS. The change adds no validation error.

Fork CI (GitHub runners, Mesa lavapipe with the Khronos validation layer, head against main): run 42337669902 (48 tests on each OS, this branch's patches on 46552cb461 against 46552cb461): Linux 48 of 48 passed with the validation layer; Windows 45 passed, the two allocation census tests reported themselves skipped (they need the driver's operator new, see below), and agc_driver_recorder failed, as it does on main on the same runner. run 42338181178 for the retention tests: Linux 10 of 10 and Windows 11 of 11. No VUID- line in any of them, conventions check passed.

Tests.

  • agc_driver_draw_allocations, _draw_pipeline and _plan_verify (new, Linux; on Windows the driver allocates through its own operator new in a DLL the test cannot interpose, so they report themselves skipped): the test replaces operator new and counts, per shape (recipe auto draw, indexed draw with guest indices, indexed draw with image indices, compute dispatch), what warmed draws allocate beyond a baseline, both in total and per call site on every draw. The measurement and the ceilings were redone on the current head; see Draw allocation census: measurement and limits below. Restoring one per-draw allocation in keepRecordedDraw (a make_shared per draw, as the removed Kept was) fails the every-draw bound. Both tests unset VK_INSTANCE_LAYERS, because under the validation layer the replaced operator new also counts the layer's own allocations. The variables that select shapes and override the ceilings are in docs/dev/ENVIRONMENT.md.
  • agc_driver_recorded_draw_retention (new): a recorded draw's indices, vertices, pipeline, framebuffer, resources, resident targets and GPU indirect scratch stay alive until its batch completes, also after their cache entries are evicted and when a recipe hit in the next batch uses them again, and are released when the last batch that used them completes.
  • agc_driver_vertex_target_range_copied and _imported (extended): a recorded draw's resident target survives a cleared resource cache until completion and is released after it, and with imported vertices the GPU indirect scratch is not recycled before completion. They now run with APS5_RELEASE_UNDER_LOCK=1, the new _release_thread variants run them with the release thread, and all four fail on any VUID- or InvalidCommandBuffer line.
  • agc_recorder_kept_bytes (RecorderKeptBytes.cpp, extended): 100 owners retained twice each through a growing lookup, mixed with Keep, are each held once until completion and released after it; a batch whose submit fails releases its owners, and the batch that replaces it retains a live owner again exactly once and holds it until its fence.
  • agc_driver_host_allocator (HostAllocator.cpp, extended, Windows): an InlineList keeps order and ownership across its inline bound, does not duplicate an owner when it spills, releases its owners when destroyed, and works with no inline slots.
  • agc_driver_table_index_validation rebound case (new): textures leave the cache under an object built with APS5_DRAW_SNAPSHOT_MAX_MIB=0, so the next draw re-binds them with no snapshot kept; the target is cleared before each checked draw, so a re-bound draw that draws nothing fails.
  • agc_driver_graphics runs framebufferOwnerTests: a live owner reuses its framebuffer, the same address with a different owner does not, and a replaced owner gets a distinct framebuffer. The clock and reference changes have no behaviour of their own to test; the existing draw, dispatch and indirect tests in the gate above run through every changed site with profiling off, and the APS5_PROFILE_DRAW tests with it on.

Draw allocation census: measurement and limits (sync head b7f0ab6e98)

Why it changed. The census used to count one 256-draw batch. Whether earlier draws' pool slots and draw-use records were free again depended on how far the GPU had got, so the count moved with machine load: up to 1 failure in 20 per variant on a loaded Linux machine.

How it measures now.

  • Each measured submit holds 8 leading draws and 32 measured draws, and the test waits for the GPU to go idle after every submit, so every measured submit starts with all earlier GPU work done.
  • The same number of submits with only the 8 leading draws is subtracted, so per-submit setup cancels.
  • Under that method the every-draw call-site counts are exact (42/44/44/10 plain, 45/47/47/13 pipelined) across 5 idle and 10 loaded runs per variant. Allocations per draw move by less than 0.2. Bytes per draw move by up to 316 when a pool grows once.

The census is Linux-only. On Windows the driver allocates through its own operator new in the DLL, which the census cannot interpose, so the tests skip there.

Limits. These were this PR's own constants, set against an older main and the old measurement. They are re-derived from Linux fork CI run 44098566795: three runs plain, six pipelined (draw_pipeline and plan_verify).

shape plain: measured → limit (allocations / bytes / every draw) pipelined: measured → limit
recipe auto draw 42.500 / 8062.0 / 42 → 43.0 / 8462 / 42 45.734 / 8248.5 / 45 → 46.3 / 8649 / 45
indexed, guest indices 44.531 / 8322.0 / 44 → 45.1 / 8722 / 44 47.766 / 8508.5 / 47 → 48.3 / 8909 / 47
indexed, image indices 44.863 / 10356.1 / 44 → 45.4 / 10757 / 44 48.098 / 10529.5 / 47 → 48.6 / 10930 / 47
compute dispatch 10.773 / 953.9 / 10 → 11.3 / 1354 / 10 14.023 / 1377.9 / 13 → 14.6 / 1778 / 13

The margin is the same for every shape:

  • allocations: highest measured plus 0.5;
  • bytes: highest measured plus 400 per draw;
  • every-draw count: exact.

The byte margin absorbs a one-off pool growth; the largest seen added 316 per draw. The count limits still catch any new allocation, and the every-draw count catches a new call site.

What main added. I ran the same measurement on this branch's previous base (03afc904a1) and on the sync:

  • allocation counts are identical;
  • every draw is 24 bytes larger: DrawTail now holds userPatches, from #19267;
  • an index copy from image memory is 16 bytes larger: Buffer embeds Context, which grew with #20368, #19373 and #18842.

The commit-cost work on the driver's per-draw allocations (the finisher queue nodes, the second DrawWriteRanges, BeginDrawUse records, BufferPool slots) is how these numbers come back down.

Proof. 30/30 runs of all three variants passed locally under a parallel ctest -j16 load, at load average 15 on 4 cores. Fork CI on b7f0ab6e98: run 44114467966, Linux gate green; on Windows the three census tests report themselves skipped, as described above.

Host allocations per operation, from the census on the GitHub Linux runner (fork CI census job, Mesa lavapipe, no validation layer). Each column is one commit with the census test applied: main is 46552cb461 plus the census test, the next adds the clock and owner commits, the next the retention, inline list, draw binding and storage image commits (an earlier form of this branch, with the same driver code as b172d695d9 here and the census test in its earlier form), and the last is this head with the two dispatch and color export commits. Count per draw or dispatch, requested bytes in brackets.

test shape main + census test + clock and owner commits (a997ef0a52) + retention, inline lists, bindings, storage images (b172d695d9) this head (656c08e951)
agc_driver_draw_allocations recipe auto draw 49.78 (8,113 B) 49.77 (8,069 B) 43.78 (7,795 B) 42.72 (7,807 B)
agc_driver_draw_allocations indexed draw, guest indices 51.81 (8,272 B) 51.88 (8,173 B) 45.82 (7,955 B) 44.74 (8,010 B)
agc_driver_draw_allocations indexed draw, image indices 51.95 (10,166 B) 52.02 (10,136 B) 45.97 (9,953 B) 44.97 (9,949 B)
agc_driver_draw_allocations compute dispatch 17.94 (1,100 B) 17.94 (1,100 B) 17.95 (1,100 B) 10.94 (872 B)
agc_driver_draw_allocations_draw_pipeline recipe auto draw 52.98 (8,208 B) 52.98 (8,166 B) 46.93 (7,938 B) 45.93 (7,936 B)
agc_driver_draw_allocations_draw_pipeline indexed draw, guest indices 55.03 (8,401 B) 55.02 (8,348 B) 48.98 (8,199 B) 47.97 (8,115 B)
agc_driver_draw_allocations_draw_pipeline indexed draw, image indices 55.24 (10,364 B) 55.18 (10,315 B) 49.18 (10,168 B) 48.15 (10,130 B)
agc_driver_draw_allocations_draw_pipeline compute dispatch 20.66 (1,439 B) 20.66 (1,439 B) 20.66 (1,439 B) 13.66 (1,211 B)

The plain recipe auto draw falls from 49.78 to 42.72 allocations per draw (-14.2 %), the pipelined one from 52.98 to 45.93, and a compute dispatch from 17.94 to 10.94. Census runs: 42338046309, 42338087047, 42335669341, 42337669902.

Clock reads removed per draw with profiling off: one in DrawTimer, one per resident color target lookup, one in each of buildPrepare and buildComplete when the draw builds its resources, and one or two per indirect draw whose records the CPU reads; one per dispatch and one per dispatch resolved ahead. On Windows each read is a QueryPerformanceCounter call. In a 60 s stack sample of the draw committer in the GTA V scene below on main (3,843 samples), the clock path (ntdll.dll+0x8b29d and clock_settime in winpthreads) is 3.4 % of its self time; part of it comes from other callers. Per recorded draw, one shared_ptr copy and release fewer (two atomic operations), and one weak_ptr::lock and release fewer per owner on each framebuffer cache lookup.

Per-draw cost, replay. Identical frames, so the change is the only difference. A 3-frame capture of the scene below (APS5_FRAME_CAPTURE, 9,364 draws) is replayed with agc_frame_replay --repeat 5 through the real submit path, with the same pipelined-draw settings as the boots; passes 2 to 5 count. Base 46552cb461 and each build alternate run by run. Every pass of every run drew exactly 9,364 draws and every run matched the base pixels exactly (pixels_identical 1.0). The metric is committer wall time per commit, per draw; base is about 53.2 µs per draw. The replay tool is main's tools/FrameReplay.cpp with #12565, #12567, #12568, #11435 and #13984 merged and a local retire of resident images before each memory restore so --repeat works; it is local and not part of this pull request (per-build summaries and binary provenance attached).

build pairs commit µs per draw, change (95 % CI) relative timed ms per pass, change (95 % CI)
this change, 656c08e951 10 -0.44 ± 0.37 -0.8 % -4.9 ± 6.9
all three merged on 46552cb461 5 -2.99 ± 0.44 -5.6 % -25.5 ± 7.7
calibration: +1.0 µs spin per draw 5 +0.92 ± 0.68 +1.7 % +6.3 ± 11.4
null control: import validity f62ea7bd08 5 -0.19 ± 0.64 -0.4 % -0.1 ± 11.1
null control: pushless offset 0e323b1bdc 5 -0.56 ± 1.00 -1.1 % -4.9 ± 9.5

The calibration build reads its injected 1.0 µs, so the replay resolves per-draw costs below 1 µs; base against base reads +0.10 ± 0.37. The two null controls stay within noise. The three changes add up: -1.35, -0.81 and -0.44 sum to -2.60, inside the merged build's -2.99 ± 0.44. Thread CPU columns are attached but not used: Windows thread times tick in 15.6 ms steps, too coarse for 1 µs per draw. The replay cannot show contention with the title's own threads, frame pacing, or GPU-bound time.

Frame time, stacked boots. main 46552cb461 against the three changes merged on it, one warm-up boot each, then two ABBA pairs in the scene below on the current host: mean ms/frame 147.0 to 136.0 (-7.5 %) and 136.7 to 131.3 (-4.0 %); p99 168.8 to 181.9 and 192.6 to 188.7. These are not attributed to the change: the merged build drew 13 % fewer draws per present in those boots (1,497 and 1,611 against 1,783 and 1,801), and draw count varies from boot to boot with the scene, which is why the per-draw figure above comes from the replay. The older per-pull-request pairs below were taken on this branch before its rebase and on the host state before the changes listed under Host; the counts are per pull request and stay.

Performance, older per-PR pairs. GTA V (PPSA04263, content 01.011.001), standing scene, 3840x2160, default in-game settings. Two interleaved pairs, main then this change, twice, after one warm-up boot of each build that is not a sample. Each capture is the 30 s trace window from 235 s after launch, about 30 s after the player stands still (202 to 206 s in every capture), with pipelined draws (APS5_DRAW_PIPELINE=1, APS5_PIPELINED_DRAWS=32, APS5_PIPELINE_DISPATCH=1). main was 7383be1a19; the change was ce6b71c04a, this branch before its rebase onto 46552cb461 and before two commits were added: ce6b71c04a holds the clock, owner, retention, inline list, draw binding and storage image commits, and git range-diff shows the same patches for those. The dispatch vector and color export commits were not timed on their own; they cut allocations only (table above).

capture commit presents in 30 s mean ms/frame p50 p90 p99 max GPU busy ms/present queue worker busy
main, pair 1 7383be1a19c7 213 141.4 138.9 150.5 165.1 197.2 34.1 95.1 %
change, pair 1 ce6b71c04ac6 223 134.6 133.0 142.9 159.5 199.3 33.7 95.0 %
main, pair 2 7383be1a19c7 219 137.3 135.0 146.9 176.2 193.3 33.8 94.8 %
change, pair 2 ce6b71c04ac6 221 136.0 134.2 144.7 152.2 221.1 34.0 94.9 %

Change minus main, mean ms/frame: pair 1 -6.87, pair 2 -1.37, mean -4.12 (-3.0 %); p50 -5.9 and -0.8; p99 -5.6 and -24.0.

Frame time is within noise, with a small gain that two pairs cannot confirm. Both pairs are faster with the change, by 6.9 and 1.4 ms, a mean of 4.1 ms (3.0 %). Twelve main captures of this scene across six blocks give a mean of 137.6 ms per frame with a standard deviation of 1.85 ms (1.35 %), so the mean of two pair deltas resolves about 2 ms; but the pair-1 main capture (141.4 ms) is the slowest of those twelve, and without it the gain is the 1.4 ms of pair 2.

Why frame time barely moves: the scene is CPU-bound and the draw committer is its critical path. In a 60 s stack sample of main in this scene (1 ms sampling, 3,843 samples per thread, digests attached), finishDraw/commitDraw is 79.8 % of the committer's samples inclusive, Graphics::Draw 76.1 %, prepareDraw 53.4 %, recordPreparedDraw 21.8 % and collectWrites 12.2 %; about half the sampled stacks are cut at 64 frames, so inclusive shares are lower bounds. The queue worker shows 95 % busy in every capture, but 53 % of its samples are DrawFinisher::Drain reading steady_clock::now while it waits, so that figure overstates its load. GPU busy is 33.8 ms of a 137 ms frame. This change acts on prepareDraw and recordPreparedDraw on the committer and on the clock path.

In separate counter boots of the same scene (APS5_PROFILE_DRAW=1, which turns off the draw finisher handoff), the driver's own [draw] phase means were 35.0 us per draw packet on main (two boots, 3.0 % apart) and 36.8 us with the change, but those boots drew 2,827 to 2,853 draws per present on main and 3,167 with the change, so they are no evidence either way.

Summary lines (tools/trace_digest.py JSON summary, one per capture, in the order of the table):

{"commit":"7383be1a19c7","dirty":false,"env":{"APS5_ADDRESS_COPY_MAX_MIB":"512","APS5_DRAW_PIPELINE":"1","APS5_DUMP_FRAMES":"80","APS5_DUMP_FRAMES_EVERY":"300","APS5_LOG_TIMESTAMPS":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"32","APS5_PIPELINE_DISPATCH":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"235:30","APS5_TRACE_SUMMARY_EVERY":"10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 621.14","os":"Windows 10.0.26220","cpu":"AMD Ryzen 7 5800X 8-Core Processor","cpu_threads":16,"memory_mib":32676,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.011.001","resolution":"3840x2160","window":{"spec":"seconds 235:30","first_present":4076,"ms":30125.147},"presents":213,"frame_ms":{"p50":138.921,"p90":150.457,"p99":165.080,"max":197.168},"gpu_busy_ms_per_present":34.091,"worker_busy_pct":{"queue worker 0x0":95.107},"top_phases_ms_per_frame":{"Driver.Packet":127.592,"Graphics.Draw":109.451,"Driver.Packet.draw":94.541,"Driver.Draw":93.936,"Graphics.Draw.draw_and_resource_release":86.115,"Driver.DrawFinish":81.806,"Driver.Draw.prepare":73.357,"Driver.DrawFinish.shader_compile_and_link":45.669},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.031,"events_lost":1316774,"totals_full":false},"draw committer":{"events_full_after_s":10.760,"events_lost":473252,"totals_full":false},"draw finisher":{"events_full_after_s":12.163,"events_lost":382180,"totals_full":false}},"trace":"aps5-trace-7383be1a19c7-26956.json.gz"}
{"commit":"ce6b71c04ac6","dirty":false,"env":{"APS5_ADDRESS_COPY_MAX_MIB":"512","APS5_DRAW_PIPELINE":"1","APS5_DUMP_FRAMES":"80","APS5_DUMP_FRAMES_EVERY":"300","APS5_LOG_TIMESTAMPS":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"32","APS5_PIPELINE_DISPATCH":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"235:30","APS5_TRACE_SUMMARY_EVERY":"10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 621.14","os":"Windows 10.0.26220","cpu":"AMD Ryzen 7 5800X 8-Core Processor","cpu_threads":16,"memory_mib":32676,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.011.001","resolution":"3840x2160","window":{"spec":"seconds 235:30","first_present":4078,"ms":30007.582},"presents":223,"frame_ms":{"p50":133.012,"p90":142.895,"p99":159.453,"max":199.268},"gpu_busy_ms_per_present":33.669,"worker_busy_pct":{"queue worker 0x0":94.952},"top_phases_ms_per_frame":{"Driver.Packet":121.124,"Graphics.Draw":102.744,"Driver.Packet.draw":91.980,"Driver.Draw":91.377,"Graphics.Draw.draw_and_resource_release":80.857,"Driver.DrawFinish":78.246,"Driver.Draw.prepare":71.054,"Driver.DrawFinish.shader_compile_and_link":43.881},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.062,"events_lost":1281650,"totals_full":false},"draw committer":{"events_full_after_s":11.180,"events_lost":439984,"totals_full":false},"draw finisher":{"events_full_after_s":12.692,"events_lost":353376,"totals_full":false}},"trace":"aps5-trace-ce6b71c04ac6-4748.json.gz"}
{"commit":"7383be1a19c7","dirty":false,"env":{"APS5_ADDRESS_COPY_MAX_MIB":"512","APS5_DRAW_PIPELINE":"1","APS5_DUMP_FRAMES":"80","APS5_DUMP_FRAMES_EVERY":"300","APS5_LOG_TIMESTAMPS":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"32","APS5_PIPELINE_DISPATCH":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"235:30","APS5_TRACE_SUMMARY_EVERY":"10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 621.14","os":"Windows 10.0.26220","cpu":"AMD Ryzen 7 5800X 8-Core Processor","cpu_threads":16,"memory_mib":32676,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.011.001","resolution":"3840x2160","window":{"spec":"seconds 235:30","first_present":4061,"ms":30078.660},"presents":219,"frame_ms":{"p50":134.971,"p90":146.895,"p99":176.226,"max":193.256},"gpu_busy_ms_per_present":33.841,"worker_busy_pct":{"queue worker 0x0":94.793},"top_phases_ms_per_frame":{"Driver.Packet":123.715,"Graphics.Draw":105.295,"Driver.Packet.draw":93.672,"Driver.Draw":93.070,"Graphics.Draw.draw_and_resource_release":83.071,"Driver.DrawFinish":80.443,"Driver.Draw.prepare":72.750,"Driver.DrawFinish.shader_compile_and_link":44.416},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.133,"events_lost":1286905,"totals_full":false},"draw committer":{"events_full_after_s":10.990,"events_lost":456616,"totals_full":false},"draw finisher":{"events_full_after_s":12.610,"events_lost":361255,"totals_full":false}},"trace":"aps5-trace-7383be1a19c7-16268.json.gz"}
{"commit":"ce6b71c04ac6","dirty":false,"env":{"APS5_ADDRESS_COPY_MAX_MIB":"512","APS5_DRAW_PIPELINE":"1","APS5_DUMP_FRAMES":"80","APS5_DUMP_FRAMES_EVERY":"300","APS5_LOG_TIMESTAMPS":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"32","APS5_PIPELINE_DISPATCH":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"235:30","APS5_TRACE_SUMMARY_EVERY":"10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 621.14","os":"Windows 10.0.26220","cpu":"AMD Ryzen 7 5800X 8-Core Processor","cpu_threads":16,"memory_mib":32676,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.011.001","resolution":"3840x2160","window":{"spec":"seconds 235:30","first_present":4113,"ms":30051.379},"presents":221,"frame_ms":{"p50":134.189,"p90":144.737,"p99":152.210,"max":221.095},"gpu_busy_ms_per_present":33.959,"worker_busy_pct":{"queue worker 0x0":94.872},"top_phases_ms_per_frame":{"Driver.Packet":122.132,"Graphics.Draw":103.684,"Driver.Packet.draw":92.613,"Driver.Draw":91.999,"Graphics.Draw.draw_and_resource_release":81.451,"Driver.DrawFinish":78.895,"Driver.Draw.prepare":71.495,"Driver.DrawFinish.shader_compile_and_link":44.669},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.276,"events_lost":1254911,"totals_full":false},"draw committer":{"events_full_after_s":11.314,"events_lost":435316,"totals_full":false},"draw finisher":{"events_full_after_s":13.072,"events_lost":342614,"totals_full":false}},"trace":"aps5-trace-ce6b71c04ac6-4316.json.gz"}

Traces: main, pair 1 aps5-trace-7383be1a19c7-26956.json.gz, change, pair 1 aps5-trace-ce6b71c04ac6-4748.json.gz, main, pair 2 aps5-trace-7383be1a19c7-16268.json.gz, change, pair 2 aps5-trace-ce6b71c04ac6-4316.json.gz.

tools/performance_compare.py output per pair: pair 1, pair 2. tools/trace_digest.py output per capture: main, pair 1, change, pair 1, main, pair 2, change, pair 2.

Deviations from the Performance report form, the same in every capture (deviations.txt, environment per capture in the *-env.txt files):

  • The pipelined draw variables above, APS5_ADDRESS_COPY_MAX_MIB=512, APS5_NO_PAD_INPUT=1, APS5_LOG_TIMESTAMPS=1 and APS5_TRACE_SUMMARY_EVERY=10.
  • Scripted pad input from one saved game reaches the scene, and frame dumps (APS5_DUMP_FRAMES=80, APS5_DUMP_FRAMES_EVERY=300) let the script see the menus and check the view; the log is redirected to a file the script reads.
  • All builds share one warm shader cache directory (ANYPS5_SHADER_CACHE_DIR, __GL_SHADER_DISK_CACHE_PATH).
  • The trace buffers fill in every capture (trace_dropped), so slice counts are partial; the summary totals are complete.

Host: AMD Ryzen 7 5800X (16 threads), 32 GB, NVIDIA GeForce RTX 3080 (driver 621.14, Vulkan 1.4.357), Windows 10.0.26220, desktop on AC power with the High performance scheme, display 2560x1440 at 179 Hz; the title renders 3840x2160 (host-report.txt). That is the host of the older pairs and the counter boots above. Since then Resizable BAR is on (BAR1 16384 MiB, VBIOS 94.02.27.00.09), Windows is build 26320 and Defender excludes the build, tool and capture folders; the driver is still 621.14. The replay measurement and the stacked boots ran on that host.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #21336
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 3080 (driver 621.14, Windows 10.0.26220); Mesa lavapipe on the fork's GitHub runners (Linux and Windows)
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5202971988 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16753). Originally posted by [chitters2004](https://github.com/chitters2004) on 2026-11-07T15:14:09Z. --- ### What Every recorded draw paid fixed costs that do not depend on what it draws: clock reads with profiling off, owner copies, and host allocations for its own bookkeeping. This change removes them from the common draw and dispatch. **Clock reads with draw profiling off.** `DrawTimer`, `refreshResidentTarget`, `ShaderResources::buildPrepare` and `buildComplete`, `Driver::dispatch`, `Driver::resolveGroupAhead` and the CPU reads of indirect draw records each called `std::chrono::steady_clock::now()` even when the result was only used for profiling. They now read the clock only when the profile that reports them is on: the draw profile for the draw, dispatch and indirect sites, and the shader build profile (`BuildProfiled()`) for `buildPrepare` and `buildComplete`. The indirect read times are counted only then. The committer's per-commit clock reads in `DrawPipeline.cpp` follow `APS5_PROFILE_DRAW` or `APS5_PIPELINE_STATS`, the switches that print its per-commit times; they are environment switches, and the build profile does not turn them on. **Owner copies during recording.** `RecordedDraw` holds the draw's `ShaderResources` by reference instead of copying its `shared_ptr`, and `shapePipeline` passes the cached pipeline on without copying it. `Pipeline::AcquireFramebuffer` compared each cached owner by locking its `weak_ptr`; it now keeps the owner's address beside the `weak_ptr` and compares the address and the control block (`owner_before` both ways), so a lookup takes no reference. An owner whose address is reused by a different object still misses. **Host allocations per draw.** - Owners retained once per batch. `keepRecordedDraw` no longer allocates a `Kept` object per draw. `Recorder::Retain` adds the draw's resources, pipeline, framebuffer, index and vertex buffers and resident targets to the batch's kept list, skipping an owner the batch already holds (an open-addressing table keyed by the owner's address and control block, reset by an epoch when a batch opens). `Recorder::ReserveRetention` sizes the list and table once per draw. The owners live until the batch completes, as before. - Attachment lists inline. A new `InlineList<T, N>` keeps up to N items in place and moves them to a vector only past N. It holds the dynamic rendering color attachments (8), the pass attachments (16), the store flags, target slices and resident targets (8), and the color export slots that `DecodeState` and `DrawRejection` compute (8). - Draw bindings only when needed. `PrepareDrawBindings` allocates its `DrawBindings` only when the draw keeps a snapshot, or when its object has re-bound a texture after a cache eviction (`rebound`): the object's own descriptor set then no longer matches its textures, so every later draw of it writes fresh sets. The first form of this commit missed the second case and dereferenced a null `DrawBindings` on such a draw; `21419394cb` creates it, and the `rebound` case of `agc_driver_table_index_validation` covers it. - Storage images in thread-owned storage. A new `ShaderResources::StorageImages(out)` fills a thread-owned vector instead of returning a new one per draw. - Dispatch vectors sized once. `Driver::dispatch` reserves its user data and snapshot lists, and keeps its one or two shader memory regions in a fixed array. - `refreshResidentTarget` takes its lookup as a template parameter instead of a `std::function`. - Four code comments that described the removed `Kept` object (`Draw.cpp`, `Pipeline.cpp`) are removed. No behaviour changes. Overlap, checked on 2026-11-07 against `main` `46552cb461` with `tools/pr_overlap.py` and by hand: the tool reports four open pull requests that change lines this branch changes (#7369, #9508, #16115, #16413) and 84 more that conflict with `main` and share files with it (57 of the 88 have a commit since 2026-10-24; I read the hunks of 17). #14051 (labelled needs rebase) also makes the clock reads of `DrawTimer` and its new `planDraw` depend on profiling, the same idea as the clock commit here, as part of a larger split of `prepareDraw`; whichever lands second keeps one form of the `DrawTimer` lines. Nothing else implements the same thing. #16115 adds `passGeneration` beside the retention members of `Recorder` and changes the start of `Recorder::ensureOpen`, where the retention reset is at the end; its attachment memo copies color target vectors on a miss, so the allocation census should run on top of it once both are in. #7369 and #9508 change other lines of `DrawWithRecipe`, `prepareDraw` and `recordPreparedDraw`; #13863, #13920 and the device image table stack (#7642, #10193, #13928, #13929) change `keepRecordedDraw`, `Recorder::ensureOpen` and `Driver::dispatch` and will rebase onto `Recorder::Retain`. Rechecked against `4977f64052`: the tool now confirms #7369, #10920, #16115, #16413 and #16572 (`Draw.cpp`, beside the attachment and pipeline-key code); none implements the same thing. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Reviewed head `eb92a8c70d9`. The replay, GTA and census-by-commit numbers below were measured on `656c08e951`. The census limits were re-derived on `b7f0ab6e98f` (section below). Since `656c08e951`, the driver code changed only by `main` merges, `21419394cb` (draw bindings on a re-bind) and two review commits with no runtime change: `b7f0ab6e98f` drops a no-op `std::move`, and `eb92a8c70d9` makes the draw record a non-copyable `BorrowedDraw`. Head `656c08e951` on `main` `4977f64052`; the merges since, up to `fcee5cb0b8`, bring `main` in and add `21419394cb` (draw bindings on a re-bind) and its test. **Retention test after the `main` merge.** `main`'s #16760 creates draw-input copies with `TRANSFER_SRC` as well as their vertex or index usage, and the buffer pool hands a buffer back only under its exact usage. `agc_driver_recorded_draw_retention` probed the pool with plain vertex and index usage, so on Windows it reported that recorded vertices survived completion, and its checks before completion could not have found the buffer either way. The test now reads each recorded input's usage from its `vkCreateBuffer`, requires it to carry the bound role, and probes with that usage before and after completion; the driver change is untouched. Fork CI on head `6479bab223` ([run 43750013318](https://github.com/chitters2004/AnyPS5/actions/runs/43750013318)): Linux 8 of 8; Windows 5 pass, including `agc_driver_recorded_draw_retention`, and the three draw allocation tests skip as they do on Windows on the earlier head; 0 `VUID-` lines. **Review follow-up** (census per-site bound, cleared target in the rebound test; test files only). Linux, GCC 13, Release, Mesa lavapipe 25.2.8, Khronos validation layer 1.4.363.1 with synchronization validation on (`VK_KHRONOS_VALIDATION_VALIDATE_SYNC=1`), `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer`: `ctest -R '^(agc_driver_table_index_validation|agc_driver_draw_allocations|agc_driver_draw_allocations_draw_pipeline|agc_driver_draw_allocations_plan_verify)$' -V` on `fcee5cb0b8` and on the follow-up, same machine: 4 of 4 passed on both; the loader inserts the layer for `agc_driver_table_index_validation` (the census tests unset `VK_INSTANCE_LAYERS` by design); no `VUID-` or `SYNC-HAZARD` line and no `was not found but was requested by env var VK_INSTANCE_LAYERS` in either log. Mutants: a draw that is skipped after the re-bind passes the earlier rebound test (the target still holds the settle draws' key texel) and fails the new one; one restored per-draw allocation is above. **Refreshed onto `main` `4977f64052`.** Head `656c08e951`; `git range-diff` against the same patches on `46552cb461` shows them unchanged (11 commits, `=`). Local RTX 3080 gate on both, same environment as below (`ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`), built one after the other in one build tree, with the focused AGC set of all five pull requests of this series (237 tests on this head, 232 on `main`): both 100 % passed, no `VUID-` line in either log or in replay subprocess logs, and neither log contains `was not found but was requested by env var VK_INSTANCE_LAYERS`. Fork CI on the rebased head against `4977f64052`: [run 42374111231](https://github.com/chitters2004/AnyPS5/actions/runs/42374111231): Linux 40 of 43 passed, 3 skipped; Windows 38 of 44 passed, 5 skipped, and `agc_driver_recorder` failed, as it does on `main`. The new `agc_driver_draw_allocations` tests pass on Linux and skip on Windows by design: the driver allocates through its own `operator new` in a DLL the census cannot interpose. No `VUID-` line on either side, conventions check passed. The measurements and full runs below were on the previous base `46552cb461`; the code they measured is unchanged. **Vulkan validation.** RTX 3080, `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ctest --test-dir build -R 'agc|write_tracking|guest|indirect_draw|draw_finisher|depth_bias|draw_pipeline' -V` on this branch's patches on `46552cb461`, the same patches as `656c08e951` (3204 tests), and on `main` `46552cb461` (3199 tests). Every test failing in either full run was then rerun alone on both builds, one build at a time with nothing else on the GPU, using `ctest -R` with the union of the 16 names and the same environment: on both, 15 of 16 passed and only `agc_driver_direct_write_completion` failed, which fails on `main` too (#15547); the other failures of the full runs were timeouts and `0xc0000409` exits under load from concurrent gates and did not reproduce alone. Both full logs hold the same 18 `VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605` lines and no other `VUID-`; neither contains `was not found but was requested by env var VK_INSTANCE_LAYERS`. The change adds no validation error. **Fork CI** (GitHub runners, Mesa lavapipe with the Khronos validation layer, head against `main`): [run 42337669902](https://github.com/chitters2004/AnyPS5/actions/runs/42337669902) (48 tests on each OS, this branch's patches on `46552cb461` against `46552cb461`): Linux 48 of 48 passed with the validation layer; Windows 45 passed, the two allocation census tests reported themselves skipped (they need the driver's `operator new`, see below), and `agc_driver_recorder` failed, as it does on `main` on the same runner. [run 42338181178](https://github.com/chitters2004/AnyPS5/actions/runs/42338181178) for the retention tests: Linux 10 of 10 and Windows 11 of 11. No `VUID-` line in any of them, conventions check passed. **Tests.** - `agc_driver_draw_allocations`, `_draw_pipeline` and `_plan_verify` (new, Linux; on Windows the driver allocates through its own `operator new` in a DLL the test cannot interpose, so they report themselves skipped): the test replaces `operator new` and counts, per shape (recipe auto draw, indexed draw with guest indices, indexed draw with image indices, compute dispatch), what warmed draws allocate beyond a baseline, both in total and per call site on every draw. The measurement and the ceilings were redone on the current head; see **Draw allocation census: measurement and limits** below. Restoring one per-draw allocation in `keepRecordedDraw` (a `make_shared` per draw, as the removed `Kept` was) fails the every-draw bound. Both tests unset `VK_INSTANCE_LAYERS`, because under the validation layer the replaced `operator new` also counts the layer's own allocations. The variables that select shapes and override the ceilings are in `docs/dev/ENVIRONMENT.md`. - `agc_driver_recorded_draw_retention` (new): a recorded draw's indices, vertices, pipeline, framebuffer, resources, resident targets and GPU indirect scratch stay alive until its batch completes, also after their cache entries are evicted and when a recipe hit in the next batch uses them again, and are released when the last batch that used them completes. - `agc_driver_vertex_target_range_copied` and `_imported` (extended): a recorded draw's resident target survives a cleared resource cache until completion and is released after it, and with imported vertices the GPU indirect scratch is not recycled before completion. They now run with `APS5_RELEASE_UNDER_LOCK=1`, the new `_release_thread` variants run them with the release thread, and all four fail on any `VUID-` or `InvalidCommandBuffer` line. - `agc_recorder_kept_bytes` (`RecorderKeptBytes.cpp`, extended): 100 owners retained twice each through a growing lookup, mixed with `Keep`, are each held once until completion and released after it; a batch whose submit fails releases its owners, and the batch that replaces it retains a live owner again exactly once and holds it until its fence. - `agc_driver_host_allocator` (`HostAllocator.cpp`, extended, Windows): an `InlineList` keeps order and ownership across its inline bound, does not duplicate an owner when it spills, releases its owners when destroyed, and works with no inline slots. - `agc_driver_table_index_validation` `rebound` case (new): textures leave the cache under an object built with `APS5_DRAW_SNAPSHOT_MAX_MIB=0`, so the next draw re-binds them with no snapshot kept; the target is cleared before each checked draw, so a re-bound draw that draws nothing fails. - `agc_driver_graphics` runs `framebufferOwnerTests`: a live owner reuses its framebuffer, the same address with a different owner does not, and a replaced owner gets a distinct framebuffer. The clock and reference changes have no behaviour of their own to test; the existing draw, dispatch and indirect tests in the gate above run through every changed site with profiling off, and the `APS5_PROFILE_DRAW` tests with it on. ### Draw allocation census: measurement and limits (sync head b7f0ab6e98f) **Why it changed.** The census used to count one 256-draw batch. Whether earlier draws' pool slots and draw-use records were free again depended on how far the GPU had got, so the count moved with machine load: up to 1 failure in 20 per variant on a loaded Linux machine. **How it measures now.** - Each measured submit holds 8 leading draws and 32 measured draws, and the test waits for the GPU to go idle after every submit, so every measured submit starts with all earlier GPU work done. - The same number of submits with only the 8 leading draws is subtracted, so per-submit setup cancels. - Under that method the every-draw call-site counts are exact (42/44/44/10 plain, 45/47/47/13 pipelined) across 5 idle and 10 loaded runs per variant. Allocations per draw move by less than 0.2. Bytes per draw move by up to 316 when a pool grows once. **The census is Linux-only.** On Windows the driver allocates through its own operator new in the DLL, which the census cannot interpose, so the tests skip there. **Limits.** These were this PR's own constants, set against an older main and the old measurement. They are re-derived from Linux fork CI run 44098566795: three runs plain, six pipelined (draw_pipeline and plan_verify). | shape | plain: measured → limit (allocations / bytes / every draw) | pipelined: measured → limit | |---|---|---| | recipe auto draw | 42.500 / 8062.0 / 42 → 43.0 / 8462 / 42 | 45.734 / 8248.5 / 45 → 46.3 / 8649 / 45 | | indexed, guest indices | 44.531 / 8322.0 / 44 → 45.1 / 8722 / 44 | 47.766 / 8508.5 / 47 → 48.3 / 8909 / 47 | | indexed, image indices | 44.863 / 10356.1 / 44 → 45.4 / 10757 / 44 | 48.098 / 10529.5 / 47 → 48.6 / 10930 / 47 | | compute dispatch | 10.773 / 953.9 / 10 → 11.3 / 1354 / 10 | 14.023 / 1377.9 / 13 → 14.6 / 1778 / 13 | The margin is the same for every shape: - allocations: highest measured plus 0.5; - bytes: highest measured plus 400 per draw; - every-draw count: exact. The byte margin absorbs a one-off pool growth; the largest seen added 316 per draw. The count limits still catch any new allocation, and the every-draw count catches a new call site. **What main added.** I ran the same measurement on this branch's previous base (03afc904a1e) and on the sync: - allocation counts are identical; - every draw is 24 bytes larger: `DrawTail` now holds `userPatches`, from #19267; - an index copy from image memory is 16 bytes larger: `Buffer` embeds `Context`, which grew with #20368, #19373 and #18842. The commit-cost work on the driver's per-draw allocations (the finisher queue nodes, the second `DrawWriteRanges`, `BeginDrawUse` records, BufferPool slots) is how these numbers come back down. **Proof.** 30/30 runs of all three variants passed locally under a parallel ctest -j16 load, at load average 15 on 4 cores. Fork CI on b7f0ab6e98f: [run 44114467966](https://github.com/chitters2004/AnyPS5/actions/runs/44114467966), Linux gate green; on Windows the three census tests report themselves skipped, as described above. **Host allocations per operation**, from the census on the GitHub Linux runner (fork CI `census` job, Mesa lavapipe, no validation layer). Each column is one commit with the census test applied: `main` is `46552cb461` plus the census test, the next adds the clock and owner commits, the next the retention, inline list, draw binding and storage image commits (an earlier form of this branch, with the same driver code as `b172d695d9` here and the census test in its earlier form), and the last is this head with the two dispatch and color export commits. Count per draw or dispatch, requested bytes in brackets. | test | shape | `main` + census test | + clock and owner commits (`a997ef0a52`) | + retention, inline lists, bindings, storage images (`b172d695d9`) | this head (`656c08e951`) | |---|---|---|---|---|---| | `agc_driver_draw_allocations` | recipe auto draw | 49.78 (8,113 B) | 49.77 (8,069 B) | 43.78 (7,795 B) | 42.72 (7,807 B) | | `agc_driver_draw_allocations` | indexed draw, guest indices | 51.81 (8,272 B) | 51.88 (8,173 B) | 45.82 (7,955 B) | 44.74 (8,010 B) | | `agc_driver_draw_allocations` | indexed draw, image indices | 51.95 (10,166 B) | 52.02 (10,136 B) | 45.97 (9,953 B) | 44.97 (9,949 B) | | `agc_driver_draw_allocations` | compute dispatch | 17.94 (1,100 B) | 17.94 (1,100 B) | 17.95 (1,100 B) | 10.94 (872 B) | | `agc_driver_draw_allocations_draw_pipeline` | recipe auto draw | 52.98 (8,208 B) | 52.98 (8,166 B) | 46.93 (7,938 B) | 45.93 (7,936 B) | | `agc_driver_draw_allocations_draw_pipeline` | indexed draw, guest indices | 55.03 (8,401 B) | 55.02 (8,348 B) | 48.98 (8,199 B) | 47.97 (8,115 B) | | `agc_driver_draw_allocations_draw_pipeline` | indexed draw, image indices | 55.24 (10,364 B) | 55.18 (10,315 B) | 49.18 (10,168 B) | 48.15 (10,130 B) | | `agc_driver_draw_allocations_draw_pipeline` | compute dispatch | 20.66 (1,439 B) | 20.66 (1,439 B) | 20.66 (1,439 B) | 13.66 (1,211 B) | The plain recipe auto draw falls from 49.78 to 42.72 allocations per draw (-14.2 %), the pipelined one from 52.98 to 45.93, and a compute dispatch from 17.94 to 10.94. Census runs: [42338046309](https://github.com/chitters2004/AnyPS5/actions/runs/42338046309), [42338087047](https://github.com/chitters2004/AnyPS5/actions/runs/42338087047), [42335669341](https://github.com/chitters2004/AnyPS5/actions/runs/42335669341), [42337669902](https://github.com/chitters2004/AnyPS5/actions/runs/42337669902). Clock reads removed per draw with profiling off: one in `DrawTimer`, one per resident color target lookup, one in each of `buildPrepare` and `buildComplete` when the draw builds its resources, and one or two per indirect draw whose records the CPU reads; one per dispatch and one per dispatch resolved ahead. On Windows each read is a `QueryPerformanceCounter` call. In a 60 s stack sample of the draw committer in the GTA V scene below on `main` (3,843 samples), the clock path (`ntdll.dll+0x8b29d` and `clock_settime` in winpthreads) is 3.4 % of its self time; part of it comes from other callers. Per recorded draw, one `shared_ptr` copy and release fewer (two atomic operations), and one `weak_ptr::lock` and release fewer per owner on each framebuffer cache lookup. **Per-draw cost, replay.** Identical frames, so the change is the only difference. A 3-frame capture of the scene below (`APS5_FRAME_CAPTURE`, 9,364 draws) is replayed with `agc_frame_replay --repeat 5` through the real submit path, with the same pipelined-draw settings as the boots; passes 2 to 5 count. Base `46552cb461` and each build alternate run by run. Every pass of every run drew exactly 9,364 draws and every run matched the base pixels exactly (`pixels_identical` 1.0). The metric is committer wall time per commit, per draw; base is about 53.2 µs per draw. The replay tool is `main`'s `tools/FrameReplay.cpp` with #12565, #12567, #12568, #11435 and #13984 merged and a local retire of resident images before each memory restore so `--repeat` works; it is local and not part of this pull request (per-build summaries and binary provenance attached). | build | pairs | commit µs per draw, change (95 % CI) | relative | timed ms per pass, change (95 % CI) | |---|---|---|---|---| | this change, `656c08e951` | 10 | -0.44 ± 0.37 | -0.8 % | -4.9 ± 6.9 | | all three merged on `46552cb461` | 5 | -2.99 ± 0.44 | -5.6 % | -25.5 ± 7.7 | | calibration: +1.0 µs spin per draw | 5 | +0.92 ± 0.68 | +1.7 % | +6.3 ± 11.4 | | null control: import validity `f62ea7bd08` | 5 | -0.19 ± 0.64 | -0.4 % | -0.1 ± 11.1 | | null control: pushless offset `0e323b1bdc` | 5 | -0.56 ± 1.00 | -1.1 % | -4.9 ± 9.5 | The calibration build reads its injected 1.0 µs, so the replay resolves per-draw costs below 1 µs; base against base reads +0.10 ± 0.37. The two null controls stay within noise. The three changes add up: -1.35, -0.81 and -0.44 sum to -2.60, inside the merged build's -2.99 ± 0.44. Thread CPU columns are attached but not used: Windows thread times tick in 15.6 ms steps, too coarse for 1 µs per draw. The replay cannot show contention with the title's own threads, frame pacing, or GPU-bound time. **Frame time, stacked boots.** `main` `46552cb461` against the three changes merged on it, one warm-up boot each, then two ABBA pairs in the scene below on the current host: mean ms/frame 147.0 to 136.0 (-7.5 %) and 136.7 to 131.3 (-4.0 %); p99 168.8 to 181.9 and 192.6 to 188.7. These are not attributed to the change: the merged build drew 13 % fewer draws per present in those boots (1,497 and 1,611 against 1,783 and 1,801), and draw count varies from boot to boot with the scene, which is why the per-draw figure above comes from the replay. The older per-pull-request pairs below were taken on this branch before its rebase and on the host state before the changes listed under Host; the counts are per pull request and stay. **Performance, older per-PR pairs.** GTA V (PPSA04263, content 01.011.001), standing scene, 3840x2160, default in-game settings. Two interleaved pairs, `main` then this change, twice, after one warm-up boot of each build that is not a sample. Each capture is the 30 s trace window from 235 s after launch, about 30 s after the player stands still (202 to 206 s in every capture), with pipelined draws (`APS5_DRAW_PIPELINE=1`, `APS5_PIPELINED_DRAWS=32`, `APS5_PIPELINE_DISPATCH=1`). `main` was `7383be1a19`; the change was `ce6b71c04a`, this branch before its rebase onto `46552cb461` and before two commits were added: `ce6b71c04a` holds the clock, owner, retention, inline list, draw binding and storage image commits, and `git range-diff` shows the same patches for those. The dispatch vector and color export commits were not timed on their own; they cut allocations only (table above). | capture | commit | presents in 30 s | mean ms/frame | p50 | p90 | p99 | max | GPU busy ms/present | queue worker busy | |---|---|---|---|---|---|---|---|---|---| | main, pair 1 | `7383be1a19c7` | 213 | 141.4 | 138.9 | 150.5 | 165.1 | 197.2 | 34.1 | 95.1 % | | change, pair 1 | `ce6b71c04ac6` | 223 | 134.6 | 133.0 | 142.9 | 159.5 | 199.3 | 33.7 | 95.0 % | | main, pair 2 | `7383be1a19c7` | 219 | 137.3 | 135.0 | 146.9 | 176.2 | 193.3 | 33.8 | 94.8 % | | change, pair 2 | `ce6b71c04ac6` | 221 | 136.0 | 134.2 | 144.7 | 152.2 | 221.1 | 34.0 | 94.9 % | Change minus main, mean ms/frame: pair 1 -6.87, pair 2 -1.37, mean -4.12 (-3.0 %); p50 -5.9 and -0.8; p99 -5.6 and -24.0. Frame time is within noise, with a small gain that two pairs cannot confirm. Both pairs are faster with the change, by 6.9 and 1.4 ms, a mean of 4.1 ms (3.0 %). Twelve `main` captures of this scene across six blocks give a mean of 137.6 ms per frame with a standard deviation of 1.85 ms (1.35 %), so the mean of two pair deltas resolves about 2 ms; but the pair-1 `main` capture (141.4 ms) is the slowest of those twelve, and without it the gain is the 1.4 ms of pair 2. Why frame time barely moves: the scene is CPU-bound and the draw committer is its critical path. In a 60 s stack sample of `main` in this scene (1 ms sampling, 3,843 samples per thread, digests attached), `finishDraw`/`commitDraw` is 79.8 % of the committer's samples inclusive, `Graphics::Draw` 76.1 %, `prepareDraw` 53.4 %, `recordPreparedDraw` 21.8 % and `collectWrites` 12.2 %; about half the sampled stacks are cut at 64 frames, so inclusive shares are lower bounds. The queue worker shows 95 % busy in every capture, but 53 % of its samples are `DrawFinisher::Drain` reading `steady_clock::now` while it waits, so that figure overstates its load. GPU busy is 33.8 ms of a 137 ms frame. This change acts on `prepareDraw` and `recordPreparedDraw` on the committer and on the clock path. In separate counter boots of the same scene (`APS5_PROFILE_DRAW=1`, which turns off the draw finisher handoff), the driver's own `[draw]` phase means were 35.0 us per draw packet on `main` (two boots, 3.0 % apart) and 36.8 us with the change, but those boots drew 2,827 to 2,853 draws per present on `main` and 3,167 with the change, so they are no evidence either way. Summary lines (`tools/trace_digest.py` JSON summary, one per capture, in the order of the table): ```json {"commit":"7383be1a19c7","dirty":false,"env":{"APS5_ADDRESS_COPY_MAX_MIB":"512","APS5_DRAW_PIPELINE":"1","APS5_DUMP_FRAMES":"80","APS5_DUMP_FRAMES_EVERY":"300","APS5_LOG_TIMESTAMPS":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"32","APS5_PIPELINE_DISPATCH":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"235:30","APS5_TRACE_SUMMARY_EVERY":"10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 621.14","os":"Windows 10.0.26220","cpu":"AMD Ryzen 7 5800X 8-Core Processor","cpu_threads":16,"memory_mib":32676,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.011.001","resolution":"3840x2160","window":{"spec":"seconds 235:30","first_present":4076,"ms":30125.147},"presents":213,"frame_ms":{"p50":138.921,"p90":150.457,"p99":165.080,"max":197.168},"gpu_busy_ms_per_present":34.091,"worker_busy_pct":{"queue worker 0x0":95.107},"top_phases_ms_per_frame":{"Driver.Packet":127.592,"Graphics.Draw":109.451,"Driver.Packet.draw":94.541,"Driver.Draw":93.936,"Graphics.Draw.draw_and_resource_release":86.115,"Driver.DrawFinish":81.806,"Driver.Draw.prepare":73.357,"Driver.DrawFinish.shader_compile_and_link":45.669},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.031,"events_lost":1316774,"totals_full":false},"draw committer":{"events_full_after_s":10.760,"events_lost":473252,"totals_full":false},"draw finisher":{"events_full_after_s":12.163,"events_lost":382180,"totals_full":false}},"trace":"aps5-trace-7383be1a19c7-26956.json.gz"} {"commit":"ce6b71c04ac6","dirty":false,"env":{"APS5_ADDRESS_COPY_MAX_MIB":"512","APS5_DRAW_PIPELINE":"1","APS5_DUMP_FRAMES":"80","APS5_DUMP_FRAMES_EVERY":"300","APS5_LOG_TIMESTAMPS":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"32","APS5_PIPELINE_DISPATCH":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"235:30","APS5_TRACE_SUMMARY_EVERY":"10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 621.14","os":"Windows 10.0.26220","cpu":"AMD Ryzen 7 5800X 8-Core Processor","cpu_threads":16,"memory_mib":32676,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.011.001","resolution":"3840x2160","window":{"spec":"seconds 235:30","first_present":4078,"ms":30007.582},"presents":223,"frame_ms":{"p50":133.012,"p90":142.895,"p99":159.453,"max":199.268},"gpu_busy_ms_per_present":33.669,"worker_busy_pct":{"queue worker 0x0":94.952},"top_phases_ms_per_frame":{"Driver.Packet":121.124,"Graphics.Draw":102.744,"Driver.Packet.draw":91.980,"Driver.Draw":91.377,"Graphics.Draw.draw_and_resource_release":80.857,"Driver.DrawFinish":78.246,"Driver.Draw.prepare":71.054,"Driver.DrawFinish.shader_compile_and_link":43.881},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.062,"events_lost":1281650,"totals_full":false},"draw committer":{"events_full_after_s":11.180,"events_lost":439984,"totals_full":false},"draw finisher":{"events_full_after_s":12.692,"events_lost":353376,"totals_full":false}},"trace":"aps5-trace-ce6b71c04ac6-4748.json.gz"} {"commit":"7383be1a19c7","dirty":false,"env":{"APS5_ADDRESS_COPY_MAX_MIB":"512","APS5_DRAW_PIPELINE":"1","APS5_DUMP_FRAMES":"80","APS5_DUMP_FRAMES_EVERY":"300","APS5_LOG_TIMESTAMPS":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"32","APS5_PIPELINE_DISPATCH":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"235:30","APS5_TRACE_SUMMARY_EVERY":"10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 621.14","os":"Windows 10.0.26220","cpu":"AMD Ryzen 7 5800X 8-Core Processor","cpu_threads":16,"memory_mib":32676,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.011.001","resolution":"3840x2160","window":{"spec":"seconds 235:30","first_present":4061,"ms":30078.660},"presents":219,"frame_ms":{"p50":134.971,"p90":146.895,"p99":176.226,"max":193.256},"gpu_busy_ms_per_present":33.841,"worker_busy_pct":{"queue worker 0x0":94.793},"top_phases_ms_per_frame":{"Driver.Packet":123.715,"Graphics.Draw":105.295,"Driver.Packet.draw":93.672,"Driver.Draw":93.070,"Graphics.Draw.draw_and_resource_release":83.071,"Driver.DrawFinish":80.443,"Driver.Draw.prepare":72.750,"Driver.DrawFinish.shader_compile_and_link":44.416},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.133,"events_lost":1286905,"totals_full":false},"draw committer":{"events_full_after_s":10.990,"events_lost":456616,"totals_full":false},"draw finisher":{"events_full_after_s":12.610,"events_lost":361255,"totals_full":false}},"trace":"aps5-trace-7383be1a19c7-16268.json.gz"} {"commit":"ce6b71c04ac6","dirty":false,"env":{"APS5_ADDRESS_COPY_MAX_MIB":"512","APS5_DRAW_PIPELINE":"1","APS5_DUMP_FRAMES":"80","APS5_DUMP_FRAMES_EVERY":"300","APS5_LOG_TIMESTAMPS":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"32","APS5_PIPELINE_DISPATCH":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"235:30","APS5_TRACE_SUMMARY_EVERY":"10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 621.14","os":"Windows 10.0.26220","cpu":"AMD Ryzen 7 5800X 8-Core Processor","cpu_threads":16,"memory_mib":32676,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.011.001","resolution":"3840x2160","window":{"spec":"seconds 235:30","first_present":4113,"ms":30051.379},"presents":221,"frame_ms":{"p50":134.189,"p90":144.737,"p99":152.210,"max":221.095},"gpu_busy_ms_per_present":33.959,"worker_busy_pct":{"queue worker 0x0":94.872},"top_phases_ms_per_frame":{"Driver.Packet":122.132,"Graphics.Draw":103.684,"Driver.Packet.draw":92.613,"Driver.Draw":91.999,"Graphics.Draw.draw_and_resource_release":81.451,"Driver.DrawFinish":78.895,"Driver.Draw.prepare":71.495,"Driver.DrawFinish.shader_compile_and_link":44.669},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.276,"events_lost":1254911,"totals_full":false},"draw committer":{"events_full_after_s":11.314,"events_lost":435316,"totals_full":false},"draw finisher":{"events_full_after_s":13.072,"events_lost":342614,"totals_full":false}},"trace":"aps5-trace-ce6b71c04ac6-4316.json.gz"} ``` Traces: main, pair 1 [aps5-trace-7383be1a19c7-26956.json.gz](https://github.com/chitters2004/AnyPS5/releases/download/pr-m3-traces/aps5-trace-7383be1a19c7-26956.json.gz), change, pair 1 [aps5-trace-ce6b71c04ac6-4748.json.gz](https://github.com/chitters2004/AnyPS5/releases/download/pr-m3-traces/aps5-trace-ce6b71c04ac6-4748.json.gz), main, pair 2 [aps5-trace-7383be1a19c7-16268.json.gz](https://github.com/chitters2004/AnyPS5/releases/download/pr-m3-traces/aps5-trace-7383be1a19c7-16268.json.gz), change, pair 2 [aps5-trace-ce6b71c04ac6-4316.json.gz](https://github.com/chitters2004/AnyPS5/releases/download/pr-m3-traces/aps5-trace-ce6b71c04ac6-4316.json.gz). `tools/performance_compare.py` output per pair: [pair 1](https://github.com/chitters2004/AnyPS5/releases/download/pr-m3-traces/compare-s1.md), [pair 2](https://github.com/chitters2004/AnyPS5/releases/download/pr-m3-traces/compare-s2.md). `tools/trace_digest.py` output per capture: [main, pair 1](https://github.com/chitters2004/AnyPS5/releases/download/pr-m3-traces/base-s1.digest.txt), [change, pair 1](https://github.com/chitters2004/AnyPS5/releases/download/pr-m3-traces/cand-s1.digest.txt), [main, pair 2](https://github.com/chitters2004/AnyPS5/releases/download/pr-m3-traces/base-s2.digest.txt), [change, pair 2](https://github.com/chitters2004/AnyPS5/releases/download/pr-m3-traces/cand-s2.digest.txt). Deviations from the Performance report form, the same in every capture ([deviations.txt](https://github.com/chitters2004/AnyPS5/releases/download/pr-m3-traces/deviations.txt), environment per capture in the `*-env.txt` files): - The pipelined draw variables above, `APS5_ADDRESS_COPY_MAX_MIB=512`, `APS5_NO_PAD_INPUT=1`, `APS5_LOG_TIMESTAMPS=1` and `APS5_TRACE_SUMMARY_EVERY=10`. - Scripted pad input from one saved game reaches the scene, and frame dumps (`APS5_DUMP_FRAMES=80`, `APS5_DUMP_FRAMES_EVERY=300`) let the script see the menus and check the view; the log is redirected to a file the script reads. - All builds share one warm shader cache directory (`ANYPS5_SHADER_CACHE_DIR`, `__GL_SHADER_DISK_CACHE_PATH`). - The trace buffers fill in every capture (`trace_dropped`), so slice counts are partial; the summary totals are complete. Host: AMD Ryzen 7 5800X (16 threads), 32 GB, NVIDIA GeForce RTX 3080 (driver 621.14, Vulkan 1.4.357), Windows 10.0.26220, desktop on AC power with the High performance scheme, display 2560x1440 at 179 Hz; the title renders 3840x2160 ([host-report.txt](https://github.com/chitters2004/AnyPS5/releases/download/pr-m3-traces/host-report.txt)). That is the host of the older pairs and the counter boots above. Since then Resizable BAR is on (BAR1 16384 MiB, VBIOS 94.02.27.00.09), Windows is build 26320 and Defender excludes the build, tool and capture folders; the driver is still 621.14. The replay measurement and the stacked boots ran on that host. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #21336 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 3080 (driver 621.14, Windows 10.0.26220); Mesa lavapipe on the fork's GitHub runners (Linux and Windows) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
gabichuuuuu commented 2026-11-07 20:46:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-07T20:46:13Z.

Review: COMMENTED


Windows check of head 656c08e951 on the NVIDIA laptop GPU (driver 610) and the Intel iGPU in the same machine, the two cells the description doesn't have. Merged onto main 6b733c4ef2 (clean), with main from the same build directory as the control. Windows 11 x64, WinLibs GCC 15.2.0 r7, Release, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest -R '^agc_driver_(recorded_draw_retention|draw_allocations|vertex_target_range|host_allocator)', 3 runs per GPU.

NVIDIA Intel
main (3 tests) pass pass
this PR (8 tests) 6 pass, 2 skipped, 3 of 3 runs 6 pass, 2 skipped, 3 of 3 runs
  • Passing on both GPUs: recorded_draw_retention, host_allocator, vertex_target_range_copied, vertex_target_range_imported, and the new _copied_release_thread and _imported_release_thread.
  • agc_driver_draw_allocations and agc_driver_draw_allocations_draw_pipeline skip on Windows by design (draw allocations: skipped, the driver allocates through its own operator new in a DLL that this census cannot interpose), so this run says nothing about the allocation counts, which are the core of the perf claim. Only the Linux runs cover that.
  • Not run with VK_LAYER_KHRONOS_validation.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5814925756 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16753#pullrequestreview-5814925756). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-07T20:46:13Z. **Review:** COMMENTED --- Windows check of head `656c08e951` on the NVIDIA laptop GPU (driver 610) and the Intel iGPU in the same machine, the two cells the description doesn't have. Merged onto `main` `6b733c4ef2` (clean), with `main` from the same build directory as the control. Windows 11 x64, WinLibs GCC 15.2.0 r7, Release, `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest -R '^agc_driver_(recorded_draw_retention|draw_allocations|vertex_target_range|host_allocator)'`, 3 runs per GPU. | | NVIDIA | Intel | |---|---|---| | `main` (3 tests) | pass | pass | | this PR (8 tests) | 6 pass, 2 skipped, 3 of 3 runs | 6 pass, 2 skipped, 3 of 3 runs | - Passing on both GPUs: `recorded_draw_retention`, `host_allocator`, `vertex_target_range_copied`, `vertex_target_range_imported`, and the new `_copied_release_thread` and `_imported_release_thread`. - `agc_driver_draw_allocations` and `agc_driver_draw_allocations_draw_pipeline` skip on Windows by design (`draw allocations: skipped, the driver allocates through its own operator new in a DLL that this census cannot interpose`), so this run says nothing about the allocation counts, which are the core of the perf claim. Only the Linux runs cover that. - Not run with `VK_LAYER_KHRONOS_validation`. AI-assisted: yes.
MarcZX10 commented 2026-11-17 15:12:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T15:12:18Z.

Review: COMMENTED


Reviewed the full diff — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head: 81b14d6d07b21fdc7b4abf9d6218e29e0d7a8d31. Base: main. No merged preview.
  • No build and no test run in this pass. Source reading and spot checks at the head only.
  • Commands, all through the reader (repo_read.py):
repo_read.py search "PassAccess" core/libs/prx/libSceAgcDriver/Graphics
repo_read.py search "TouchCachedPipeline" core/libs/prx/libSceAgcDriver/Graphics
repo_read.py search "RecordedDraw" core/libs/prx/libSceAgcDriver
repo_read.py search "bool profile" core/libs/prx/libSceAgcDriver/Execution
repo_read.py search "commitNs" core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp
repo_read.py search "elapsedNs" core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp
repo_read.py search "result->" core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
repo_read.py search "APS5_DRAW_SNAPSHOT_MAX_MIB" core/libs/prx/libSceAgcDriver
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp 4961 4965
repo_read.py cat core/libs/prx/libSceAgcDriver/tests/DrawPipelineProfile.cpp 104 108
repo_read.py cat core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_host_allocator_tests.cmake 1 14
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp 7110 7124

Results

Check Result Note
Full diff.patch read passed 1,892 lines, every hunk
Build and compile not run no build in this pass
Unit and allocation tests not run author-reported only
Performance numbers not run author-reported captures and replay, not reproduced
Repository no-build precheck not run not run in this pass

Findings

Blocking

None.

Non-blocking

  1. core/libs/prx/libSceAgcDriver/tests/DrawPipelineProfile.cpp:107: the message says "a timed commit did not read the clock exactly twice", but the check compares against 4. Either the message or the number is wrong. A failure would print a misleading reason.
  2. core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:4963: RecordedDraw record{resources, std::move(pipeline), std::move(framebuffer)}; nothing is moved. The members are now const&, so the std::move calls only suggest a move that does not happen. Dropping them would match what the code does.
  3. core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_host_allocator_tests.cmake:12: agc_driver_draw_allocations is a draw test, registered in the host allocator's cmake file. Moving it next to the other draw test registrations would make it easier to find.

Not verified

  • Nothing compiled or run. The ctest runs, the VUID- scans, the allocation census figures, and the frame-time and replay numbers are the author's. I did not reproduce them.
  • The description's tests and captures cite head 656c08e951 and fork CI on 6479bab223. The pinned head here is 81b14d6d07. By the description's own wording, those results do not cover this head.
  • Four changed files were too large for the review folder: Graphics/src/ShaderResources.cpp, Graphics/src/Texture.cpp, tests/Graphics.cpp and tests/Recorder.cpp. Only their diff hunks were read. The rest of each file was not read.
  • Scope of profile at Execution/src/Driver/Draw/Draw.cpp:567 (CountEmptyIndirectDraw gated on it) was not confirmed. Compilation would settle it.
  • The repository's no-build precheck and the stack check (dependency on #21336 and the overlapping open pull requests) were not run.
  • Hosted CI for 81b14d6d07 was not inspected.
  • tests/execution/DrawAllocations.cpp and TableIndexValidation.cpp were read in the diff only. Their behaviour against the lavapipe and Windows environments was not checked.

To get this to a good state

Nothing is required. Optional: the three non-blocking points above. Rerun the test set on the current head and cite that head in the description.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5941088877 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16753#pullrequestreview-5941088877). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T15:12:18Z. **Review:** COMMENTED --- # Reviewed the full diff — no blocking findings Nothing blocks this; the points below are optional. ## What I ran - Head: `81b14d6d07b21fdc7b4abf9d6218e29e0d7a8d31`. Base: `main`. No merged preview. - No build and no test run in this pass. Source reading and spot checks at the head only. - Commands, all through the reader (`repo_read.py`): ```text repo_read.py search "PassAccess" core/libs/prx/libSceAgcDriver/Graphics repo_read.py search "TouchCachedPipeline" core/libs/prx/libSceAgcDriver/Graphics repo_read.py search "RecordedDraw" core/libs/prx/libSceAgcDriver repo_read.py search "bool profile" core/libs/prx/libSceAgcDriver/Execution repo_read.py search "commitNs" core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp repo_read.py search "elapsedNs" core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp repo_read.py search "result->" core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp repo_read.py search "APS5_DRAW_SNAPSHOT_MAX_MIB" core/libs/prx/libSceAgcDriver repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp 4961 4965 repo_read.py cat core/libs/prx/libSceAgcDriver/tests/DrawPipelineProfile.cpp 104 108 repo_read.py cat core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_host_allocator_tests.cmake 1 14 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp 7110 7124 ``` ## Results | Check | Result | Note | |---|---|---| | Full `diff.patch` read | passed | 1,892 lines, every hunk | | Build and compile | not run | no build in this pass | | Unit and allocation tests | not run | author-reported only | | Performance numbers | not run | author-reported captures and replay, not reproduced | | Repository no-build precheck | not run | not run in this pass | ## Findings ### Blocking None. ### Non-blocking 1. `core/libs/prx/libSceAgcDriver/tests/DrawPipelineProfile.cpp:107`: the message says "a timed commit did not read the clock exactly twice", but the check compares against 4. Either the message or the number is wrong. A failure would print a misleading reason. 2. `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:4963`: `RecordedDraw record{resources, std::move(pipeline), std::move(framebuffer)};` nothing is moved. The members are now `const&`, so the `std::move` calls only suggest a move that does not happen. Dropping them would match what the code does. 3. `core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_host_allocator_tests.cmake:12`: `agc_driver_draw_allocations` is a draw test, registered in the host allocator's cmake file. Moving it next to the other draw test registrations would make it easier to find. ## Not verified - Nothing compiled or run. The ctest runs, the `VUID-` scans, the allocation census figures, and the frame-time and replay numbers are the author's. I did not reproduce them. - The description's tests and captures cite head `656c08e951` and fork CI on `6479bab223`. The pinned head here is `81b14d6d07`. By the description's own wording, those results do not cover this head. - Four changed files were too large for the review folder: `Graphics/src/ShaderResources.cpp`, `Graphics/src/Texture.cpp`, `tests/Graphics.cpp` and `tests/Recorder.cpp`. Only their diff hunks were read. The rest of each file was not read. - Scope of `profile` at `Execution/src/Driver/Draw/Draw.cpp:567` (`CountEmptyIndirectDraw` gated on it) was not confirmed. Compilation would settle it. - The repository's no-build precheck and the stack check (dependency on #21336 and the overlapping open pull requests) were not run. - Hosted CI for `81b14d6d07` was not inspected. - `tests/execution/DrawAllocations.cpp` and `TableIndexValidation.cpp` were read in the diff only. Their behaviour against the lavapipe and Windows environments was not checked. ## To get this to a good state Nothing is required. Optional: the three non-blocking points above. Rerun the test set on the current head and cite that head in the description.
MarcZX10 commented 2026-11-17 18:46:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T18:46:02Z.

Review: COMMENTED


Reviewed the diff — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head b7f0ab6e98f5 (PR #16753, base main). Repository files were read only through repo_read.py.
  • Read in full: description.md, commits.md, manifest.json, diff.patch (all 1,894 lines), and the house-rule sections "Readable reviews", "Standard PR response format" and "Accuracy and evidence".
  • Reader calls:
python3 repo_read.py search CountIndirectDraw
python3 repo_read.py search CountEmptyIndirectDraw
python3 repo_read.py search APS5_RELEASE_UNDER_LOCK
python3 repo_read.py search DrawWithRecipe
python3 repo_read.py search recordDraw core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
python3 repo_read.py search "record.pipeline" core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
python3 repo_read.py search phaseStart core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp 1366 1396
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp 4978 5000
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp 2196 2212
  • No build, no ctest, no test run, no CI query. Nothing was posted or changed.

Results

Check Result Note
Diff hunks (28 changed files) passed every hunk read
Full text of included files not run 24 in the folder, none read whole
Indirect-draw counters passed already return early without APS5_PROFILE_DRAW
Shader build timing passed phase() returns early without BuildProfiled()
Build and ctest not run no build in this run
Author-reported CI and measurements not run not reproduced

Findings

Blocking

None.

Non-blocking

  1. core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_pipeline_profile_tests.cmake:10: the new agc_driver_pipeline_untimed sets only APS5_PIPELINED_DRAWS=8. timed in core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp:478 reads APS5_PROFILE_DRAW and APS5_PIPELINE_STATS once per process, so the test fails with "the committer read the clock" when either is exported in the runner or a developer's shell. Clear both in the test, as the other cases do with ENVIRONMENT_MODIFICATION ... =unset:.
  2. core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:2650: RecordedDraw now holds references to the caller's resources, pipeline and framebuffer, where it used to own copies. Both construction sites (recordPreparedDraw, DrawWithRecipe) keep those locals alive through recordDraw, so nothing is wrong today. A RecordedDraw copied or kept past its caller would dangle, and nothing in the type says so.
  3. core/libs/prx/libSceAgcDriver/tests/RecorderKeptBytes.cpp:360: FailedSubmission now splits Keep(kept, Budget) into Retain(kept) and KeepBytes(kept.get(), Budget). The byte-budgeted Keep overload is no longer exercised on a failed batch; RetentionAfterFailedSubmission is the only failed-batch case for retained owners.

Not verified

  • Full text of the 24 included files: I read the hunks in diff.patch and the reader ranges above, not whole files. The four files too large for the folder (ShaderResources.cpp, Texture.cpp, tests/Graphics.cpp, tests/Recorder.cpp) were read only as hunks.
  • files.json: not read, so its reviewed list was not checked against this review.
  • Recorder::Retain (core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp:218): the dedupe reads open->kept[index] from a stored index. The check compares the owner it finds, so a stale index causes a repeat retain rather than a miss. I did not confirm that nothing shrinks open->kept while a batch is open, which would make that read out of range.
  • recordDraw (core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp, new lines around 2903–2906): passImages now comes from thread-owned storage. I did not confirm that recordDraw cannot re-enter on the same thread while the span is in use.
  • No build and no test run here, including the Windows-only agc_driver_host_allocator tests and the census tests that skip on Windows.
  • Author-reported results, not reproduced: fork CI runs 42337669902, 42338181178, 42338046309, 42338087047, 42335669341 and 44114467966, the RTX 3080 Vulkan gates, the replay table and the GTA V traces. The Vulkan gates in the description ran on 656c08e951 (same patches as on 46552cb461), not on head b7f0ab6e98f5. The census limits were re-derived on b7f0ab6e98f5, and only run 44114467966 covers that head.
  • Replay: the change alone is -0.44 ± 0.37 µs per draw (-0.8 %). This is the author's figure; I did not check it.

To get this to a good state

Nothing is required. The non-blocking points above are optional.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5944534820 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16753#pullrequestreview-5944534820). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T18:46:02Z. **Review:** COMMENTED --- # Reviewed the diff — no blocking findings Nothing blocks this; the points below are optional. ## What I ran - Head `b7f0ab6e98f5` (PR #16753, base `main`). Repository files were read only through `repo_read.py`. - Read in full: `description.md`, `commits.md`, `manifest.json`, `diff.patch` (all 1,894 lines), and the house-rule sections "Readable reviews", "Standard PR response format" and "Accuracy and evidence". - Reader calls: ``` python3 repo_read.py search CountIndirectDraw python3 repo_read.py search CountEmptyIndirectDraw python3 repo_read.py search APS5_RELEASE_UNDER_LOCK python3 repo_read.py search DrawWithRecipe python3 repo_read.py search recordDraw core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp python3 repo_read.py search "record.pipeline" core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp python3 repo_read.py search phaseStart core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp 1366 1396 python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp 4978 5000 python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp 2196 2212 ``` - No build, no ctest, no test run, no CI query. Nothing was posted or changed. ## Results | Check | Result | Note | |---|---|---| | Diff hunks (28 changed files) | passed | every hunk read | | Full text of included files | not run | 24 in the folder, none read whole | | Indirect-draw counters | passed | already return early without `APS5_PROFILE_DRAW` | | Shader build timing | passed | `phase()` returns early without `BuildProfiled()` | | Build and ctest | not run | no build in this run | | Author-reported CI and measurements | not run | not reproduced | ## Findings ### Blocking None. ### Non-blocking 1. `core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_pipeline_profile_tests.cmake:10`: the new `agc_driver_pipeline_untimed` sets only `APS5_PIPELINED_DRAWS=8`. `timed` in `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp:478` reads `APS5_PROFILE_DRAW` and `APS5_PIPELINE_STATS` once per process, so the test fails with "the committer read the clock" when either is exported in the runner or a developer's shell. Clear both in the test, as the other cases do with `ENVIRONMENT_MODIFICATION ... =unset:`. 2. `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:2650`: `RecordedDraw` now holds references to the caller's `resources`, `pipeline` and `framebuffer`, where it used to own copies. Both construction sites (`recordPreparedDraw`, `DrawWithRecipe`) keep those locals alive through `recordDraw`, so nothing is wrong today. A `RecordedDraw` copied or kept past its caller would dangle, and nothing in the type says so. 3. `core/libs/prx/libSceAgcDriver/tests/RecorderKeptBytes.cpp:360`: `FailedSubmission` now splits `Keep(kept, Budget)` into `Retain(kept)` and `KeepBytes(kept.get(), Budget)`. The byte-budgeted `Keep` overload is no longer exercised on a failed batch; `RetentionAfterFailedSubmission` is the only failed-batch case for retained owners. ## Not verified - Full text of the 24 included files: I read the hunks in `diff.patch` and the reader ranges above, not whole files. The four files too large for the folder (`ShaderResources.cpp`, `Texture.cpp`, `tests/Graphics.cpp`, `tests/Recorder.cpp`) were read only as hunks. - `files.json`: not read, so its `reviewed` list was not checked against this review. - `Recorder::Retain` (`core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp:218`): the dedupe reads `open->kept[index]` from a stored index. The check compares the owner it finds, so a stale index causes a repeat retain rather than a miss. I did not confirm that nothing shrinks `open->kept` while a batch is open, which would make that read out of range. - `recordDraw` (`core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp`, new lines around 2903–2906): `passImages` now comes from thread-owned storage. I did not confirm that `recordDraw` cannot re-enter on the same thread while the span is in use. - No build and no test run here, including the Windows-only `agc_driver_host_allocator` tests and the census tests that skip on Windows. - Author-reported results, not reproduced: fork CI runs 42337669902, 42338181178, 42338046309, 42338087047, 42335669341 and 44114467966, the RTX 3080 Vulkan gates, the replay table and the GTA V traces. The Vulkan gates in the description ran on `656c08e951` (same patches as on `46552cb461`), not on head `b7f0ab6e98f5`. The census limits were re-derived on `b7f0ab6e98f5`, and only run 44114467966 covers that head. - Replay: the change alone is -0.44 ± 0.37 µs per draw (-0.8 %). This is the author's figure; I did not check it. ## To get this to a good state Nothing is required. The non-blocking points above are optional.
MarcZX10 commented 2026-11-17 19:28:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T19:28:02Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

Head eb92a8c70d9444798109552922d4c49f65ecceda, base main. No merged-preview check. No build and no test run: this was a read-only review through the reader and the review folder.

repo_read.py search "storeNow" core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
repo_read.py search "struct PassAccess" core/libs/prx/libSceAgcDriver/Graphics
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/include/PassHazards.hpp 15 40
repo_read.py search "TouchCachedPipeline" core/libs/prx/libSceAgcDriver/Graphics
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp 1478 1500
repo_read.py search "open = " core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
repo_read.py search "spent" core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp
repo_read.py search "commitNs" core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp
repo_read.py search "passImages" core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp 1362 1400
repo_read.py search "CountEmptyIndirectDraw" core/libs/prx/libSceAgcDriver/Graphics
repo_read.py search "rewatchCompared" core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp

Results

Check Result Note
Build not run read-only review
Tests in the description not run author-reported only
Changed hunks passed 30 of 30 reviewed files, from diff.patch
Reader spot checks passed 12 read-only calls

Findings

Blocking

None.

Non-blocking

  1. core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp:478 — the committer's clock gate reads only two environment variables (APS5_PROFILE_DRAW, APS5_PIPELINE_STATS). The description says the reads are skipped unless profiling is on, "APS5_PROFILE_DRAW or the build profile". I found no build-profile switch in this gate. If one exists, a build-profile run gets spent == 0 at DrawPipeline.cpp:508, and commitNs then reads zero for the per-commit figure. Either add the same switch or narrow the description.

Not verified

  • The ctest entries, the CMake macro agc_add_draw_pipeline_test that creates the _draw_pipeline and _plan_verify variants, and the ENVIRONMENT_MODIFICATION edits were not checked against CMake.
  • The performance numbers, the census limits and the replay table were not reproduced. They cite heads 656c08e951 and b7f0ab6e98, not the reviewed head eb92a8c70d.
  • BorrowedDraw in DrawWithRecipe and recordPreparedDraw now holds references to the caller's resources, pipeline and framebuffer instead of moving them. I did not read the code after recordDraw in DrawWithRecipe to confirm that nothing depends on those locals being empty afterwards.
  • recordDraw gives PassAccess a span into ShaderRecompiler::ThreadOwned storage for passImages. PassAccess is a struct of spans (PassHazards.hpp:19-27). I did not read LeaveRenderPassOpen to confirm it does not keep those spans after recordDraw returns.
  • ShaderResources.cpp, Texture.cpp, tests/Graphics.cpp and tests/Recorder.cpp are too large for the review folder. For these, I read only the changed hunks in diff.patch plus the reader snippets above. The rest of those files was not read.
  • Windows: the census skips there, and the Windows build of the InlineList and HostAllocator changes was not checked.
  • Checked: Recorder::open is assigned only in ensureOpen (Recorder.cpp:2244), so the retention epoch is at least 1 before any slot is read.

Sources

To get this to a good state

Nothing is required.

Optional:

  • Name the reviewed head in the description, and say which head each measurement came from.
  • Gate timed in DrawPipeline.cpp on the same switch as the draw profile, or say in the description that the committer statistics are environment-only.

On a new head I would re-check the DrawPipeline.cpp gate and the BorrowedDraw lifetimes first.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5945160626 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16753#pullrequestreview-5945160626). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T19:28:02Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran Head `eb92a8c70d9444798109552922d4c49f65ecceda`, base `main`. No merged-preview check. No build and no test run: this was a read-only review through the reader and the review folder. ``` repo_read.py search "storeNow" core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp repo_read.py search "struct PassAccess" core/libs/prx/libSceAgcDriver/Graphics repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/include/PassHazards.hpp 15 40 repo_read.py search "TouchCachedPipeline" core/libs/prx/libSceAgcDriver/Graphics repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp 1478 1500 repo_read.py search "open = " core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp repo_read.py search "spent" core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp repo_read.py search "commitNs" core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp repo_read.py search "passImages" core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp 1362 1400 repo_read.py search "CountEmptyIndirectDraw" core/libs/prx/libSceAgcDriver/Graphics repo_read.py search "rewatchCompared" core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp ``` ## Results | Check | Result | Note | |---|---|---| | Build | not run | read-only review | | Tests in the description | not run | author-reported only | | Changed hunks | passed | 30 of 30 reviewed files, from `diff.patch` | | Reader spot checks | passed | 12 read-only calls | ## Findings ### Blocking None. ### Non-blocking 1. `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp:478` — the committer's clock gate reads only two environment variables (`APS5_PROFILE_DRAW`, `APS5_PIPELINE_STATS`). The description says the reads are skipped unless profiling is on, "`APS5_PROFILE_DRAW` or the build profile". I found no build-profile switch in this gate. If one exists, a build-profile run gets `spent == 0` at `DrawPipeline.cpp:508`, and `commitNs` then reads zero for the per-commit figure. Either add the same switch or narrow the description. ## Not verified - The ctest entries, the CMake macro `agc_add_draw_pipeline_test` that creates the `_draw_pipeline` and `_plan_verify` variants, and the `ENVIRONMENT_MODIFICATION` edits were not checked against CMake. - The performance numbers, the census limits and the replay table were not reproduced. They cite heads `656c08e951` and `b7f0ab6e98`, not the reviewed head `eb92a8c70d`. - `BorrowedDraw` in `DrawWithRecipe` and `recordPreparedDraw` now holds references to the caller's `resources`, `pipeline` and `framebuffer` instead of moving them. I did not read the code after `recordDraw` in `DrawWithRecipe` to confirm that nothing depends on those locals being empty afterwards. - `recordDraw` gives `PassAccess` a span into `ShaderRecompiler::ThreadOwned` storage for `passImages`. `PassAccess` is a struct of spans (`PassHazards.hpp:19-27`). I did not read `LeaveRenderPassOpen` to confirm it does not keep those spans after `recordDraw` returns. - `ShaderResources.cpp`, `Texture.cpp`, `tests/Graphics.cpp` and `tests/Recorder.cpp` are too large for the review folder. For these, I read only the changed hunks in `diff.patch` plus the reader snippets above. The rest of those files was not read. - Windows: the census skips there, and the Windows build of the `InlineList` and `HostAllocator` changes was not checked. - Checked: `Recorder::open` is assigned only in `ensureOpen` (`Recorder.cpp:2244`), so the retention epoch is at least 1 before any slot is read. ## Sources - The non-blocking point, pinned to the reviewed head: https://github.com/boykopovar/AnyPS5/blob/eb92a8c70d9444798109552922d4c49f65ecceda/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp#L478-L508 ## To get this to a good state Nothing is required. Optional: - Name the reviewed head in the description, and say which head each measurement came from. - Gate `timed` in `DrawPipeline.cpp` on the same switch as the draw profile, or say in the description that the committer statistics are environment-only. On a new head I would re-check the `DrawPipeline.cpp` gate and the `BorrowedDraw` lifetimes first.
MarcZX10 commented 2026-11-19 18:07:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T18:07:09Z.

Review: COMMENTED


Reviewed — no blocking findings

The reviewed changes at a8494f2612f643a031c9838550b7f4876417be0b show no verified blocking defect in the inspected code; review coverage is incomplete, so approval is not justified.

What I ran

No commands were run; repository source was inspected through repo_read.py at the pinned head. I read description.md, commits.md, manifest.json, and the first 900 lines of diff.patch. The prepared files.json was not available through the reader interface.

Results

Check Result Note
Source review not run Partial targeted inspection only
Tests not run No tests executed
Review coverage not run Several changed files remain unread

Findings

Blocking

None verified in the inspected code.

Non-blocking

No findings from the inspected code.

Not verified

I did not read the complete diff, all changed source files, or all tests. In particular, full contents of ShaderResources.cpp, Texture.cpp, Graphics.cpp, and Recorder.cpp were not reviewed. I also did not verify test results reported in the PR description or run checks locally. The manifest shows 27 changed files; only selected sections of the diff and source were inspected, so behavior outside those sections is not verified.

To get this to a good state

Nothing is required. The optional next step is to complete review of the remaining changed files and diff sections before making a formal approval decision.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5980623406 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16753#pullrequestreview-5980623406). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-19T18:07:09Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The reviewed changes at `a8494f2612f643a031c9838550b7f4876417be0b` show no verified blocking defect in the inspected code; review coverage is incomplete, so approval is not justified. ## What I ran No commands were run; repository source was inspected through `repo_read.py` at the pinned head. I read `description.md`, `commits.md`, `manifest.json`, and the first 900 lines of `diff.patch`. The prepared `files.json` was not available through the reader interface. ## Results | Check | Result | Note | |---|---|---| | Source review | not run | Partial targeted inspection only | | Tests | not run | No tests executed | | Review coverage | not run | Several changed files remain unread | ## Findings ### Blocking None verified in the inspected code. ### Non-blocking No findings from the inspected code. ## Not verified I did not read the complete diff, all changed source files, or all tests. In particular, full contents of `ShaderResources.cpp`, `Texture.cpp`, `Graphics.cpp`, and `Recorder.cpp` were not reviewed. I also did not verify test results reported in the PR description or run checks locally. The manifest shows 27 changed files; only selected sections of the diff and source were inspected, so behavior outside those sections is not verified. ## To get this to a good state Nothing is required. The optional next step is to complete review of the remaining changed files and diff sections before making a formal approval decision.
MarcZX10 commented 2026-11-19 18:18:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T18:18:35Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the available source and test evidence supports merging, though some changed files were not fully inspected.

What I ran

Reviewed head ba3289b7dccfdf1e14f427d4cd257933b8e404dc using the prepared bundle and pinned reader. No tests or build commands were run.

Results

Check Result Note
Diff and targeted source review passed Key retention, owner lookup, and inline-list paths inspected
Build and tests not run Author-reported CI and measurements were not independently run
Full file coverage not run Several changed files were not read in full

Findings

Blocking

None identified in the code inspected.

Non-blocking

None.

Not verified

The review bundle listed 27 changed repository files. I read DrawPipeline.hpp, Driver.hpp, Dispatch.cpp, DispatchAhead.cpp, Draw.cpp, DrawPipeline.cpp, ShaderRegistry.cpp, InlineList.hpp, Pipeline.hpp, Recorder.hpp, ShaderResources.hpp, Graphics/src/Draw.cpp, Graphics/src/Pipeline.cpp, Graphics/src/Recorder.cpp, targeted changed ranges of Graphics/src/ShaderResources.cpp and Graphics/src/Texture.cpp, DrawPipelineProfile.cpp, targeted changed ranges of tests/Graphics.cpp and tests/Recorder.cpp, HostAllocator.cpp, RecorderKeptBytes.cpp, agc_driver_draw_allocations_tests.cmake, agc_driver_graphics_tests.cmake, agc_driver_host_allocator_tests.cmake, agc_driver_pipeline_profile_tests.cmake, agc_driver_recorder_tests.cmake, tests/execution/DrawAllocations.cpp, tests/execution/TableIndexValidation.cpp, and docs/dev/ENVIRONMENT.md. Graphics/src/ShaderResources.cpp and Graphics/src/Texture.cpp were read only around changed hunks; tests/Graphics.cpp and tests/Recorder.cpp were checked only for their changed hunks via the diff and not read in full. No other changed files were excluded by the bundle. Behavior outside the inspected ranges, compilation, and test results at this exact head were not independently verified. The description reports successful focused tests and CI, but those are author-reported results.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5980781203 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16753#pullrequestreview-5980781203). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-19T18:18:35Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the available source and test evidence supports merging, though some changed files were not fully inspected. ## What I ran Reviewed head `ba3289b7dccfdf1e14f427d4cd257933b8e404dc` using the prepared bundle and pinned reader. No tests or build commands were run. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | Key retention, owner lookup, and inline-list paths inspected | | Build and tests | not run | Author-reported CI and measurements were not independently run | | Full file coverage | not run | Several changed files were not read in full | ## Findings ### Blocking None identified in the code inspected. ### Non-blocking None. ## Not verified The review bundle listed 27 changed repository files. I read `DrawPipeline.hpp`, `Driver.hpp`, `Dispatch.cpp`, `DispatchAhead.cpp`, `Draw.cpp`, `DrawPipeline.cpp`, `ShaderRegistry.cpp`, `InlineList.hpp`, `Pipeline.hpp`, `Recorder.hpp`, `ShaderResources.hpp`, `Graphics/src/Draw.cpp`, `Graphics/src/Pipeline.cpp`, `Graphics/src/Recorder.cpp`, targeted changed ranges of `Graphics/src/ShaderResources.cpp` and `Graphics/src/Texture.cpp`, `DrawPipelineProfile.cpp`, targeted changed ranges of `tests/Graphics.cpp` and `tests/Recorder.cpp`, `HostAllocator.cpp`, `RecorderKeptBytes.cpp`, `agc_driver_draw_allocations_tests.cmake`, `agc_driver_graphics_tests.cmake`, `agc_driver_host_allocator_tests.cmake`, `agc_driver_pipeline_profile_tests.cmake`, `agc_driver_recorder_tests.cmake`, `tests/execution/DrawAllocations.cpp`, `tests/execution/TableIndexValidation.cpp`, and `docs/dev/ENVIRONMENT.md`. `Graphics/src/ShaderResources.cpp` and `Graphics/src/Texture.cpp` were read only around changed hunks; `tests/Graphics.cpp` and `tests/Recorder.cpp` were checked only for their changed hunks via the diff and not read in full. No other changed files were excluded by the bundle. Behavior outside the inspected ranges, compilation, and test results at this exact head were not independently verified. The description reports successful focused tests and CI, but those are author-reported results. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-21 03:09:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T03:09:32Z.

Review: COMMENTED


Reviewed — comments

Nothing blocks this review, but the measurement and source review are incomplete, so a formal approval is not justified.

What I ran

Reviewed head f0af97547b8b17791aae289513c1a880bc98298c. I read the prepared description, commit list, diff, manifest, and all added lines in 24 of the 29 changed files marked included. I also read targeted source ranges in the two excluded implementation files, ShaderResources.cpp and Texture.cpp, and several changed implementation files through the pinned reader. No tests or builds were run; CI and measurements in the description are author-reported.

Results

Check Result Note
Prepared change bundle passed Description, commits, diff, manifest read
Targeted source review passed Includes the two excluded implementation files
Tests and build not run No local checks performed
Full changed-file review not run Five included changed files remain unread in full

Findings

Blocking

None identified in the code inspected.

Non-blocking

  • The review bundle includes 29 changed files, but only 24 files were marked included, and I did not read all added lines in those files. The five changes not fully reviewed are Graphics.cpp, Recorder.cpp (tests), DrawAllocations.cpp, TableIndexValidation.cpp, and docs/dev/ENVIRONMENT.md. Completing those reads would make the review evidence stronger.
  • The draw allocation census and retention changes have detailed author-reported tests, but those checks were not independently run in this review.

Not verified

  • I did not run tests, builds, or a negative control. The test results and performance measurements in the PR description are author-reported.
  • I did not read all added lines in the five included files listed above. The diff also contains excluded generated, minified, lockfile, or other rule-excluded content as described by the bundle; these were not reviewed.
  • I did not verify behavior on Windows, a physical console, or hardware beyond the author-reported runs.

To get this to a good state

Nothing is required. Optional: complete the five remaining changed-file reads and run the focused tests on this head before seeking formal approval.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6002470007 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16753#pullrequestreview-6002470007). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T03:09:32Z. **Review:** COMMENTED --- # Reviewed — comments Nothing blocks this review, but the measurement and source review are incomplete, so a formal approval is not justified. ## What I ran Reviewed head `f0af97547b8b17791aae289513c1a880bc98298c`. I read the prepared description, commit list, diff, manifest, and all added lines in 24 of the 29 changed files marked included. I also read targeted source ranges in the two excluded implementation files, `ShaderResources.cpp` and `Texture.cpp`, and several changed implementation files through the pinned reader. No tests or builds were run; CI and measurements in the description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Prepared change bundle | passed | Description, commits, diff, manifest read | | Targeted source review | passed | Includes the two excluded implementation files | | Tests and build | not run | No local checks performed | | Full changed-file review | not run | Five included changed files remain unread in full | ## Findings ### Blocking None identified in the code inspected. ### Non-blocking - The review bundle includes 29 changed files, but only 24 files were marked included, and I did not read all added lines in those files. The five changes not fully reviewed are `Graphics.cpp`, `Recorder.cpp` (tests), `DrawAllocations.cpp`, `TableIndexValidation.cpp`, and `docs/dev/ENVIRONMENT.md`. Completing those reads would make the review evidence stronger. - The draw allocation census and retention changes have detailed author-reported tests, but those checks were not independently run in this review. ## Not verified - I did not run tests, builds, or a negative control. The test results and performance measurements in the PR description are author-reported. - I did not read all added lines in the five included files listed above. The diff also contains excluded generated, minified, lockfile, or other rule-excluded content as described by the bundle; these were not reviewed. - I did not verify behavior on Windows, a physical console, or hardware beyond the author-reported runs. ## To get this to a good state Nothing is required. Optional: complete the five remaining changed-file reads and run the focused tests on this head before seeking formal approval.
MarcZX10 commented 2026-11-21 13:00:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T13:00:08Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this; the points below are optional.

What I ran

Reviewed head 4e46571a866081eff3ddd7b93677c7144a783421 from the prepared diff and pinned repository reader. I did not run commands or tests; the test runs described in the PR are author-reported.

Results

Check Result Note
Prepared diff review passed Changed hunks inspected
Targeted source review passed Ownership and allocation paths checked
Tests in this review not run PR reports focused CI and local runs

Negative control

Not run by me. The PR reports allocation mutants and rebinding checks; those reports were not independently verified here.

Findings

Blocking

None.

Non-blocking

None.

Sources

Behavior claims were checked against the prepared diff and source files at the pinned head; no permalink was generated by the available reader.

Not verified

Full text and hunks for Graphics/src/ShaderResources.cpp, Graphics/src/Texture.cpp, tests/Graphics.cpp, and tests/Recorder.cpp were inspected only at relevant changed ranges through the reader; other portions were not read. The prepared folder marked those four changed files as excluded from its full-text files. No build, test command, or physical-console behavior was verified.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6005330483 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16753#pullrequestreview-6005330483). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T13:00:08Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this; the points below are optional. ## What I ran Reviewed head `4e46571a866081eff3ddd7b93677c7144a783421` from the prepared diff and pinned repository reader. I did not run commands or tests; the test runs described in the PR are author-reported. ## Results | Check | Result | Note | |---|---|---| | Prepared diff review | passed | Changed hunks inspected | | Targeted source review | passed | Ownership and allocation paths checked | | Tests in this review | not run | PR reports focused CI and local runs | ## Negative control Not run by me. The PR reports allocation mutants and rebinding checks; those reports were not independently verified here. ## Findings ### Blocking None. ### Non-blocking None. ## Sources Behavior claims were checked against the prepared diff and source files at the pinned head; no permalink was generated by the available reader. ## Not verified Full text and hunks for `Graphics/src/ShaderResources.cpp`, `Graphics/src/Texture.cpp`, `tests/Graphics.cpp`, and `tests/Recorder.cpp` were inspected only at relevant changed ranges through the reader; other portions were not read. The prepared folder marked those four changed files as excluded from its full-text files. No build, test command, or physical-console behavior was verified. ## To get this to a good state Nothing is required.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!16753
No description provided.