perf(agc): skip the owned draw input lookup while none is kept #17889

Merged
chitters2004 merged 2 commits from upstream-pr/17889 into main 2026-11-12 19:32:23 +00:00
chitters2004 commented 2026-11-09 20:50:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by chitters2004 on 2026-11-09T20:50:01Z.


What

CopyDrawInput probed the draw snapshot map for an owned entry (#13793) on every call, including when no owned entry is kept, which is every call on a scene whose draw inputs are all write-tracked.

  • Recorder keeps an exact count of kept owned entries: raised in KeepOwnedDrawInput, lowered in eraseDrawSnapshot, the only place an entry leaves the map (invalidation, replacement, eviction).
  • CopyDrawInput probes for an owned entry only while the count is not 0.
  • Arming a new owned copy is not gated, so the first owned entry is still created.
  • 4 files, +23/-2 lines. No behaviour change when an owned entry exists.

Counts (rk4 replay, 7,745 draws per pass, kit tree with #13793): 1.816 CopyDrawInput calls per draw, 0 owned entries kept, so all 14,064 owned lookups per pass are skipped. A local timer build measured the lookup at 0.25 us per call, 0.45 us per draw (two runs, 0.449 and 0.458). No frame-time claim: neither the replay A/B nor the live GTA V pair below resolves it.

Head e95ea79435, base 364ceeba2f. It merges cleanly with main 39a172839a (git merge-tree); eraseDrawSnapshot is still the only place an entry leaves the snapshot map there, so the count stays exact.

Tested

Windows 11 10.0.26320, NVIDIA GeForce RTX 3080 (driver 621.14), ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ctest -V -R '^(agc_owned_draw_inputs|agc_driver_recorder|agc_driver_frame_replay)' (39 tests), main and the change from the same machine, plain and with APS5_DRAW_PIPELINE=1 APS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1.

run result VUID- in ctest log VUID- in subprocess logs was not found but was requested by env var VK_INSTANCE_LAYERS
main, plain 39/39 0 0 0
main, pipeline 39/39 0 0 0
change, plain 39/39 0 0 0
change, pipeline 39/39 0 0 0

Tests (ownedDrawInputTests, Windows; Linux runs the same file with no owned reuse, untested here):

  • the count starts at 0, is 1 after keeping an owned input, stays 1 when the same input is kept again, and is 0 after a CPU store, after a tracked entry replaces it and after eviction;
  • an owned input is armed while the count is 0 (a gate that also gated arming never creates the first entry).

Mutants (one build, OI_MUT=n, each run of agc_owned_draw_inputs):

mutant result
drop the increment killed
drop the decrement killed
decrement for every erased entry, owned or not killed
gate arming as well as the lookup killed
lookup gate always closed killed
lookup gate always open survives: same behaviour, only the lookup cost returns

Rerun on the head e95ea79435: the unmutated run passes, the five killed mutants above and one more (count each keep twice) fail the test, and "lookup gate always open" passes as expected.

rk4 replay A/B (agc_frame_replay, capture of the standing scene, 7,745 draws per pass, --repeat 5 --no-pace, the 3 pipeline variables, A B B A x5, pass 1 discarded, passes 2-5 averaged per run; A = the replay kit tree (local/replay-kit2, base c3112f0c0f, contains #13793), B = A + this commit):

side commit_us_per_draw mean sd range n
A 36.21 4.60 34.2-49.2 10
B 35.29 1.43 33.8-38.9 10

B minus A: -0.91 us/draw, 95% CI +-3.50 (the CI is wider than any expected saving; medians 34.80 and 34.87, so no difference is resolved). pixels_identical 1.000000 and max_channel_diff 0 in all 20 runs, 5 passes each, 0 VUID. A first run of the same A/B on the earlier revision gave +0.53 +-3.76. No claim is made on frame time.

Live GTA V pair (PPSA04263, save play1-first-autosave, 3840x2160, standing window anchored on stood_still, APS5_DRAW_PIPELINE=1 APS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1, APS5_TRACE_SECONDS=235:30, Ryzen 7 5800X, RTX 3080, driver 621.14): A = base 364ceeba2f, B = e95ea79435, both dirty: false, one discarded warm-up per side, then A B B A.

run mean ms/frame p50 p90 p99 GPU busy ms/present
a1 127.15 126.4 131.4 148.1 33.1
b1 130.69 129.9 135.1 153.2 33.8
b2 131.58 130.9 136.2 141.4 33.7
a2 136.58 136.0 141.1 148.4 33.8

B minus A per pair: +3.54 ms and -5.00 ms (mean -0.73). The runs drift about 3 ms per boot in order on both sides and the signs differ, so no frame-time change is resolved; the expected saving (about 0.45 us per draw, about 0.7 ms per frame at about 1,500 draws) is below that spread. CPU bound on both sides. The claim stays the count above. Traces, trace_digest.py summaries, every aps5-summary.jsonl line, performance_compare.py output for both pairs, logs and scripts: https://github.com/chitters2004/AnyPS5/releases/tag/pr-owned-input-t8

aps5-summary.jsonl lines of the traced window, a1 (base) and b1 (change):

{"commit":"364ceeba2f9b","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.26320","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":4225,"ms":30007.225},"presents":236,"frame_ms":{"p50":126.384,"p90":131.383,"p99":148.149,"max":152.468},"gpu_busy_ms_per_present":33.053,"worker_busy_pct":{"queue worker 0x0":95.264},"top_phases_ms_per_frame":{"Driver.Packet":115.027,"Graphics.Draw":96.716,"Driver.Packet.draw":83.671,"Driver.Draw":83.046,"Graphics.Draw.draw_and_resource_release":75.339,"Driver.DrawFinish":73.335,"Driver.Draw.prepare":67.097,"Driver.DrawFinish.draw_enqueued":40.327},"owned_draw_counts":{"OwnedDraw.arm_attempt":708,"OwnedDraw.arm_blocks_requested":708,"OwnedDraw.arm_refused":708,"OwnedDraw.evicted_other":2593},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.683,"events_lost":1112726,"totals_full":false},"draw committer":{"events_full_after_s":11.142,"events_lost":446976,"totals_full":false},"draw finisher":{"events_full_after_s":15.833,"events_lost":234800,"totals_full":false}},"trace":"aps5-trace-364ceeba2f9b-19396.json.gz"}
{"commit":"e95ea7943576","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.26320","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":4211,"ms":30059.111},"presents":230,"frame_ms":{"p50":129.897,"p90":135.110,"p99":153.250,"max":160.335},"gpu_busy_ms_per_present":33.790,"worker_busy_pct":{"queue worker 0x0":93.668},"top_phases_ms_per_frame":{"Driver.Packet":115.785,"Graphics.Draw":99.735,"Driver.Packet.draw":82.748,"Driver.Draw":82.127,"Graphics.Draw.draw_and_resource_release":77.819,"Driver.DrawFinish":72.875,"Driver.Draw.prepare":65.413,"Driver.DrawFinish.draw_enqueued":38.455},"owned_draw_counts":{"OwnedDraw.arm_attempt":690,"OwnedDraw.arm_blocks_requested":690,"OwnedDraw.arm_refused":690,"OwnedDraw.evicted_other":2127},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.719,"events_lost":1122803,"totals_full":false},"draw committer":{"events_full_after_s":11.039,"events_lost":452968,"totals_full":false},"draw finisher":{"events_full_after_s":15.738,"events_lost":237986,"totals_full":false}},"trace":"aps5-trace-e95ea7943576-20180.json.gz"}

Head 44644e0f8f is e95ea79435 merged with main e7c3bfd130 (no conflicts); the results here are from e95ea79435 and are not rerun on the merge.

Gate logs, the A/B runs, the mutant runs and the scripts: https://github.com/chitters2004/AnyPS5/releases/tag/pr-owned-input (pr-owned-input-evidence.tar.gz).

Not tested: Linux, AMD.

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: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 3080, driver 621.14, Windows 11 10.0.26320 (the ctest gate and the rk4 replay); AGC change, no other GPU
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5230961792 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17889). Originally posted by [chitters2004](https://github.com/chitters2004) on 2026-11-09T20:50:01Z. --- ### What `CopyDrawInput` probed the draw snapshot map for an owned entry (#13793) on every call, including when no owned entry is kept, which is every call on a scene whose draw inputs are all write-tracked. - `Recorder` keeps an exact count of kept owned entries: raised in `KeepOwnedDrawInput`, lowered in `eraseDrawSnapshot`, the only place an entry leaves the map (invalidation, replacement, eviction). - `CopyDrawInput` probes for an owned entry only while the count is not 0. - Arming a new owned copy is not gated, so the first owned entry is still created. - 4 files, +23/-2 lines. No behaviour change when an owned entry exists. Counts (rk4 replay, 7,745 draws per pass, kit tree with #13793): 1.816 `CopyDrawInput` calls per draw, 0 owned entries kept, so all 14,064 owned lookups per pass are skipped. A local timer build measured the lookup at 0.25 us per call, 0.45 us per draw (two runs, 0.449 and 0.458). No frame-time claim: neither the replay A/B nor the live GTA V pair below resolves it. Head `e95ea79435`, base `364ceeba2f`. It merges cleanly with `main` `39a172839a` (`git merge-tree`); `eraseDrawSnapshot` is still the only place an entry leaves the snapshot map there, so the count stays exact. ### Tested Windows 11 10.0.26320, NVIDIA GeForce RTX 3080 (driver 621.14), `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ctest -V -R '^(agc_owned_draw_inputs|agc_driver_recorder|agc_driver_frame_replay)'` (39 tests), main and the change from the same machine, plain and with `APS5_DRAW_PIPELINE=1 APS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1`. | run | result | `VUID-` in ctest log | `VUID-` in subprocess logs | `was not found but was requested by env var VK_INSTANCE_LAYERS` | |---|---|---|---|---| | main, plain | 39/39 | 0 | 0 | 0 | | main, pipeline | 39/39 | 0 | 0 | 0 | | change, plain | 39/39 | 0 | 0 | 0 | | change, pipeline | 39/39 | 0 | 0 | 0 | Tests (`ownedDrawInputTests`, Windows; Linux runs the same file with no owned reuse, untested here): - the count starts at 0, is 1 after keeping an owned input, stays 1 when the same input is kept again, and is 0 after a CPU store, after a tracked entry replaces it and after eviction; - an owned input is armed while the count is 0 (a gate that also gated arming never creates the first entry). Mutants (one build, `OI_MUT=n`, each run of `agc_owned_draw_inputs`): | mutant | result | |---|---| | drop the increment | killed | | drop the decrement | killed | | decrement for every erased entry, owned or not | killed | | gate arming as well as the lookup | killed | | lookup gate always closed | killed | | lookup gate always open | survives: same behaviour, only the lookup cost returns | Rerun on the head `e95ea79435`: the unmutated run passes, the five killed mutants above and one more (count each keep twice) fail the test, and "lookup gate always open" passes as expected. rk4 replay A/B (`agc_frame_replay`, capture of the standing scene, 7,745 draws per pass, `--repeat 5 --no-pace`, the 3 pipeline variables, A B B A x5, pass 1 discarded, passes 2-5 averaged per run; A = the replay kit tree (local/replay-kit2, base `c3112f0c0f`, contains #13793), B = A + this commit): | side | `commit_us_per_draw` mean | sd | range | n | |---|---|---|---|---| | A | 36.21 | 4.60 | 34.2-49.2 | 10 | | B | 35.29 | 1.43 | 33.8-38.9 | 10 | B minus A: -0.91 us/draw, 95% CI +-3.50 (the CI is wider than any expected saving; medians 34.80 and 34.87, so no difference is resolved). `pixels_identical` 1.000000 and `max_channel_diff` 0 in all 20 runs, 5 passes each, 0 VUID. A first run of the same A/B on the earlier revision gave +0.53 +-3.76. No claim is made on frame time. Live GTA V pair (PPSA04263, save `play1-first-autosave`, 3840x2160, standing window anchored on `stood_still`, `APS5_DRAW_PIPELINE=1 APS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1`, `APS5_TRACE_SECONDS=235:30`, Ryzen 7 5800X, RTX 3080, driver 621.14): A = base `364ceeba2f`, B = `e95ea79435`, both `dirty: false`, one discarded warm-up per side, then A B B A. | run | mean ms/frame | p50 | p90 | p99 | GPU busy ms/present | |---|---|---|---|---|---| | a1 | 127.15 | 126.4 | 131.4 | 148.1 | 33.1 | | b1 | 130.69 | 129.9 | 135.1 | 153.2 | 33.8 | | b2 | 131.58 | 130.9 | 136.2 | 141.4 | 33.7 | | a2 | 136.58 | 136.0 | 141.1 | 148.4 | 33.8 | B minus A per pair: +3.54 ms and -5.00 ms (mean -0.73). The runs drift about 3 ms per boot in order on both sides and the signs differ, so no frame-time change is resolved; the expected saving (about 0.45 us per draw, about 0.7 ms per frame at about 1,500 draws) is below that spread. CPU bound on both sides. The claim stays the count above. Traces, `trace_digest.py` summaries, every `aps5-summary.jsonl` line, `performance_compare.py` output for both pairs, logs and scripts: https://github.com/chitters2004/AnyPS5/releases/tag/pr-owned-input-t8 `aps5-summary.jsonl` lines of the traced window, a1 (base) and b1 (change): ```json {"commit":"364ceeba2f9b","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.26320","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":4225,"ms":30007.225},"presents":236,"frame_ms":{"p50":126.384,"p90":131.383,"p99":148.149,"max":152.468},"gpu_busy_ms_per_present":33.053,"worker_busy_pct":{"queue worker 0x0":95.264},"top_phases_ms_per_frame":{"Driver.Packet":115.027,"Graphics.Draw":96.716,"Driver.Packet.draw":83.671,"Driver.Draw":83.046,"Graphics.Draw.draw_and_resource_release":75.339,"Driver.DrawFinish":73.335,"Driver.Draw.prepare":67.097,"Driver.DrawFinish.draw_enqueued":40.327},"owned_draw_counts":{"OwnedDraw.arm_attempt":708,"OwnedDraw.arm_blocks_requested":708,"OwnedDraw.arm_refused":708,"OwnedDraw.evicted_other":2593},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.683,"events_lost":1112726,"totals_full":false},"draw committer":{"events_full_after_s":11.142,"events_lost":446976,"totals_full":false},"draw finisher":{"events_full_after_s":15.833,"events_lost":234800,"totals_full":false}},"trace":"aps5-trace-364ceeba2f9b-19396.json.gz"} {"commit":"e95ea7943576","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.26320","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":4211,"ms":30059.111},"presents":230,"frame_ms":{"p50":129.897,"p90":135.110,"p99":153.250,"max":160.335},"gpu_busy_ms_per_present":33.790,"worker_busy_pct":{"queue worker 0x0":93.668},"top_phases_ms_per_frame":{"Driver.Packet":115.785,"Graphics.Draw":99.735,"Driver.Packet.draw":82.748,"Driver.Draw":82.127,"Graphics.Draw.draw_and_resource_release":77.819,"Driver.DrawFinish":72.875,"Driver.Draw.prepare":65.413,"Driver.DrawFinish.draw_enqueued":38.455},"owned_draw_counts":{"OwnedDraw.arm_attempt":690,"OwnedDraw.arm_blocks_requested":690,"OwnedDraw.arm_refused":690,"OwnedDraw.evicted_other":2127},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.719,"events_lost":1122803,"totals_full":false},"draw committer":{"events_full_after_s":11.039,"events_lost":452968,"totals_full":false},"draw finisher":{"events_full_after_s":15.738,"events_lost":237986,"totals_full":false}},"trace":"aps5-trace-e95ea7943576-20180.json.gz"} ``` Head `44644e0f8f` is `e95ea79435` merged with `main` `e7c3bfd130` (no conflicts); the results here are from `e95ea79435` and are not rerun on the merge. Gate logs, the A/B runs, the mutant runs and the scripts: https://github.com/chitters2004/AnyPS5/releases/tag/pr-owned-input (`pr-owned-input-evidence.tar.gz`). Not tested: Linux, AMD. ### Checklist - [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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 3080, driver 621.14, Windows 11 10.0.26320 (the `ctest` gate and the rk4 replay); AGC change, no other GPU - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
milescoviello commented 2026-11-09 21:30:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-11-09T21:30:13Z.

Review: APPROVED


Read at e95ea79435. The count stays exact, as far as I can see:

  • No other removal. eraseDrawSnapshot (Recorder.cpp:3270) is the only drawSnapshots.erase in the file at this head, and there is no clear or reassignment of the map. So the decrement covers invalidation, replacement and eviction.
  • Replacing an owned entry nets to zero. It goes through eraseDrawSnapshot (decrement) before KeepOwnedDrawInput's increment. The new "kept twice" check pins that.
  • Same lock for reads and writes. The map is only touched with the GPU lock held (ReusableOwnedDrawInput asserts it on entry), and CopyDrawInput reads the count right before calling it. So the plain std::size_t is read and written under the same lock and needs no atomic.
  • The first owned copy is still armed. The count only gates the lookup, not ArmOwnedDrawInput.

One note on the validation table: in AnyPS5's test programs the "was not found but was requested" line doesn't appear even when the layer is missing, because nothing registers a debug messenger. So that column can't show the layer ran. With VK_LOADER_DEBUG=layer the loader prints Insert instance layer "VK_LAYER_KHRONOS_validation" when it does (measurement in #17896).

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5833072534 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17889#pullrequestreview-5833072534). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-11-09T21:30:13Z. **Review:** APPROVED --- Read at `e95ea79435`. The count stays exact, as far as I can see: - **No other removal.** `eraseDrawSnapshot` (`Recorder.cpp:3270`) is the only `drawSnapshots.erase` in the file at this head, and there is no `clear` or reassignment of the map. So the decrement covers invalidation, replacement and eviction. - **Replacing an owned entry nets to zero.** It goes through `eraseDrawSnapshot` (decrement) before `KeepOwnedDrawInput`'s increment. The new "kept twice" check pins that. - **Same lock for reads and writes.** The map is only touched with the GPU lock held (`ReusableOwnedDrawInput` asserts it on entry), and `CopyDrawInput` reads the count right before calling it. So the plain `std::size_t` is read and written under the same lock and needs no atomic. - **The first owned copy is still armed.** The count only gates the lookup, not `ArmOwnedDrawInput`. One note on the validation table: in AnyPS5's test programs the "was not found but was requested" line doesn't appear even when the layer is missing, because nothing registers a debug messenger. So that column can't show the layer ran. With `VK_LOADER_DEBUG=layer` the loader prints `Insert instance layer "VK_LAYER_KHRONOS_validation"` when it does (measurement in #17896). AI-assisted: yes (Claude Code)
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!17889
No description provided.