refactor(agc): split prepareDraw's read-only plan from its record-time work #14051

Merged
vingelvatten merged 1 commit from upstream-pr/14051 into main 2026-11-07 22:49:48 +00:00
vingelvatten commented 2026-10-31 17:06:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by vingelvatten on 2026-10-31T17:06:15Z.


What

Step 2 of the draw-side series in #7895 (the outline of 21 October, endorsed by @oneandonlydean): make the read-only part of prepareDraw explicit and movable, still on the committer and still in the same order relative to every record-time effect.

Piece Function What it holds or does
plan planDraw → DrawPlan the draw's validation and its nothing-to-draw early outs, the fragment outputs and pipeline stages (CachedFragmentOutputs, PipelineStages), the mesh group count and limits, the tessellation patch check, the viewport, depth-bounds and sample-mask checks, the vertex input layout, and the resource-cache key (DrawResourceKey). It reads the state, the draw parameters and the compiled stages only: no guest memory, no recorder, no registry, nothing another draw left behind. It does touch three memoizations, each synchronized and order-insensitive: CachedFragmentOutputs (its own mutex, the memo of validated outputs), VertexInputCache::TryGet (its own mutex; a lookup can move an LRU entry, insert, evict or set a bypass bit) and the resource-key memo DrawResourceKey publishes on the program (atomic, idempotent). A plan built on any thread, in any order, gets the same values from them; what they change is cache state, never the plan's output.
inputs prepareDrawInputs what must stay at record time: the index range and multisample-target checks, the occlusion-sampling check, the index and vertex captures (in-place binds, copies, snapshot keeps, restart compaction), the vertex fetch plan (it needs the highest index of the captured bytes) and the copies. It starts from the plan's fields, so DrawInputs and everything downstream (recordDraw, recordDrawCommands, the recipe path) are unchanged.
resources resolveDrawResources as before, with the key taken from the plan instead of built in place; cacheable is still decided here because it needs recordable, which needs the resident targets.

prepareDraw builds the plan right after the timer starts (after BoundKeptBytes, as #8992 arranged) and then runs the same sequence as today. DrawWithRecipe builds the plan from the recipe's fragment outputs, stages and vertex layout as prepareDrawInputs did for it before. drawTessellationGeometry is untouched: each of its two draws gets its own plan through Draw.

What changes in behaviour, deliberately:

  • A draw that fails one of the plan's checks now throws before its index and vertex capture and before the target loop, instead of after some of them. The checks and their messages are the same.
  • The vertex input layout is looked up before the index capture instead of after it, so a draw whose index capture finds nothing to draw still touches the layout cache once.
  • DrawResourceKey is built for every draw whose stages allow a cache key, not only for recordable ones (a synchronous draw used to skip it). The key is idempotent on the program and cheap; cacheable still gates the cache lookup.
  • Phase accounting: validation is still charged to validate, the layout to vertex and the key build to lookup (DrawTimer::charge moves the key's time out of the phase it would otherwise land in), so [draws] and APS5_TRACE_DRAWS keep their meaning.

Debug aid: APS5_VERIFY_DRAW_PLAN=1 (off by default) builds the plan a second time at the end of prepareDraw, after every record-time effect, and requires it to equal the plan the draw used (the content of the layout, the key and the scalar fields; not the memo hit flags, which a second lookup may legitimately change). It is a consistency check that the plan reads nothing the record-time work changes; it is not a thread-safety proof, and it does not cover the three memoizations' internal state (the LRU position or a bypass bit), which the plan's output does not depend on. The draw-pipeline test set gets _plan_verify variants with that switch on top of the pipelined settings.

No speed claim: the plan is a small share of the committer (the validate and pipeline phases together are a few percent at Astro Bot's Crash Site). The point is the seam: step 3 and the preparer thread on feat/agc-draw-prepare-ahead can take planDraw as the work that leaves the committer, and the adopt-time check sits where prepareDrawInputs begins.

Tested

Windows 11 Pro 26300, Ryzen 7 7800X3D, 31 GB; WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. Based on main d60ebec0c2 (6 November; rebased four times as main moved: after #12862 split the test registrations and #13894 changed the mesh group limit, after #14857 moved the Graphics.Draw trace marks into prepareDrawInputs, after #13858 split the resource-cache candidate from the cacheable decision for its address-draw reuse, and after #15705 added drawStagingEnabled beside the resolve step); head 241a32be3a. The validate trace mark sits in prepareDrawInputs after the three checks that stay there, so the slice still covers all of a draw's validation. For #13858 the plan carries candidate (the stages allow a cache key) next to keyed (candidate and not NeverReusable), so resolveDrawResources decides candidate and cacheable from the plan exactly as before. The main arm of every comparison is a build of that same commit from a second worktree, so the two trees differ only by this change.

  • NVIDIA RTX 4070 Ti SUPER (617.42), focused draw tests (agc_driver_.*(draw|stencil|indirect|multisample|msaa|target|pass|pipelined|finisher|recipe|plan_verify)|^agc_driver_graphics) with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: main 187 tests, 100% passed, 4 skipped (agc_driver_msaa_dcc_compared_import_{2,4,8}, agc_driver_stencil_ref_export); branch 209 tests (the same 187 plus the 22 _plan_verify variants), 100% passed, the same 4 skipped. Neither log has was not found but was requested by env var VK_INSTANCE_LAYERS; both hold the same 4 lines of VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 from agc_driver_srgb8_color_target_tests; no new VUID.

  • AMD Radeon Graphics (Ryzen 7 7800X3D iGPU, RDNA2 gfx1036, AMD driver 32.0.21045.16010 / 2.0.353), same set and switches: main 187 tests, 100% passed, 4 skipped (agc_driver_msaa_dcc_compared_import_{2,4,8}, agc_driver_mesh_draw_relocation); branch 209 tests, 100% passed, the same 4 skipped. 0 layer-missing lines; both logs hold the same 6 lines of the sRGB8 blend VUID; no new VUID.

  • lavapipe (llvmpipe, LLVM 21.1.8, Mesa 25.x, WSL Ubuntu 26.04 x86-64), same focused set and switches, ctest -j 4: main 188 tests, 100% passed, 7 skipped; branch 210 tests, 100% passed, the same 7 skipped (agc_driver_msaa_dcc_{srgb_clear,clear,compared_import}_2, agc_driver_linear_target_direct_write_completion, agc_driver_mesh_draw_relocation, agc_driver_recorded_draw_staging, agc_driver_sample_order_recipe_depth_locations). 0 layer-missing lines; both logs hold the same 6 lines of the sRGB8 blend VUID; no new VUID.

  • ASTRO BOT PPSA21567 01.018.000, app.exe -lvl hub_crashsite, no input, warm shader cache, APS5_HOST_IMPORT_MIB=13312 (without it the title aborts about 110 s in on this machine with a pinned guest allocation, see #12157), APS5_PROFILE_DRAW=1 APS5_TRACE_SUMMARY_EVERY=10, guest 3840x2160 in a 2226x1252 window, RTX 4070 Ti SUPER, one title on the GPU. Two run folders that differ only in libs/: main ab6f5d32ed and this head. Three alternated pairs in the order main, branch, branch, main, main, branch, 200 s each, the last eight 10 s windows of each run averaged. The first run (main) is discarded: the new main build has a new shader-cache key, so that run compiled pipelines for its whole 200 s and never left the menus (371 presents per 10 s, 89k commits at 4.5 ms); the five later runs are steady.

    arm runs presents per 10 s [draw] pipelined commits per 10 s µs per commit committer busy room wait per draw
    main ab6f5d32ed 2 (77.1, 75.8) 76.4 244k 32.94 80.4 % 3.9 µs
    this PR e2d277a41b 3 (76.6, 78.0, 77.1) 77.3 245k 32.83 80.5 % 3.8 µs

    Three earlier pair sets on the previous base (main 73f4f7e06e, heads before the rebase) gave 74.4 vs 75.1, 74.0 vs 73.0 and 74.5 vs 74.3 presents per 10 s, so the branch lands on both sides of main: run-to-run noise. The [draws] phase totals per 10 s are the same on both arms for vertex (899 vs 903 ms), lookup (1474 vs 1473 ms), pipeline (135 vs 128 ms) and record (988 vs 974 ms). validate reads 109 ms on main and 135 ms on the branch: the difference is the three extra steady_clock::now() reads per draw that DrawTimer::charge and the second PhaseValidate mark cost under APS5_PROFILE_DRAW (about 0.1 µs at 245k draws per 10 s); without the switch the plan reads no clock at all.

  • python tools/check_conventions.py --base origin/main: all checks passed.

  • python tools/env_reference.py --check: 0 undocumented (the stale APS5_PAD_SPEAKER_FALLBACK_DB row is main's)

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; order with #10678 agreed as described under Overlap (this PR first, #10678 rebases onto planDraw), pending its author's confirmation on #10678
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4070 Ti SUPER, driver 617.42, Windows 11 Pro 26300; AMD Radeon Graphics (RDNA2 gfx1036 iGPU), driver 32.0.21045.16010, Windows 11 Pro 26300; llvmpipe (LLVM 21.1.8), Mesa, Ubuntu 26.04 under WSL2
  • AI-assisted: yes

Overlap

#10678 (perf(agc): build a pipelined draw's resource-cache key before it reaches the committer) adds a contentKey parameter through Draw and resolveDrawResources. With this PR the key lives in DrawPlan. Proposed order, asked of its author on #10678: this PR lands first, because it is a refactor with no behaviour change and it gives the early key a home; #10678 then shrinks to passing the finisher's key into planDraw and taking it when KeyForDevice matches (about ten lines instead of its current plumbing). If #10678 lands first instead, this PR rebases: planDraw takes the given key when KeyForDevice matches and builds it otherwise. johandavidcm's feat/agc-draw-prepare-ahead (not a PR yet) prepares the fragment outputs, stages, vertex layout and set layouts on a preparer thread; with this PR that work is planDraw.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5099717231 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14051). Originally posted by [vingelvatten](https://github.com/vingelvatten) on 2026-10-31T17:06:15Z. --- ### What Step 2 of the draw-side series in #7895 (the outline of 21 October, endorsed by @oneandonlydean): make the read-only part of `prepareDraw` explicit and movable, still on the committer and still in the same order relative to every record-time effect. | Piece | Function | What it holds or does | | --- | --- | --- | | plan | `planDraw` → `DrawPlan` | the draw's validation and its nothing-to-draw early outs, the fragment outputs and pipeline stages (`CachedFragmentOutputs`, `PipelineStages`), the mesh group count and limits, the tessellation patch check, the viewport, depth-bounds and sample-mask checks, the vertex input layout, and the resource-cache key (`DrawResourceKey`). It reads the state, the draw parameters and the compiled stages only: no guest memory, no recorder, no registry, nothing another draw left behind. It does touch three memoizations, each synchronized and order-insensitive: `CachedFragmentOutputs` (its own mutex, the memo of validated outputs), `VertexInputCache::TryGet` (its own mutex; a lookup can move an LRU entry, insert, evict or set a bypass bit) and the resource-key memo `DrawResourceKey` publishes on the program (atomic, idempotent). A plan built on any thread, in any order, gets the same values from them; what they change is cache state, never the plan's output. | | inputs | `prepareDrawInputs` | what must stay at record time: the index range and multisample-target checks, the occlusion-sampling check, the index and vertex captures (in-place binds, copies, snapshot keeps, restart compaction), the vertex fetch plan (it needs the highest index of the captured bytes) and the copies. It starts from the plan's fields, so `DrawInputs` and everything downstream (`recordDraw`, `recordDrawCommands`, the recipe path) are unchanged. | | resources | `resolveDrawResources` | as before, with the key taken from the plan instead of built in place; `cacheable` is still decided here because it needs `recordable`, which needs the resident targets. | `prepareDraw` builds the plan right after the timer starts (after `BoundKeptBytes`, as #8992 arranged) and then runs the same sequence as today. `DrawWithRecipe` builds the plan from the recipe's fragment outputs, stages and vertex layout as `prepareDrawInputs` did for it before. `drawTessellationGeometry` is untouched: each of its two draws gets its own plan through `Draw`. What changes in behaviour, deliberately: - A draw that fails one of the plan's checks now throws before its index and vertex capture and before the target loop, instead of after some of them. The checks and their messages are the same. - The vertex input layout is looked up before the index capture instead of after it, so a draw whose index capture finds nothing to draw still touches the layout cache once. - `DrawResourceKey` is built for every draw whose stages allow a cache key, not only for recordable ones (a synchronous draw used to skip it). The key is idempotent on the program and cheap; `cacheable` still gates the cache lookup. - Phase accounting: validation is still charged to `validate`, the layout to `vertex` and the key build to `lookup` (`DrawTimer::charge` moves the key's time out of the phase it would otherwise land in), so `[draws]` and `APS5_TRACE_DRAWS` keep their meaning. Debug aid: `APS5_VERIFY_DRAW_PLAN=1` (off by default) builds the plan a second time at the end of `prepareDraw`, after every record-time effect, and requires it to equal the plan the draw used (the content of the layout, the key and the scalar fields; not the memo hit flags, which a second lookup may legitimately change). It is a consistency check that the plan reads nothing the record-time work changes; it is not a thread-safety proof, and it does not cover the three memoizations' internal state (the LRU position or a bypass bit), which the plan's output does not depend on. The draw-pipeline test set gets `_plan_verify` variants with that switch on top of the pipelined settings. No speed claim: the plan is a small share of the committer (the `validate` and `pipeline` phases together are a few percent at Astro Bot's Crash Site). The point is the seam: step 3 and the preparer thread on `feat/agc-draw-prepare-ahead` can take `planDraw` as the work that leaves the committer, and the adopt-time check sits where `prepareDrawInputs` begins. ### Tested Windows 11 Pro 26300, Ryzen 7 7800X3D, 31 GB; WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`. Based on `main` d60ebec0c2 (6 November; rebased four times as `main` moved: after #12862 split the test registrations and #13894 changed the mesh group limit, after #14857 moved the `Graphics.Draw` trace marks into `prepareDrawInputs`, after #13858 split the resource-cache candidate from the cacheable decision for its address-draw reuse, and after #15705 added `drawStagingEnabled` beside the resolve step); head 241a32be3a. The `validate` trace mark sits in `prepareDrawInputs` after the three checks that stay there, so the slice still covers all of a draw's validation. For #13858 the plan carries `candidate` (the stages allow a cache key) next to `keyed` (`candidate` and not `NeverReusable`), so `resolveDrawResources` decides `candidate` and `cacheable` from the plan exactly as before. The `main` arm of every comparison is a build of that same commit from a second worktree, so the two trees differ only by this change. - NVIDIA RTX 4070 Ti SUPER (617.42), focused draw tests (`agc_driver_.*(draw|stencil|indirect|multisample|msaa|target|pass|pipelined|finisher|recipe|plan_verify)|^agc_driver_graphics`) with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`: `main` 187 tests, 100% passed, 4 skipped (`agc_driver_msaa_dcc_compared_import_{2,4,8}`, `agc_driver_stencil_ref_export`); branch 209 tests (the same 187 plus the 22 `_plan_verify` variants), 100% passed, the same 4 skipped. Neither log has `was not found but was requested by env var VK_INSTANCE_LAYERS`; both hold the same 4 lines of `VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605` from `agc_driver_srgb8_color_target_tests`; no new VUID. - AMD Radeon Graphics (Ryzen 7 7800X3D iGPU, RDNA2 gfx1036, AMD driver 32.0.21045.16010 / 2.0.353), same set and switches: `main` 187 tests, 100% passed, 4 skipped (`agc_driver_msaa_dcc_compared_import_{2,4,8}`, `agc_driver_mesh_draw_relocation`); branch 209 tests, 100% passed, the same 4 skipped. 0 layer-missing lines; both logs hold the same 6 lines of the sRGB8 blend VUID; no new VUID. - lavapipe (llvmpipe, LLVM 21.1.8, Mesa 25.x, WSL Ubuntu 26.04 x86-64), same focused set and switches, `ctest -j 4`: `main` 188 tests, 100% passed, 7 skipped; branch 210 tests, 100% passed, the same 7 skipped (`agc_driver_msaa_dcc_{srgb_clear,clear,compared_import}_2`, `agc_driver_linear_target_direct_write_completion`, `agc_driver_mesh_draw_relocation`, `agc_driver_recorded_draw_staging`, `agc_driver_sample_order_recipe_depth_locations`). 0 layer-missing lines; both logs hold the same 6 lines of the sRGB8 blend VUID; no new VUID. - ASTRO BOT PPSA21567 01.018.000, `app.exe -lvl hub_crashsite`, no input, warm shader cache, `APS5_HOST_IMPORT_MIB=13312` (without it the title aborts about 110 s in on this machine with a pinned guest allocation, see #12157), `APS5_PROFILE_DRAW=1 APS5_TRACE_SUMMARY_EVERY=10`, guest 3840x2160 in a 2226x1252 window, RTX 4070 Ti SUPER, one title on the GPU. Two run folders that differ only in `libs/`: `main` ab6f5d32ed and this head. Three alternated pairs in the order main, branch, branch, main, main, branch, 200 s each, the last eight 10 s windows of each run averaged. The first run (main) is discarded: the new `main` build has a new shader-cache key, so that run compiled pipelines for its whole 200 s and never left the menus (371 presents per 10 s, 89k commits at 4.5 ms); the five later runs are steady. | arm | runs | presents per 10 s | `[draw] pipelined` commits per 10 s | µs per commit | committer busy | room wait per draw | |---|---|---|---|---|---|---| | `main` ab6f5d32ed | 2 (77.1, 75.8) | 76.4 | 244k | 32.94 | 80.4 % | 3.9 µs | | this PR e2d277a41b | 3 (76.6, 78.0, 77.1) | 77.3 | 245k | 32.83 | 80.5 % | 3.8 µs | Three earlier pair sets on the previous base (`main` 73f4f7e06e, heads before the rebase) gave 74.4 vs 75.1, 74.0 vs 73.0 and 74.5 vs 74.3 presents per 10 s, so the branch lands on both sides of `main`: run-to-run noise. The `[draws]` phase totals per 10 s are the same on both arms for `vertex` (899 vs 903 ms), `lookup` (1474 vs 1473 ms), `pipeline` (135 vs 128 ms) and `record` (988 vs 974 ms). `validate` reads 109 ms on `main` and 135 ms on the branch: the difference is the three extra `steady_clock::now()` reads per draw that `DrawTimer::charge` and the second `PhaseValidate` mark cost under `APS5_PROFILE_DRAW` (about 0.1 µs at 245k draws per 10 s); without the switch the plan reads no clock at all. - `python tools/check_conventions.py --base origin/main`: all checks passed. - `python tools/env_reference.py --check`: 0 undocumented (the stale `APS5_PAD_SPEAKER_FALLBACK_DB` row is `main`'s) ### 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: none; order with #10678 agreed as described under Overlap (this PR first, #10678 rebases onto `planDraw`), pending its author's confirmation on #10678 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 4070 Ti SUPER, driver 617.42, Windows 11 Pro 26300; AMD Radeon Graphics (RDNA2 gfx1036 iGPU), driver 32.0.21045.16010, Windows 11 Pro 26300; llvmpipe (LLVM 21.1.8), Mesa, Ubuntu 26.04 under WSL2 - [x] AI-assisted: yes ### Overlap #10678 (`perf(agc): build a pipelined draw's resource-cache key before it reaches the committer`) adds a `contentKey` parameter through `Draw` and `resolveDrawResources`. With this PR the key lives in `DrawPlan`. Proposed order, asked of its author on #10678: this PR lands first, because it is a refactor with no behaviour change and it gives the early key a home; #10678 then shrinks to passing the finisher's key into `planDraw` and taking it when `KeyForDevice` matches (about ten lines instead of its current plumbing). If #10678 lands first instead, this PR rebases: `planDraw` takes the given key when `KeyForDevice` matches and builds it otherwise. johandavidcm's `feat/agc-draw-prepare-ahead` (not a PR yet) prepares the fragment outputs, stages, vertex layout and set layouts on a preparer thread; with this PR that work is `planDraw`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-31 17:32:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T17:32:23Z.

Review: DISMISSED


Reviewed — changes requested

The checklist leaves this PR's overlap with open #10678 at Depends on: none, and neither PR's discussion records an agreed landing order.

What I ran

Reviewed head aa0880e4ebc0b1a705118028eb68fa93d69fd7a8. GitHub reports base 474030e58424fefdb65e5df9f3820810fbb4553c; I also checked the merge preview against the newer live main tip 0f302813cebfc09e3e0b6f8fced15262d186879e, which merged cleanly. Environment: Debian 12, Linux 6.1, Python 3.11.2, GCC 12.2.0. No local build or C++ tests were run.

python3 tools/pr_precheck.py --base upstream/main --head aa0880e4ebc0b1a705118028eb68fa93d69fd7a8 --title "refactor(agc): split prepareDraw's read-only plan from its record-time work" --body-file /tmp/anyps5-14051-review-current/pr-body.md --output-dir /tmp/anyps5-14051-review-final --no-negative-controls
git merge-tree --write-tree upstream/main aa0880e4ebc0b1a705118028eb68fa93d69fd7a8
gh run view 41222879876 -R boykopovar/AnyPS5 --job 124600944041 --log
grep -c 'plan_verify.*\*\*\*Skipped' /tmp/ci-14051-windows.log

Results

Check Result
Diff whitespace (git diff --check) Passed against live main 0f302813cebfc09e3e0b6f8fced15262d186879e
Repository conventions and PR template Passed against live main
Merge preview Clean against live main; preview tree 4678f46d088f119e2d4da4131c8f24e070d70972
Hosted Windows build and CTest Passed: 0 failed of 2,545 listed; all 22 new _plan_verify variants were skipped
Precheck's optional ABI/test-quality helpers Unavailable in the extracted PR tree; no exports or Python tests changed, so these do not indicate a PR defect
Unedited check output
All conventions checks passed.

4678f46d088f119e2d4da4131c8f24e070d70972
windows	Build and run changed guest core/libs tests	2026-10-31T17:16:14.2462242Z 100% tests passed, 0 tests failed out of 2545
22
/usr/bin/python3: can't open file '/tmp/anyps5-14051-review-latest-main/head-aa0880e4ebc0-37cc6df8/tools/pr_abi_audit.py': [Errno 2] No such file or directory
/usr/bin/python3: can't open file '/tmp/anyps5-14051-review-latest-main/head-aa0880e4ebc0-37cc6df8/tools/pr_test_quality.py': [Errno 2] No such file or directory

Findings

Blocking

  • Coordinate the shared implementation order with #10678. This PR moves the DrawResourceKey construction into planDraw and passes it through resolveDrawResources; #10678 changes that same resource-resolution path to accept a finisher-built contentKey. The PR body itself says whichever lands second must rebase, but its checklist says Depends on: none, and I found no agreement with #10678's author in either PR's discussion. The repository requires authors of overlapping PRs to agree which lands first and declare the dependency. Please agree on the order, then update the later PR's Depends on entry accordingly.

Non-blocking

  • Clarify the “read-only plan” contract. planDraw calls VertexInputCache::TryGet. That call can move an LRU entry, insert or evict cache entries, or set a bypass bit; the cache mutex protects those updates, so this is not by itself evidence of a data race. However, the description says the plan uses “no shared cache,” and the repeat-plan verifier compares plan outputs without checking those cache mutations. Please describe this synchronized cache interaction in the plan contract and verifier rationale, or move the cache operation outside the read-only stage if that property is required for the preparer boundary.

Sources

Not verified

  • The hosted Windows job skipped the 22 new _plan_verify variants; Linux and specialized hosted jobs were skipped. I did not reproduce the author-reported RTX 4070 Ti SUPER, RDNA2 iGPU, or lavapipe runs.
  • No local C++ build, CTest, console run, or preparer-thread execution was performed.

To get this to a good state

Please agree with the #10678 author on landing order and update the dependency checklist on the later PR. Please also clarify the cache interaction in the plan contract. I will rerun the same checks on the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5724067658 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14051#pullrequestreview-5724067658). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T17:32:23Z. **Review:** DISMISSED --- # Reviewed — changes requested The checklist leaves this PR's overlap with open #10678 at `Depends on: none`, and neither PR's discussion records an agreed landing order. ## What I ran Reviewed head `aa0880e4ebc0b1a705118028eb68fa93d69fd7a8`. GitHub reports base `474030e58424fefdb65e5df9f3820810fbb4553c`; I also checked the merge preview against the newer live `main` tip `0f302813cebfc09e3e0b6f8fced15262d186879e`, which merged cleanly. Environment: Debian 12, Linux 6.1, Python 3.11.2, GCC 12.2.0. No local build or C++ tests were run. ```sh python3 tools/pr_precheck.py --base upstream/main --head aa0880e4ebc0b1a705118028eb68fa93d69fd7a8 --title "refactor(agc): split prepareDraw's read-only plan from its record-time work" --body-file /tmp/anyps5-14051-review-current/pr-body.md --output-dir /tmp/anyps5-14051-review-final --no-negative-controls git merge-tree --write-tree upstream/main aa0880e4ebc0b1a705118028eb68fa93d69fd7a8 gh run view 41222879876 -R boykopovar/AnyPS5 --job 124600944041 --log grep -c 'plan_verify.*\*\*\*Skipped' /tmp/ci-14051-windows.log ``` ## Results | Check | Result | |---|---| | Diff whitespace (`git diff --check`) | Passed against live `main` `0f302813cebfc09e3e0b6f8fced15262d186879e` | | Repository conventions and PR template | Passed against live `main` | | Merge preview | Clean against live `main`; preview tree `4678f46d088f119e2d4da4131c8f24e070d70972` | | Hosted Windows build and CTest | Passed: 0 failed of 2,545 listed; all 22 new `_plan_verify` variants were skipped | | Precheck's optional ABI/test-quality helpers | Unavailable in the extracted PR tree; no exports or Python tests changed, so these do not indicate a PR defect | <details><summary>Unedited check output</summary> ```text All conventions checks passed. 4678f46d088f119e2d4da4131c8f24e070d70972 windows Build and run changed guest core/libs tests 2026-10-31T17:16:14.2462242Z 100% tests passed, 0 tests failed out of 2545 22 /usr/bin/python3: can't open file '/tmp/anyps5-14051-review-latest-main/head-aa0880e4ebc0-37cc6df8/tools/pr_abi_audit.py': [Errno 2] No such file or directory /usr/bin/python3: can't open file '/tmp/anyps5-14051-review-latest-main/head-aa0880e4ebc0-37cc6df8/tools/pr_test_quality.py': [Errno 2] No such file or directory ``` </details> ## Findings ### Blocking - **Coordinate the shared implementation order with #10678.** This PR moves the `DrawResourceKey` construction into `planDraw` and passes it through `resolveDrawResources`; #10678 changes that same resource-resolution path to accept a finisher-built `contentKey`. The PR body itself says whichever lands second must rebase, but its checklist says `Depends on: none`, and I found no agreement with #10678's author in either PR's discussion. The repository requires authors of overlapping PRs to agree which lands first and declare the dependency. Please agree on the order, then update the later PR's `Depends on` entry accordingly. ### Non-blocking - **Clarify the “read-only plan” contract.** `planDraw` calls `VertexInputCache::TryGet`. That call can move an LRU entry, insert or evict cache entries, or set a bypass bit; the cache mutex protects those updates, so this is not by itself evidence of a data race. However, the description says the plan uses “no shared cache,” and the repeat-plan verifier compares plan outputs without checking those cache mutations. Please describe this synchronized cache interaction in the plan contract and verifier rationale, or move the cache operation outside the read-only stage if that property is required for the preparer boundary. ## Sources - [Contribution rule for overlapping PRs, pinned to `0f30281`](https://github.com/boykopovar/AnyPS5/blob/0f302813cebfc09e3e0b6f8fced15262d186879e/CONTRIBUTING.md#L69) - [`planDraw` cache lookup, pinned to this head](https://github.com/boykopovar/AnyPS5/blob/aa0880e4ebc0b1a705118028eb68fa93d69fd7a8/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp#L1474-L1555) - [`VertexInputCache::TryGet` and mutating `get`, pinned to live `main`](https://github.com/boykopovar/AnyPS5/blob/0f302813cebfc09e3e0b6f8fced15262d186879e/core/libs/prx/libSceAgcDriver/Graphics/include/VertexInput.hpp#L182-L222) - [#10678 resource-key handoff at its current head](https://github.com/boykopovar/AnyPS5/blob/bdd24973c9a3e65ca0037f6e9cdc0da45c0945a4/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp#L1739-L1762) ## Not verified - The hosted Windows job skipped the 22 new `_plan_verify` variants; Linux and specialized hosted jobs were skipped. I did not reproduce the author-reported RTX 4070 Ti SUPER, RDNA2 iGPU, or lavapipe runs. - No local C++ build, CTest, console run, or preparer-thread execution was performed. ## To get this to a good state Please agree with the #10678 author on landing order and update the dependency checklist on the later PR. Please also clarify the cache interaction in the plan contract. I will rerun the same checks on the updated head.
adriadam10 commented 2026-11-06 14:39:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-11-06T14:39:47Z.

Review: CHANGES_REQUESTED


main moved under this head and it now conflicts in core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp (three hunks, all around resolveDrawResources and its call in prepareDraw). It needs a design decision, not a mechanical rebase:

  • resolveDrawResources: main now computes const bool candidate = recordable && !noDrawResourceCache && !noTextureCache && all PipelineVariantId() != 0 and then resolved.cacheable = candidate && !ShaderResources::NeverReusable(shaders). address (addressStages, AddressDrawReuse::NotReadOnly/NotSpaceOnly) is derived from candidate, so it also applies to stages that are NeverReusable. plan.keyed folds NeverReusable into the same flag, so the address-reuse classification would change for those draws. DrawPlan needs to carry the candidate condition and the NeverReusable condition separately (and the noDrawResourceCache/noTextureCache statics that main's code still reads in resolveDrawResources, which this PR removes).
  • prepareDraw: keep main's stopAfterResolve block and NoteDepthSurfaceWrite after resolveDrawResources when passing plan.
  • main's new helpers (AddressStages, snapshotsInTable, verifyServedSpace, drawStagingEnabled) sit right above resolveDrawResources, which is where the conflict markers land.

After the rebase, please rerun the focused draw tests with the _plan_verify variants on the new head, since the key's inputs changed on main.

The landing order with #10678 is still only agreed in comments; Depends on stays none as you wrote it, so that is fine once it is confirmed there.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5801705888 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14051#pullrequestreview-5801705888). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-11-06T14:39:47Z. **Review:** CHANGES_REQUESTED --- `main` moved under this head and it now conflicts in `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp` (three hunks, all around `resolveDrawResources` and its call in `prepareDraw`). It needs a design decision, not a mechanical rebase: - `resolveDrawResources`: `main` now computes `const bool candidate = recordable && !noDrawResourceCache && !noTextureCache && all PipelineVariantId() != 0` and then `resolved.cacheable = candidate && !ShaderResources::NeverReusable(shaders)`. `address` (`addressStages`, `AddressDrawReuse::NotReadOnly`/`NotSpaceOnly`) is derived from `candidate`, so it also applies to stages that are `NeverReusable`. `plan.keyed` folds `NeverReusable` into the same flag, so the address-reuse classification would change for those draws. `DrawPlan` needs to carry the candidate condition and the `NeverReusable` condition separately (and the `noDrawResourceCache`/`noTextureCache` statics that `main`'s code still reads in `resolveDrawResources`, which this PR removes). - `prepareDraw`: keep `main`'s `stopAfterResolve` block and `NoteDepthSurfaceWrite` after `resolveDrawResources` when passing `plan`. - `main`'s new helpers (`AddressStages`, `snapshotsInTable`, `verifyServedSpace`, `drawStagingEnabled`) sit right above `resolveDrawResources`, which is where the conflict markers land. After the rebase, please rerun the focused draw tests with the `_plan_verify` variants on the new head, since the key's inputs changed on `main`. The landing order with #10678 is still only agreed in comments; `Depends on` stays `none` as you wrote it, so that is fine once it is confirmed there.
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!14051
No description provided.