perf(agc): queue all records of a CPU-path indirect draw behind APS5_PIPELINE_INDIRECT #1896

Open
fisherjoey wants to merge 3 commits from upstream-pr/1896 into main
fisherjoey commented 2026-10-08 22:55:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-08T22:55:17Z.


What

Most of what this PR set out to do is now in main:

  • #6931 (merged 10-19) queues the last record of a CPU-path indirect draw on the draw pipeline, on by default. The records before it still drain and draw inline.
  • #16993 (merged 11-08) queues GPU-path indirect draws like direct draws and declares their argument range and count word as reads. That covers the GPU-side half of this PR, and also the argument-read gap SleglJan pointed out on 10-30.

So I cut this PR down to what main still lacks. With APS5_PIPELINE_INDIRECT=1 (off by default):

  • A CPU-path indirect draw puts all of its records into one commit item, instead of drawing every record but the last inline under the GPU lock. Records that would drain first on main don't drain here.
  • Each record's patched stages point at the registered image views of that record's own capture, and the item holds those views until it commits. This fixes the use-after-free SleglJan found on 11-03, the way he suggested. e7b003afb6 made CompiledShader::registeredImageViews a raw pointer into the capture, and the expanded loop copied the stages without re-pointing it.
  • The captured memory is checked once before the item is queued, the same check main does for the last record.
  • The default pipeline depth becomes 64 instead of 8.

Two smaller commits are unchanged: a [committer] line under APS5_PROFILE_DRAW that counts inline draws, dispatches and drains per opcode, and capture drains now charged to the packet that reads.

The GPU-path code, the old Driver::draw overlap drain and the DrawPipelineCommits test are gone, since main has its own versions. The _items registrations (the indirect tests rerun with the knob on) now live in each test's tests/cmake fragment.

Tested

Head c195d1a938 on main a7ac923b80. Nobara 44 (Linux 7.2), GCC 16.2.1, Release with -DANYPS5_ENABLE_ASAN=ON, lavapipe (Mesa, VK_DRIVER_FILES=lvp_icd).

  • agc_driver_pipelined_indirect_draw_items and agc_driver_indirect_patched_stage_items pass under ASan. With the re-pointing line removed, agc_driver_indirect_patched_stage_items reports the same heap-use-after-free as in SleglJan's report (read in ShaderResources::buildPrepare on the committer, freed in materializeDrawStage).
  • ctest -R '^agc' -j6 under ASan: 1539 of 1552 pass (84 of them skip on lavapipe). The other 13 also fail or skip on main a7ac923b80 built the same way: 11 fail there too (stack-use-after-scope in the test harness, an LLVM alloc-dealloc mismatch inside lavapipe, agc_driver_graphics and friends), agcvsh_packet_writer is not built, and agc_driver_gcn_display_present timed out at -j6 but skips when run alone, as it does on main.
  • The 8 _items tests plus the 3 other _items tests: 10 repeated runs each under ASan, all pass. The 53 tests matching _items|indirect|pipelined pass.
  • tools/check_conventions.py --base origin/main passes.

Demon's Souls (PPSA01341 v1.07, RTX 5070 Ti, NVIDIA 595.91.07): no valid numbers, so this stays a draft. Both arms were main plus a local hack that ignores the exported stencil reference, which DS needs on NVIDIA to reach the level. With the knob on, the title reached the level and then stopped about 100 s later with [gpu] driver failure: vector::_M_range_insert (std::length_error). That's the same symptom as the use-after-free above, so some path in the expanded loop still leaves a stale view pointer, or a different one breaks. The tests above don't reach it. The main arm crashed with a segfault in title code before reaching the level, so I have no baseline line either. No summary lines yet.

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 in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • 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: lavapipe (Mesa llvmpipe), Nobara 44 x86-64, for the tests; NVIDIA RTX 5070 Ti, driver 595.91.07, Nobara 44, for the Demon's Souls runs
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4793762549 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1896). Originally posted by [fisherjoey](https://github.com/fisherjoey) on 2026-10-08T22:55:17Z. --- ### What Most of what this PR set out to do is now in `main`: - #6931 (merged 10-19) queues the last record of a CPU-path indirect draw on the draw pipeline, on by default. The records before it still drain and draw inline. - #16993 (merged 11-08) queues GPU-path indirect draws like direct draws and declares their argument range and count word as reads. That covers the GPU-side half of this PR, and also the argument-read gap SleglJan pointed out on 10-30. So I cut this PR down to what `main` still lacks. With `APS5_PIPELINE_INDIRECT=1` (off by default): - A CPU-path indirect draw puts all of its records into one commit item, instead of drawing every record but the last inline under the GPU lock. Records that would drain first on `main` don't drain here. - Each record's patched stages point at the registered image views of that record's own capture, and the item holds those views until it commits. This fixes the use-after-free SleglJan found on 11-03, the way he suggested. `e7b003afb6` made `CompiledShader::registeredImageViews` a raw pointer into the capture, and the expanded loop copied the stages without re-pointing it. - The captured memory is checked once before the item is queued, the same check `main` does for the last record. - The default pipeline depth becomes 64 instead of 8. Two smaller commits are unchanged: a `[committer]` line under `APS5_PROFILE_DRAW` that counts inline draws, dispatches and drains per opcode, and capture drains now charged to the packet that reads. The GPU-path code, the old `Driver::draw` overlap drain and the `DrawPipelineCommits` test are gone, since `main` has its own versions. The `_items` registrations (the indirect tests rerun with the knob on) now live in each test's `tests/cmake` fragment. ### Tested Head `c195d1a938` on `main` `a7ac923b80`. Nobara 44 (Linux 7.2), GCC 16.2.1, Release with `-DANYPS5_ENABLE_ASAN=ON`, lavapipe (Mesa, `VK_DRIVER_FILES=lvp_icd`). - `agc_driver_pipelined_indirect_draw_items` and `agc_driver_indirect_patched_stage_items` pass under ASan. With the re-pointing line removed, `agc_driver_indirect_patched_stage_items` reports the same heap-use-after-free as in SleglJan's report (read in `ShaderResources::buildPrepare` on the committer, freed in `materializeDrawStage`). - `ctest -R '^agc' -j6` under ASan: 1539 of 1552 pass (84 of them skip on lavapipe). The other 13 also fail or skip on `main` `a7ac923b80` built the same way: 11 fail there too (stack-use-after-scope in the test harness, an LLVM alloc-dealloc mismatch inside lavapipe, `agc_driver_graphics` and friends), `agcvsh_packet_writer` is not built, and `agc_driver_gcn_display_present` timed out at `-j6` but skips when run alone, as it does on `main`. - The 8 `_items` tests plus the 3 other `_items` tests: 10 repeated runs each under ASan, all pass. The 53 tests matching `_items|indirect|pipelined` pass. - `tools/check_conventions.py --base origin/main` passes. Demon's Souls (PPSA01341 v1.07, RTX 5070 Ti, NVIDIA 595.91.07): no valid numbers, so this stays a draft. Both arms were `main` plus a local hack that ignores the exported stencil reference, which DS needs on NVIDIA to reach the level. With the knob on, the title reached the level and then stopped about 100 s later with `[gpu] driver failure: vector::_M_range_insert` (`std::length_error`). That's the same symptom as the use-after-free above, so some path in the expanded loop still leaves a stale view pointer, or a different one breaks. The tests above don't reach it. The `main` arm crashed with a segfault in title code before reaching the level, so I have no baseline line either. No summary lines yet. ### 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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [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: lavapipe (Mesa llvmpipe), Nobara 44 x86-64, for the tests; NVIDIA RTX 5070 Ti, driver 595.91.07, Nobara 44, for the Demon's Souls runs - [x] AI-assisted: yes
Mouhand-Kaddo commented 2026-10-10 10:05:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-10T10:05:37Z.


Additional platform validation on standalone PR head ae7542cde86d1ed7b0aad19cc1865a1899a24aee:

Windows: passed — Windows 11, supported WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7; CMake 4.3.1 / Ninja.

Release / BUILD_TESTING=ON: built the selected test targets; 3 CTest cases, 0 failures, 0 CTest skips.

Tests: agc_driver, agc_driver_pm4, agc_driver_graphics.

Reproduce after building the test targets: ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^agc_driver($|_graphics$|_pm4$|_submit$)".

Ran with APS5_PIPELINE_INDIRECT=1 to exercise indirect submission.

Vulkan: native AMD RX 6900 XT, driver 32.0.21045.5002.

Integration limitation: a local merge against main 948a526c2 has source conflicts; these results validate the standalone PR head, not a resolved merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6096398132 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1896#issuecomment-6096398132). Originally posted by [Mouhand-Kaddo](https://github.com/Mouhand-Kaddo) on 2026-10-10T10:05:37Z. --- <!-- anyps5-platform-validation:ae7542cde86d1ed7b0aad19cc1865a1899a24aee --> Additional platform validation on standalone PR head `ae7542cde86d1ed7b0aad19cc1865a1899a24aee`: **Windows: passed** — Windows 11, supported WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7; CMake 4.3.1 / Ninja. Release / `BUILD_TESTING=ON`: built the selected test targets; 3 CTest cases, 0 failures, 0 CTest skips. Tests: `agc_driver`, `agc_driver_pm4`, `agc_driver_graphics`. Reproduce after building the test targets: `ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^agc_driver($|_graphics$|_pm4$|_submit$)"`. Ran with `APS5_PIPELINE_INDIRECT=1` to exercise indirect submission. Vulkan: native AMD RX 6900 XT, driver 32.0.21045.5002. Integration limitation: a local merge against main `948a526c2` has source conflicts; these results validate the standalone PR head, not a resolved merge.
adriadam10 commented 2026-10-11 11:40:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T11:40:32Z.

Review: CHANGES_REQUESTED


Thanks for taking indirect draws from #1202. Not mergeable yet, for two reasons:

  • The branch carries the whole #1201/#1202/#1747 stack (55 files, 7 commits that are not yours) and conflicts with main. All the bases are still open drafts, and @MichonGoddijn231849 said on #1201 and #1747 that the stack is parked while it is ported onto the prepared-shader path from #639. This PR can only land after they do.
  • Because that port changes where draws are decoded and recompiled, the drain/overlap checks in Driver::draw may need to move with it.

What would help: keep this as a draft, and once the bases land (or the port is published) rebase onto main so the diff is only Draw.cpp, DrawPipeline.{hpp,cpp}, WriteEvidence.cpp and DrawPipelineCommits.cpp, tick "Based on current main", and rerun your Demon's Souls numbers on that head. We'll review it then.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5483161420 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1896#pullrequestreview-5483161420). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T11:40:32Z. **Review:** CHANGES_REQUESTED --- Thanks for taking indirect draws from #1202. Not mergeable yet, for two reasons: - The branch carries the whole #1201/#1202/#1747 stack (55 files, 7 commits that are not yours) and conflicts with `main`. All the bases are still open drafts, and @MichonGoddijn231849 said on #1201 and #1747 that the stack is parked while it is ported onto the prepared-shader path from #639. This PR can only land after they do. - Because that port changes where draws are decoded and recompiled, the drain/overlap checks in `Driver::draw` may need to move with it. What would help: keep this as a draft, and once the bases land (or the port is published) rebase onto `main` so the diff is only `Draw.cpp`, `DrawPipeline.{hpp,cpp}`, `WriteEvidence.cpp` and `DrawPipelineCommits.cpp`, tick "Based on current `main`", and rerun your Demon's Souls numbers on that head. We'll review it then.
fisherjoey commented 2026-10-12 03:41:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-12T03:41:30Z.


Thanks, makes sense. I've moved this to draft. Once the #1201/#1202/#1747 stack lands on main (or Michon publishes the port onto #639's prepared-shader path), I'll rebase so the diff is only Draw.cpp, DrawPipeline.{hpp,cpp}, WriteEvidence.cpp and DrawPipelineCommits.cpp, move the drain/overlap checks in Driver::draw if the port needs it, tick "Based on current main", and rerun the Demon's Souls numbers on that head.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6117327314 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1896#issuecomment-6117327314). Originally posted by [fisherjoey](https://github.com/fisherjoey) on 2026-10-12T03:41:30Z. --- Thanks, makes sense. I've moved this to draft. Once the #1201/#1202/#1747 stack lands on `main` (or Michon publishes the port onto #639's prepared-shader path), I'll rebase so the diff is only `Draw.cpp`, `DrawPipeline.{hpp,cpp}`, `WriteEvidence.cpp` and `DrawPipelineCommits.cpp`, move the drain/overlap checks in `Driver::draw` if the port needs it, tick "Based on current main", and rerun the Demon's Souls numbers on that head. AI-assisted: yes
fisherjoey commented 2026-10-17 07:23:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-17T07:23:50Z.


@adriadam10 Rebased onto main. Your points in order:

  1. The branch carried the #1201/#1202/#1747 stack and conflicted with main. Those PRs are merged now (#1201 and #1202 on 10-15, #1747 on 10-16), so I rebuilt the branch on main 6a32550fd with only this PR's commit, 8ba9dda20. The diff is the five files you listed: Draw.cpp, DrawPipeline.{hpp,cpp}, WriteEvidence.cpp, DrawPipelineCommits.cpp. It also merges cleanly into the current main 17cfb1f4c. I had to resolve two conflicts in DrawPipeline.{hpp,cpp}, where QueuedItems() sits next to the new functions, and bring the CPU-side indirect branch in line with how main's inline loop works now:

    • materializeDrawStage returns a shared_ptr, and shaderMemory is now a unique_ptr.
    • Tessellation control and evaluation stages are materialized again for each record, using that record's draw parameters, as the inline loop does.
    • The commit item also keeps compiledStages and stageData alive, because the stage pointers point into them.
  2. Whether the port onto #639's prepared-shader path moves the drain/overlap checks in Driver::draw: on main, decoding, the cache lookup and stage materialization all still happen in Driver::draw, before the enqueue. So the argument-overlap check and the validated-hit overlap check stay where they were. Nothing moved apart from the adjustments in point 1.

  3. Ticking "Based on current main": the branch is based on current main, but I've left the box unticked for now. #6931, opened 10-16, queues CPU-path indirect draws on the pipeline, is on by default, and keeps GPU-side indirect draws draining. That overlaps the CPU-side half of this PR, and the two conflict in Draw.cpp. I haven't decided yet whether to drop the CPU-side part here and put the GPU-side part on top of #6931. That's still open.

  4. Demon's Souls numbers on the new head: not rerun yet. This head has only been tested on lavapipe: ctest -R 'agc|pipelined|fill' (633 tests), 4 runs with APS5_PIPELINE_INDIRECT off and 4 with it on. The only failure was agc_driver_preparation_scope_settle, a shader-registration timing test that does no draws. Run alone it failed 3 of 10 times with the knob off and 5 of 10 with it on, while the machine was busy with another build. The new test, agc_driver_draw_pipeline_commits, plus the pipelined_*, fill and indirect tests passed 10 of 10 runs with the knob off and 10 of 10 with it on. The table in the description is still from the old stack and is labelled that way. I'll replace it once the game has been measured on this head.

The PR stays a draft until 3 and 4 are sorted out.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6231176366 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1896#issuecomment-6231176366). Originally posted by [fisherjoey](https://github.com/fisherjoey) on 2026-10-17T07:23:50Z. --- @adriadam10 Rebased onto `main`. Your points in order: 1. The branch carried the #1201/#1202/#1747 stack and conflicted with `main`. Those PRs are merged now (#1201 and #1202 on 10-15, #1747 on 10-16), so I rebuilt the branch on `main` `6a32550fd` with only this PR's commit, `8ba9dda20`. The diff is the five files you listed: `Draw.cpp`, `DrawPipeline.{hpp,cpp}`, `WriteEvidence.cpp`, `DrawPipelineCommits.cpp`. It also merges cleanly into the current `main` `17cfb1f4c`. I had to resolve two conflicts in `DrawPipeline.{hpp,cpp}`, where `QueuedItems()` sits next to the new functions, and bring the CPU-side indirect branch in line with how `main`'s inline loop works now: - `materializeDrawStage` returns a `shared_ptr`, and `shaderMemory` is now a `unique_ptr`. - Tessellation control and evaluation stages are materialized again for each record, using that record's draw parameters, as the inline loop does. - The commit item also keeps `compiledStages` and `stageData` alive, because the stage pointers point into them. 2. Whether the port onto #639's prepared-shader path moves the drain/overlap checks in `Driver::draw`: on `main`, decoding, the cache lookup and stage materialization all still happen in `Driver::draw`, before the enqueue. So the argument-overlap check and the validated-hit overlap check stay where they were. Nothing moved apart from the adjustments in point 1. 3. Ticking "Based on current `main`": the branch is based on current `main`, but I've left the box unticked for now. #6931, opened 10-16, queues CPU-path indirect draws on the pipeline, is on by default, and keeps GPU-side indirect draws draining. That overlaps the CPU-side half of this PR, and the two conflict in `Draw.cpp`. I haven't decided yet whether to drop the CPU-side part here and put the GPU-side part on top of #6931. That's still open. 4. Demon's Souls numbers on the new head: not rerun yet. This head has only been tested on lavapipe: `ctest -R 'agc|pipelined|fill'` (633 tests), 4 runs with `APS5_PIPELINE_INDIRECT` off and 4 with it on. The only failure was `agc_driver_preparation_scope_settle`, a shader-registration timing test that does no draws. Run alone it failed 3 of 10 times with the knob off and 5 of 10 with it on, while the machine was busy with another build. The new test, `agc_driver_draw_pipeline_commits`, plus the `pipelined_*`, fill and indirect tests passed 10 of 10 runs with the knob off and 10 of 10 with it on. The table in the description is still from the old stack and is labelled that way. I'll replace it once the game has been measured on this head. The PR stays a draft until 3 and 4 are sorted out. AI-assisted: yes
MarcZX10 commented 2026-11-17 01:57:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T01:57:08Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head c195d1a93890f01a8e0e25324f9100031b13f231, base main. No merged-preview check was run.
  • Read the whole diff (522 lines) and the head text of the code it touches, through the reader.
  • No build and no test run in this review.
python3 repo_read.py search registeredViews core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
python3 repo_read.py search pipelinedIndirect core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
python3 repo_read.py search commitDraw core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
python3 repo_read.py search Enqueue( core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawPipeline.hpp
python3 repo_read.py search CurrentPacket core/libs/prx/libSceAgcDriver/Execution/include
python3 repo_read.py search tests/cmake core/libs/prx/libSceAgcDriver
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp 580 625
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp 340 362
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp 1040 1070
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp 1212 1216
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp 1374 1400

Results

Check Result Note
Diff of the 15 reviewed files passed every hunk read
Head context for the changed code passed Drain, Draw loop, commit path
Build not run no build in this run
Test suite not run author-reported only
Demon's Souls run not run author-reported crash
Test fragments are included passed glob at CMakeLists.txt:800

Findings

Blocking

None verified.

Non-blocking

  1. core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp:1214: every expanded record keeps its own copy of all captured memory regions in item.snapshots, and expanded holds each record's materialized shaders until the committer runs. The inline path freed each record's snapshot after drawing it. Memory held therefore grows with the record count of the indirect draw. I did not measure the size. The knob is off by default.
  2. core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp:311: NoteInline does an atomic increment on every inline draw and dispatch, even when APS5_PROFILE_DRAW is unset. Only the profile report reads the counts. The cost is small, but gating the counting on the profile flag would remove it.

Sources

Not verified

  • Build and the ASan test runs. The counts in the description (1539 of 1552 passing, 10 repeated runs of the _items tests) are the author's; I did not reproduce them.
  • The Demon's Souls crash (vector::_M_range_insert, std::length_error, about 100 s after the level loads, knob on). I could not reproduce it and did not find its cause. I found no stale view pointer in the expanded loop, but the author's suspicion is not settled.
  • Callee bodies were not read: materializeDrawStage, KnownDrawRejection, capturedMemoryChanged, Pm4::ReadDrawArguments. I checked call sites and the commitDraw signature only.
  • The test executables behind the new _items registrations were not checked; only the fragments were.
  • Files: all 15 reviewed files were read through the diff. Excluded by rule: none. Full text of the changed files was not read.

To get this to a good state

Nothing is required.

Optional: the two non-blocking points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5931407056 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1896#pullrequestreview-5931407056). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T01:57:08Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran - Head `c195d1a93890f01a8e0e25324f9100031b13f231`, base `main`. No merged-preview check was run. - Read the whole diff (522 lines) and the head text of the code it touches, through the reader. - No build and no test run in this review. ``` python3 repo_read.py search registeredViews core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp python3 repo_read.py search pipelinedIndirect core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp python3 repo_read.py search commitDraw core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp python3 repo_read.py search Enqueue( core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawPipeline.hpp python3 repo_read.py search CurrentPacket core/libs/prx/libSceAgcDriver/Execution/include python3 repo_read.py search tests/cmake core/libs/prx/libSceAgcDriver python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp 580 625 python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp 340 362 python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp 1040 1070 python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp 1212 1216 python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp 1374 1400 ``` ## Results | Check | Result | Note | |---|---|---| | Diff of the 15 reviewed files | passed | every hunk read | | Head context for the changed code | passed | Drain, Draw loop, commit path | | Build | not run | no build in this run | | Test suite | not run | author-reported only | | Demon's Souls run | not run | author-reported crash | | Test fragments are included | passed | glob at CMakeLists.txt:800 | ## Findings ### Blocking None verified. ### Non-blocking 1. `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp:1214`: every expanded record keeps its own copy of all captured memory regions in `item.snapshots`, and `expanded` holds each record's materialized shaders until the committer runs. The inline path freed each record's snapshot after drawing it. Memory held therefore grows with the record count of the indirect draw. I did not measure the size. The knob is off by default. 2. `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp:311`: `NoteInline` does an atomic increment on every inline draw and dispatch, even when `APS5_PROFILE_DRAW` is unset. Only the profile report reads the counts. The cost is small, but gating the counting on the profile flag would remove it. ## Sources - [Draw.cpp#L1214](https://github.com/boykopovar/AnyPS5/blob/c195d1a93890f01a8e0e25324f9100031b13f231/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp#L1214) - [DrawPipeline.cpp#L311](https://github.com/boykopovar/AnyPS5/blob/c195d1a93890f01a8e0e25324f9100031b13f231/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp#L311) ## Not verified - Build and the ASan test runs. The counts in the description (1539 of 1552 passing, 10 repeated runs of the `_items` tests) are the author's; I did not reproduce them. - The Demon's Souls crash (`vector::_M_range_insert`, `std::length_error`, about 100 s after the level loads, knob on). I could not reproduce it and did not find its cause. I found no stale view pointer in the expanded loop, but the author's suspicion is not settled. - Callee bodies were not read: `materializeDrawStage`, `KnownDrawRejection`, `capturedMemoryChanged`, `Pm4::ReadDrawArguments`. I checked call sites and the `commitDraw` signature only. - The test executables behind the new `_items` registrations were not checked; only the fragments were. - Files: all 15 reviewed files were read through the diff. Excluded by rule: none. Full text of the changed files was not read. ## To get this to a good state Nothing is required. Optional: the two non-blocking points above.
ligmaSec commented 2026-12-03 22:17:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:17:16Z.

Review: COMMENTED


The trial merge onto a1b75b0947 conflicts in the draw-pipeline interface and implementation, dispatch variant validation, write evidence, and ENVIRONMENT.md. When rebasing the opt-in indirect path, preserve the partway fallback where already expanded records commit before the remaining inline records. Keep zero-count and draw-index coverage with the argument-producer controls. The performance evidence should use paired trace_digest.py summaries for the same scene and machine on the final revision.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6179574432 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1896#pullrequestreview-6179574432). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T22:17:16Z. **Review:** COMMENTED --- The trial merge onto `a1b75b0947` conflicts in the draw-pipeline interface and implementation, dispatch variant validation, write evidence, and `ENVIRONMENT.md`. When rebasing the opt-in indirect path, preserve the partway fallback where already expanded records commit before the remaining inline records. Keep zero-count and draw-index coverage with the argument-producer controls. The performance evidence should use paired `trace_digest.py` summaries for the same scene and machine on the final revision. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1896:upstream-pr/1896'
git switch 'upstream-pr/1896'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1896'
git switch 'upstream-pr/1896'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1896'
git switch 'upstream-pr/1896'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1896'
git switch 'main'
git merge --squash 'upstream-pr/1896'
git switch 'main'
git merge --ff-only 'upstream-pr/1896'
git switch 'main'
git merge 'upstream-pr/1896'
git push origin 'main'
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!1896
No description provided.