perf(agc): pipeline queue-0 draw commits behind the packet worker #1201

Merged
MichonGoddijn231849 merged 18 commits from upstream-pr/1201 into main 2026-10-15 10:11:01 +00:00
MichonGoddijn231849 commented 2026-10-07 17:28:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-07T17:28:58Z.


What

With APS5_PIPELINED_DRAWS=1, queue 0's worker decodes, captures and recompiles a draw, and hands it to a committer thread that records it (Graphics::Draw under the GPU lock). The two now run in parallel instead of one after the other. Work the committer has not reached yet is tracked by the guest ranges it will write. A later packet that reads or writes those ranges, or one the pipeline cannot order, drains it.

These are ordered as commit items instead of drains:

  • labels (WRITE_DATA, RELEASE_MEM), and same-queue waits on them (APS5_PIPELINE_DRAIN_LABELS=1 drains instead);
  • the end of a queue-0 submission, and a released REWIND tail (APS5_PIPELINE_DRAIN_SUBMISSIONS=1 drains);
  • the title's buffer fill kernels (APS5_PIPELINE_DRAIN_FILLS=1 drains);
  • DMA_DATA immediates and copies (APS5_PIPELINE_DMA=1).

A draw's write ranges include the storage images it writes and its exact color and depth target ranges (APS5_EXACT_DRAW_WRITES=1), not estimates.

Draw-path costs the pipeline exposed:

  • ShaderMemory moves, so a commit owns its capture's pages.
  • A submission made before the worker's current collect epoch began keeps the epoch, so a worker behind a queue of submissions walks a surface once per catch-up (APS5_SUBMISSION_EPOCH_EACH=1 bumps at every submission). A thread remembers the ranges it walked for the whole epoch.
  • The pipeline signals only threads that wait.
  • The pending-image and unit-shadow registries take a spinning slim lock instead of std::mutex (winpthreads contention showed up as kernel events).
  • ScanPending skips the registry walk when no pending image can overlap.
  • Fewer heap allocations per recorded draw: reused descriptor sets and scratch vectors, and buffer pool size classes are kept.

The pipeline is off by default in this PR; the next one in the series turns it on.

A predicated packet is left to the normal path while predication is active, so a false predicate still skips it.

Two fixes since the rebase, each its own commit: a null storage image in a draw's written set is skipped before it is decoded (gjonn and SleglJan's report, PPSA01317), and a pipelined RELEASE_MEM with INT_SEL 3 raises no interrupt, as on main (TheAggie's report).

Note for #374 and #419: they note HTILE and CMASK fills in the DMA_DATA path. Whichever lands second also has to call NoteDepthMetadataFill and NoteColorMetadataFill in the pipelined DMA commit (commitDmaStore).

Tested

Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB, MinGW-w64 GCC 15.2.0.

  • GTA V PPSA04264 (01.005) runs with this change on the combined gta-v/testing branch (Performance mode, the prologue). GTA V Performance mode, the prologue's bank interior: about 11.7 to 20 fps together with the cheaper captures below it.
  • On this branch: builds, and ctest passes. Not run here: the relinker's Python tests (my local Python does not find their helper modules) and guest_gameupdate.
  • Rebased on main a56c905df (2026-10-13), starting from gjonn's rebase of this series onto 6ac63bf0c (thanks). On Windows (MinGW GCC 15.2, RTX 5080) the whole agc_* suite passes on the top of the series: 483 tests, 1 skipped (agc_driver_stencil_ref_export).
  • With APS5_PIPELINED_DRAWS=1 the same suite passes except agc_driver_pm4_failure, which expects a synchronous rejection (#1202 runs it with the pipeline off).

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 (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #1193 (stacked; only the last commit is this PR)
  • AI-assisted: yes. Written with Claude (Anthropic) under my direction; I reviewed and tested it.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4776140903 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-07T17:28:58Z. --- ### What With `APS5_PIPELINED_DRAWS=1`, queue 0's worker decodes, captures and recompiles a draw, and hands it to a committer thread that records it (`Graphics::Draw` under the GPU lock). The two now run in parallel instead of one after the other. Work the committer has not reached yet is tracked by the guest ranges it will write. A later packet that reads or writes those ranges, or one the pipeline cannot order, drains it. These are ordered as commit items instead of drains: - labels (WRITE_DATA, RELEASE_MEM), and same-queue waits on them (`APS5_PIPELINE_DRAIN_LABELS=1` drains instead); - the end of a queue-0 submission, and a released REWIND tail (`APS5_PIPELINE_DRAIN_SUBMISSIONS=1` drains); - the title's buffer fill kernels (`APS5_PIPELINE_DRAIN_FILLS=1` drains); - DMA_DATA immediates and copies (`APS5_PIPELINE_DMA=1`). A draw's write ranges include the storage images it writes and its exact color and depth target ranges (`APS5_EXACT_DRAW_WRITES=1`), not estimates. Draw-path costs the pipeline exposed: - `ShaderMemory` moves, so a commit owns its capture's pages. - A submission made before the worker's current collect epoch began keeps the epoch, so a worker behind a queue of submissions walks a surface once per catch-up (`APS5_SUBMISSION_EPOCH_EACH=1` bumps at every submission). A thread remembers the ranges it walked for the whole epoch. - The pipeline signals only threads that wait. - The pending-image and unit-shadow registries take a spinning slim lock instead of `std::mutex` (winpthreads contention showed up as kernel events). - `ScanPending` skips the registry walk when no pending image can overlap. - Fewer heap allocations per recorded draw: reused descriptor sets and scratch vectors, and buffer pool size classes are kept. The pipeline is off by default in this PR; the next one in the series turns it on. A predicated packet is left to the normal path while predication is active, so a false predicate still skips it. Two fixes since the rebase, each its own commit: a null storage image in a draw's written set is skipped before it is decoded (gjonn and SleglJan's report, PPSA01317), and a pipelined `RELEASE_MEM` with `INT_SEL` 3 raises no interrupt, as on `main` (TheAggie's report). Note for #374 and #419: they note HTILE and CMASK fills in the DMA_DATA path. Whichever lands second also has to call `NoteDepthMetadataFill` and `NoteColorMetadataFill` in the pipelined DMA commit (`commitDmaStore`). ### Tested Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB, MinGW-w64 GCC 15.2.0. - GTA V PPSA04264 (01.005) runs with this change on the combined [`gta-v/testing`](https://github.com/MichonGoddijn231849/AnyPS5-fork/tree/gta-v/testing) branch (Performance mode, the prologue). GTA V Performance mode, the prologue's bank interior: about 11.7 to 20 fps together with the cheaper captures below it. - On this branch: builds, and `ctest` passes. Not run here: the relinker's Python tests (my local Python does not find their helper modules) and `guest_gameupdate`. - Rebased on `main` a56c905df (2026-10-13), starting from gjonn's rebase of this series onto 6ac63bf0c (thanks). On Windows (MinGW GCC 15.2, RTX 5080) the whole `agc_*` suite passes on the top of the series: 483 tests, 1 skipped (`agc_driver_stencil_ref_export`). - With `APS5_PIPELINED_DRAWS=1` the same suite passes except `agc_driver_pm4_failure`, which expects a synchronous rejection (#1202 runs it with the pipeline off). ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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: #1193 (stacked; only the last commit is this PR) - [x] AI-assisted: yes. Written with Claude (Anthropic) under my direction; I reviewed and tested it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MichonGoddijn231849 commented 2026-10-09 08:33:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-09T08:33:00Z.


Parked as a draft while I port the pipelined draw path onto #639 (the draw path now runs through prepared invocations). I'll mark it ready again when the port is tested.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6077391208 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6077391208). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-09T08:33:00Z. --- Parked as a draft while I port the pipelined draw path onto #639 (the draw path now runs through prepared invocations). I'll mark it ready again when the port is tested.
Raghav314 commented 2026-10-11 04:40:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-11T04:40:02Z.


Ran this with Hades II (PPSA36082) on my machine, rebased locally onto current main together with #419 and the other changes the game needs. With APS5_PIPELINED_DRAWS=1 the hub went from ~47 fps to the 60 fps cap, but the 3D characters (Melinoë, her shadow, the NPCs) flickered or showed up as dark silhouettes. Those are drawn into 4x targets and then resolved.

The cause was in precheckDraw: when the draw is a CB metadata pass (DecodeColorMetadataPass, i.e. the resolve from #419, or a CMASK/DCC pass), it runs ColorMetadataPass right away on the worker, under the GPU lock, without draining the pipeline. So the resolve got recorded ahead of up to 8 queued draws, including the ones drawing into the 4x target it resolves. The drain/ordering switches (APS5_PIPELINE_DRAIN_*, APS5_EXACT_DRAW_WRITES) don't change anything here since this path never goes through the queue.

Draining before the pass fixed it for me:

if (const auto pass = Graphics::DecodeColorMetadataPass(queue)) {
    require(!drawParameters.indirect, "indirect CB metadata passes are unsupported");
    if (DrawPipeline::Active()) DrawPipeline::Queue0().Drain(DrawPipeline::DrainReason::Packet, (packet[0] >> 8u) & 0xffu);
    ...

In the hub that's ~350 drains a second costing ~1.8% of the worker, so enqueuing the pass as a commit item would be the nicer version. With it the characters render correctly and it stays at 60 (worker 16 us per packet, committer 9.4 us per commit).

Since this only shows up when both this and #419 are in, just flagging it for whichever lands second. A few other spots I had to touch when rebasing onto current main, in case they're useful: noteLabelStore now takes the queue; the NoteDepthMetadataFill/NoteColorMetadataFill calls you mentioned for the pipelined DMA commit; and NoteHtileDepthClear in Dispatch.cpp now runs before the dispatch's drain on main, so I moved it after.

LLM assistance used.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6105512149 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6105512149). Originally posted by [Raghav314](https://github.com/Raghav314) on 2026-10-11T04:40:02Z. --- Ran this with Hades II (PPSA36082) on my machine, rebased locally onto current main together with #419 and the other changes the game needs. With `APS5_PIPELINED_DRAWS=1` the hub went from ~47 fps to the 60 fps cap, but the 3D characters (Melinoë, her shadow, the NPCs) flickered or showed up as dark silhouettes. Those are drawn into 4x targets and then resolved. The cause was in `precheckDraw`: when the draw is a CB metadata pass (`DecodeColorMetadataPass`, i.e. the resolve from #419, or a CMASK/DCC pass), it runs `ColorMetadataPass` right away on the worker, under the GPU lock, without draining the pipeline. So the resolve got recorded ahead of up to 8 queued draws, including the ones drawing into the 4x target it resolves. The drain/ordering switches (`APS5_PIPELINE_DRAIN_*`, `APS5_EXACT_DRAW_WRITES`) don't change anything here since this path never goes through the queue. Draining before the pass fixed it for me: ```cpp if (const auto pass = Graphics::DecodeColorMetadataPass(queue)) { require(!drawParameters.indirect, "indirect CB metadata passes are unsupported"); if (DrawPipeline::Active()) DrawPipeline::Queue0().Drain(DrawPipeline::DrainReason::Packet, (packet[0] >> 8u) & 0xffu); ... ``` In the hub that's ~350 drains a second costing ~1.8% of the worker, so enqueuing the pass as a commit item would be the nicer version. With it the characters render correctly and it stays at 60 (worker 16 us per packet, committer 9.4 us per commit). Since this only shows up when both this and #419 are in, just flagging it for whichever lands second. A few other spots I had to touch when rebasing onto current main, in case they're useful: `noteLabelStore` now takes the queue; the `NoteDepthMetadataFill`/`NoteColorMetadataFill` calls you mentioned for the pipelined DMA commit; and `NoteHtileDepthClear` in `Dispatch.cpp` now runs before the dispatch's drain on main, so I moved it after. LLM assistance used.
Raghav314 commented 2026-10-11 06:44:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-11T06:44:04Z.


With pipelined draws on Hades II, the committer often found the queue empty (~1.1 items queued on average), so nearly every Enqueue paid a notify_one futex wake-up plus a reschedule. Letting the committer spin up to 50 µs on outstanding before waiting on the condition variable cut wake-ups from ~680k to ~8.6k per 10 s, the worker's hand-off from 2.7 to 1.1 µs per draw, and took a pickup menu from 48.8 to 53.2 fps (one run each, APS5_PIPELINE_SPIN_US, 0 turns it off).

Roughly what I did in run(), right before the wait:

if (outstanding.load(std::memory_order_acquire) == 0) {
    const auto deadline = std::chrono::steady_clock::now() + SpinBeforeSleep();
    while (outstanding.load(std::memory_order_acquire) == 0 && std::chrono::steady_clock::now() < deadline)
        __builtin_ia32_pause();
}

LLM assistance used.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106355606 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6106355606). Originally posted by [Raghav314](https://github.com/Raghav314) on 2026-10-11T06:44:04Z. --- With pipelined draws on Hades II, the committer often found the queue empty (~1.1 items queued on average), so nearly every `Enqueue` paid a `notify_one` futex wake-up plus a reschedule. Letting the committer spin up to 50 µs on `outstanding` before waiting on the condition variable cut wake-ups from ~680k to ~8.6k per 10 s, the worker's hand-off from 2.7 to 1.1 µs per draw, and took a pickup menu from 48.8 to 53.2 fps (one run each, `APS5_PIPELINE_SPIN_US`, 0 turns it off). Roughly what I did in `run()`, right before the wait: ```cpp if (outstanding.load(std::memory_order_acquire) == 0) { const auto deadline = std::chrono::steady_clock::now() + SpinBeforeSleep(); while (outstanding.load(std::memory_order_acquire) == 0 && std::chrono::steady_clock::now() < deadline) __builtin_ia32_pause(); } ``` LLM assistance used.
MichonGoddijn231849 commented 2026-10-11 07:59:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-11T07:59:40Z.


@Raghav314 thanks, both are real. The CB metadata pass (#419's resolve, CMASK/DCC passes) running on the worker ahead of queued draws is an ordering bug of the pipelined path; it has to be a commit item (or drain) before it lands with #419. The spin-before-sleep on outstanding is a nice win too. This PR is a parked draft while the pipelined stack is ported onto the prepared-shader path; when it comes out I'll take the metadata-pass ordering in. The spin is best as your own follow-up PR on top then, so it's credited to you.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106914121 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6106914121). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-11T07:59:40Z. --- @Raghav314 thanks, both are real. The CB metadata pass (#419's resolve, CMASK/DCC passes) running on the worker ahead of queued draws is an ordering bug of the pipelined path; it has to be a commit item (or drain) before it lands with #419. The spin-before-sleep on `outstanding` is a nice win too. This PR is a parked draft while the pipelined stack is ported onto the prepared-shader path; when it comes out I'll take the metadata-pass ordering in. The spin is best as your own follow-up PR on top then, so it's credited to you.
JAB-dev commented 2026-10-11 16:44:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JAB-dev on 2026-10-11T16:44:14Z.


Tested this on Hot Shots Golf 2 (PPSA06699, the PS1 classic in Sony's PS1HD emulator) on Windows, RTX 4070 SUPER, with APS5_PIPELINED_DRAWS off vs on and everything else identical (2 runs each, 130 s demo loop).

  • Off: 55.7 / 55.0 fps average, 13 frame drops per run, minimum 26 / 21 fps
  • On: 59.4 / 59.4 fps average, 4-5 frame drops, minimum 51.5 / 50 fps

It takes the 3D course from visibly stuttering to almost flat 60.
(tldr I really like the performance gains from this)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6111301844 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6111301844). Originally posted by [JAB-dev](https://github.com/JAB-dev) on 2026-10-11T16:44:14Z. --- Tested this on Hot Shots Golf 2 (PPSA06699, the PS1 classic in Sony's PS1HD emulator) on Windows, RTX 4070 SUPER, with `APS5_PIPELINED_DRAWS` off vs on and everything else identical (2 runs each, 130 s demo loop). - Off: 55.7 / 55.0 fps average, 13 frame drops per run, minimum 26 / 21 fps - On: 59.4 / 59.4 fps average, 4-5 frame drops, minimum 51.5 / 50 fps It takes the 3D course from visibly stuttering to almost flat 60. (tldr I really like the performance gains from this)
oneandonlydean commented 2026-10-11 20:11:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T20:11:46Z.


@MichonGoddijn231849 where does the port of this stack onto the prepared-shader path stand?

Data point from current main (a11c8f7f with #425, #454 and #290), Linux, RTX 4090, in a 3D title we test with: a level with about 6,400 draws per present spends about 110 ms of a 345 ms frame in the queue-0 worker's draw front end (stage capture, materialize, draw entry insert), against about 32 ms in Graphics::Draw itself. 97% of its draw keys never repeat, so a draw cache doesn't help there; running the front end ahead of the worker is what's left.

If the port is some way off, would you mind if I ported #1201 onto main and opened it with your commits kept?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6113237036 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6113237036). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-11T20:11:46Z. --- @MichonGoddijn231849 where does the port of this stack onto the prepared-shader path stand? Data point from current `main` (a11c8f7f with #425, #454 and #290), Linux, RTX 4090, in a 3D title we test with: a level with about 6,400 draws per present spends about 110 ms of a 345 ms frame in the queue-0 worker's draw front end (stage capture, materialize, draw entry insert), against about 32 ms in `Graphics::Draw` itself. 97% of its draw keys never repeat, so a draw cache doesn't help there; running the front end ahead of the worker is what's left. If the port is some way off, would you mind if I ported #1201 onto `main` and opened it with your commits kept?
MichonGoddijn231849 commented 2026-10-11 21:53:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-11T21:53:54Z.


@oneandonlydean the port exists but isn't public yet. It's on our dev branch on top of current main (after #639), together with later work on the same path: prepare threads for the commit, the committer spin and the measured switches on by default. It renders correctly in GTA V, but on the prepared-shader path it gained much less than it did before #639 (about 22 to 23.5 fps in our test scene). So I haven't opened it, and my time is on Wolverine right now.

So yes, please go ahead and port #1201 onto main with the commits kept, and I'll close this draft in favor of yours. Two things to take along:

  • Raghav's ordering bug above: the CB metadata pass (#419's resolve, CMASK/DCC passes) runs on the worker ahead of queued draws. It needs a drain, or better, a commit item.
  • With your numbers, pipelining can hide at most the ~32 ms of Graphics::Draw behind the ~110 ms front end. Cutting the front end itself needs it on more threads. I tried helper threads keyed by draw sequence before #639; they were slower only because the committer was the limit then, which isn't your case.

If it helps, I can push my port to a public branch so you can diff against it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114217572 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6114217572). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-11T21:53:54Z. --- @oneandonlydean the port exists but isn't public yet. It's on our dev branch on top of current main (after #639), together with later work on the same path: prepare threads for the commit, the committer spin and the measured switches on by default. It renders correctly in GTA V, but on the prepared-shader path it gained much less than it did before #639 (about 22 to 23.5 fps in our test scene). So I haven't opened it, and my time is on Wolverine right now. So yes, please go ahead and port #1201 onto main with the commits kept, and I'll close this draft in favor of yours. Two things to take along: - Raghav's ordering bug above: the CB metadata pass (#419's resolve, CMASK/DCC passes) runs on the worker ahead of queued draws. It needs a drain, or better, a commit item. - With your numbers, pipelining can hide at most the ~32 ms of `Graphics::Draw` behind the ~110 ms front end. Cutting the front end itself needs it on more threads. I tried helper threads keyed by draw sequence before #639; they were slower only because the committer was the limit then, which isn't your case. If it helps, I can push my port to a public branch so you can diff against it.
oneandonlydean commented 2026-10-11 22:48:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T22:48:11Z.


Yes, please push the port to a public branch; I'll start from it rather than from this head.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114765226 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6114765226). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-11T22:48:11Z. --- Yes, please push the port to a public branch; I'll start from it rather than from this head.
Scramblrrrr commented 2026-10-12 04:26:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-12T04:26:39Z.


007 Windows data point for the front-end discussion, on our public runtime-image-table integration742449f6d (RTX5070Ti/7800X3D/32GiB, Release, SPIRV-Tools OFF). A10s interval had2932draw packets: capture570us/packet, materialize/recompile-hit557us, key/lookup/validate524us, Graphics::Draw713us. The draw-entry cache in another interval retained4096entries/8373variants (~3781MiB) for25full hits out of2986lookups;2780had no entry. Code currently copies every captured region into each inserted variant's words, even with that low key reuse.

I am comparing the existing APS5_NO_DRAW_SRT_ENTRIES option before changing that cache. #3655/#3656 native cross-tests passed and007 still renders the startup notices, but no clear frame-rate gain yet. We also need the front-end cost reduced; GPU timing in the earlier run was 0.8s per10s of wall time, at0.6FPS.

Please point us to the public prepared-shader/pipelining port when ready; I will cross-test on Windows rather than create another full port. I am keeping the runtime-image-table integration separate from a current-main mergeability claim. No title data uploaded. AI-assisted: yes(Codex).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6117740618 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6117740618). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-12T04:26:39Z. --- 007 Windows data point for the front-end discussion, on our public runtime-image-table integration742449f6d (RTX5070Ti/7800X3D/32GiB, Release, SPIRV-Tools OFF). A10s interval had2932draw packets: capture570us/packet, materialize/recompile-hit557us, key/lookup/validate524us, Graphics::Draw713us. The draw-entry cache in another interval retained4096entries/8373variants (~3781MiB) for25full hits out of2986lookups;2780had no entry. Code currently copies every captured region into each inserted variant's words, even with that low key reuse. I am comparing the existing APS5_NO_DRAW_SRT_ENTRIES option before changing that cache. #3655/#3656 native cross-tests passed and007 still renders the startup notices, but no clear frame-rate gain yet. We also need the front-end cost reduced; GPU timing in the earlier run was ~0.8s per10s of wall time, at~0.6FPS. Please point us to the public prepared-shader/pipelining port when ready; I will cross-test on Windows rather than create another full port. I am keeping the runtime-image-table integration separate from a current-main mergeability claim. No title data uploaded. AI-assisted: yes(Codex).
Scramblrrrr commented 2026-10-12 04:31:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-12T04:31:21Z.


Existing-config comparison onbc46e2d6f, same warm cache/quiet settings: normal draw-stage cache showed the rendered MGM logo at0.73FPS/frame415 and ~24.1GBprivate memory. APS5_NO_DRAW_SRT_ENTRIES=1 showed the same MGM logo at0.98FPS/frame428 and17.1GBprivate, only1owned-process trim at that point. One run each, observed window FPS, not a controlled benchmark distribution; still not playable. All other graphics settings retained (compute128/LRUoff/memo512/resource64/texture2048/staging128). The cache-off run continues toward later screens.

I found @oneandonlydean's existing public astro-main/draw-key-admission-3, 77774a519899040aee6931144cea3d3f5a1d6e27, implementing second-sight admission rather than keeping every one-off key. It applied cleanly, with Dean Galvin's author retained: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-draw-admission-cross-test , 4e5c47e4893023d49a7e446baa4fc1d646d97bfe. Not built/staged yet. Native third-draw reuse/mutation checks next after the current run. No competing implementation or new upstream PR.

AI-assisted: yes(Codex). No title data uploaded.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6117783693 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6117783693). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-12T04:31:21Z. --- Existing-config comparison onbc46e2d6f, same warm cache/quiet settings: normal draw-stage cache showed the rendered MGM logo at0.73FPS/frame415 and ~24.1GBprivate memory. **APS5_NO_DRAW_SRT_ENTRIES=1** showed the same MGM logo at0.98FPS/frame428 and17.1GBprivate, only1owned-process trim at that point. One run each, observed window FPS, not a controlled benchmark distribution; still not playable. All other graphics settings retained (compute128/LRUoff/memo512/resource64/texture2048/staging128). The cache-off run continues toward later screens. I found @oneandonlydean's existing public **astro-main/draw-key-admission-3**, **77774a519899040aee6931144cea3d3f5a1d6e27**, implementing second-sight admission rather than keeping every one-off key. It applied cleanly, with Dean Galvin's author retained: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-draw-admission-cross-test , **4e5c47e4893023d49a7e446baa4fc1d646d97bfe**. **Not built/staged yet.** Native third-draw reuse/mutation checks next after the current run. No competing implementation or new upstream PR. AI-assisted: yes(Codex). No title data uploaded.
MichonGoddijn231849 commented 2026-10-12 15:50:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-12T15:50:14Z.


@oneandonlydean here it is: perf/pipelined-draws-port on my fork. It's one commit (913a29b20) on main 57f96fd2b: a snapshot of our dev branch at 3e4c9e867 without its test data, so the history isn't there, only the code.

The pipelined path is in Execution/src/Driver/Draw/DrawPipeline.cpp and Execution/include/Driver/Draw/DrawPipeline.hpp, with the worker side in Draw.cpp (draw / drawTail) and PacketExecution.cpp. In the order they were added on our branch:

  • labels and same-queue label waits as ordered commit items;
  • signals only to threads that wait;
  • APS5_PARALLEL_DRAWS (helper threads that prepare draws ahead of the worker);
  • APS5_RETIRE_ON_WORKER, APS5_PIPELINE_HYSTERESIS, APS5_COMMITTER_SPIN_US;
  • the measured switches on by default;
  • APS5_SPLIT_COMMIT=<n> (a draw's commit prepared on n threads ahead of the committer, on by default with 3).

The tests are agc_driver_pipelined_* and agc_driver_draw_write_ranges. Raghav's metadata-pass ordering (above) is not in it. @Scramblrrrr this is the branch for your cross-test too.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6127718590 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6127718590). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-12T15:50:14Z. --- @oneandonlydean here it is: [`perf/pipelined-draws-port`](https://github.com/MichonGoddijn231849/AnyPS5-fork/tree/perf/pipelined-draws-port) on my fork. It's one commit (`913a29b20`) on main `57f96fd2b`: a snapshot of our dev branch at `3e4c9e867` without its test data, so the history isn't there, only the code. The pipelined path is in `Execution/src/Driver/Draw/DrawPipeline.cpp` and `Execution/include/Driver/Draw/DrawPipeline.hpp`, with the worker side in `Draw.cpp` (`draw` / `drawTail`) and `PacketExecution.cpp`. In the order they were added on our branch: - labels and same-queue label waits as ordered commit items; - signals only to threads that wait; - `APS5_PARALLEL_DRAWS` (helper threads that prepare draws ahead of the worker); - `APS5_RETIRE_ON_WORKER`, `APS5_PIPELINE_HYSTERESIS`, `APS5_COMMITTER_SPIN_US`; - the measured switches on by default; - `APS5_SPLIT_COMMIT=<n>` (a draw's commit prepared on n threads ahead of the committer, on by default with 3). The tests are `agc_driver_pipelined_*` and `agc_driver_draw_write_ranges`. Raghav's metadata-pass ordering (above) is not in it. @Scramblrrrr this is the branch for your cross-test too.
gjonn commented 2026-10-12 19:39:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gjonn on 2026-10-12T19:39:19Z.

Code review location: core/libs/prx/libSceAgcDriver/Execution/src/Driver/Memory/WrittenBuffers.cpp; line 81

@@ -42,6 +58,70 @@ void Driver::noteDrawWriters(std::span<const Graphics::CompiledShader> stages, s
     }
 }
 
+bool ExactDrawWrites() {
+    static const bool exact = std::getenv("APS5_EXACT_DRAW_WRITES") != nullptr;
+    return exact;
+}
+
+std::vector<std::pair<std::uint64_t, std::uint64_t>> DrawWriteRanges(const Graphics::State& graphics, std::span<const Graphics::CompiledShader> stages, bool exact) {
+    constexpr std::uint64_t Slack = 64 * 1024;
+    constexpr std::uint64_t UnknownBytes = 64ull * 1024 * 1024;
+    std::vector<std::pair<std::uint64_t, std::uint64_t>> ranges;
+    const auto add = [&](std::uint64_t begin, std::uint64_t bytes) {
+        if (begin != 0) ranges.emplace_back(begin, begin + bytes);
+    };
+    for (const auto& stage : stages) {
+        if (stage.program == nullptr) continue;
+        visitWrittenBuffers(*stage.program, [&](std::uint32_t, std::uint64_t begin, std::uint64_t end, bool) { ranges.emplace_back(begin, end); });
+        for (const auto& binding : stage.program->bindings) {
+            if (binding.role != ShaderRecompiler::DescriptorRole::GuestImages || binding.kind != ShaderRecompiler::DescriptorKind::StorageImage) continue;
+            for (std::uint32_t element = 0; element < binding.count; ++element) {
+                const bool written = element >= binding.imageWritten.size() || binding.imageWritten[element];
+                if (!written || binding.guestDescriptor.size() < (static_cast<std::size_t>(element) + 1) * 8) continue;
+                const auto resource = Graphics::DecodeTextureResource(std::span<const std::uint32_t>(binding.guestDescriptor).subspan(static_cast<std::size_t>(element) * 8, 8));

A null storage-image descriptor in the written set makes this throw. DecodeTextureResource does Require(baseAddress != 0, ...) (GuestTextureResource.cpp:57), so the resource.baseAddress == 0 check on the next line never runs. The draw/dispatch then fails instead of skipping the image.

We hit this on PPSA01317: one of its draws has a null storage image bound in its written set.

Suggested fix: check the base-address words before decoding:

const auto words = std::span<const std::uint32_t>(binding.guestDescriptor).subspan(static_cast<std::size_t>(element) * 8, 8);
if (words[0] == 0 && (words[1] & 0xffu) == 0) continue; // null descriptor writes nothing
const auto resource = Graphics::DecodeTextureResource(words);

A null T# case in tests/execution/DrawWriteRanges.cpp would also cover it.

<!-- greyfinch-sync:boykopovar/AnyPS5:review-comment:4251699062 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#discussion_r4251699062). Originally posted by [gjonn](https://github.com/gjonn) on 2026-10-12T19:39:19Z. **Code review location:** `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Memory/WrittenBuffers.cpp`; line 81 ~~~~diff @@ -42,6 +58,70 @@ void Driver::noteDrawWriters(std::span<const Graphics::CompiledShader> stages, s } } +bool ExactDrawWrites() { + static const bool exact = std::getenv("APS5_EXACT_DRAW_WRITES") != nullptr; + return exact; +} + +std::vector<std::pair<std::uint64_t, std::uint64_t>> DrawWriteRanges(const Graphics::State& graphics, std::span<const Graphics::CompiledShader> stages, bool exact) { + constexpr std::uint64_t Slack = 64 * 1024; + constexpr std::uint64_t UnknownBytes = 64ull * 1024 * 1024; + std::vector<std::pair<std::uint64_t, std::uint64_t>> ranges; + const auto add = [&](std::uint64_t begin, std::uint64_t bytes) { + if (begin != 0) ranges.emplace_back(begin, begin + bytes); + }; + for (const auto& stage : stages) { + if (stage.program == nullptr) continue; + visitWrittenBuffers(*stage.program, [&](std::uint32_t, std::uint64_t begin, std::uint64_t end, bool) { ranges.emplace_back(begin, end); }); + for (const auto& binding : stage.program->bindings) { + if (binding.role != ShaderRecompiler::DescriptorRole::GuestImages || binding.kind != ShaderRecompiler::DescriptorKind::StorageImage) continue; + for (std::uint32_t element = 0; element < binding.count; ++element) { + const bool written = element >= binding.imageWritten.size() || binding.imageWritten[element]; + if (!written || binding.guestDescriptor.size() < (static_cast<std::size_t>(element) + 1) * 8) continue; + const auto resource = Graphics::DecodeTextureResource(std::span<const std::uint32_t>(binding.guestDescriptor).subspan(static_cast<std::size_t>(element) * 8, 8)); ~~~~ --- A null storage-image descriptor in the written set makes this throw. `DecodeTextureResource` does `Require(baseAddress != 0, ...)` (GuestTextureResource.cpp:57), so the `resource.baseAddress == 0` check on the next line never runs. The draw/dispatch then fails instead of skipping the image. We hit this on PPSA01317: one of its draws has a null storage image bound in its written set. Suggested fix: check the base-address words before decoding: ```cpp const auto words = std::span<const std::uint32_t>(binding.guestDescriptor).subspan(static_cast<std::size_t>(element) * 8, 8); if (words[0] == 0 && (words[1] & 0xffu) == 0) continue; // null descriptor writes nothing const auto resource = Graphics::DecodeTextureResource(words); ``` A null T# case in `tests/execution/DrawWriteRanges.cpp` would also cover it.
TheAggie commented 2026-10-13 03:17:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-13T03:17:44Z.


@oneandonlydean @MichonGoddijn231849 a data point and an offer for the port, so we don't duplicate each other.

I wanted the pipeline for a workload it hasn't been tried on (RetroArch's Flycast core, which renders through RADV on the PS5 GPU: about 2,700 small draws a frame, nearly all draw-cache hits), so I cherry-picked the original #1201 commit (6fe6c40a7, author kept) onto main 2a55cfe1e. It took 10 conflicted files. Branch: perf/pipelined-draws-on-main on my fork, three commits on main.

What I changed on top of the cherry-pick:

  • Dropped the parts that aren't the pipeline and conflict with main: descriptor set recycling, the BufferPool size-class change, and the #1193 ShaderMemory page pool (main's ShaderMemory only needed a defaulted move constructor).
  • enqueueLabelPacket treated every nonzero INT_SEL as an end-of-pipe interrupt. Main excludes 3 (send data after write confirm), and agc_driver fails on it with the pipeline on.
  • noteLabelStore takes the queue now (Raghav314 mentioned this one), and the draw commit no longer captures dataEntry.
  • New: a DMA_DATA that stores nothing (source not immediate, and zero bytes or no destination) keeps the pipeline. RADV emits one between most draws. Without this, Crazy Taxi drained about 14,000 times a second on opcode 0x50, 5 s of every 10 s on the queue worker.
  • Dispatch: the HTILE clear note and the memory value fill note drain first, as Raghav314 described.

Not done: the CB metadata pass in precheckDraw (Raghav314's report above) still runs ahead of queued draws, and I have not compared commitLabel / commitDmaStore line by line with main's current label code.

Results, Windows 11, NVIDIA GeForce RTX 5070 Ti, MinGW-w64 GCC 15.2:

  • The agc tests on that branch (453): with the pipeline off 452 pass and 1 is skipped. With APS5_PIPELINED_DRAWS=1 451 pass, 1 is skipped and agc_driver_pm4_failure fails, because it expects a synchronous rejection (#1202 runs it with the pipeline off). I did not run the rest of the suite on this branch.
  • Crazy Taxi attract demo in Flycast (needs local changes outside this PR to boot, so it is measured on main plus those): audio produced at 62 to 67% of real time without the pipeline, 80 to 87% with it (4 runs). Queue worker 16 µs per draw packet, committer 14 to 17 µs per commit, about 2,300 drains per 10 s left (dispatches and flips).

Two things from a narrower two-thread path I had been running locally, in case they are useful for the port:

  • The queue worker can run the shader validation memo and build the resource cache key before it enqueues, and hand both to the commit. It moved that work off the recording thread here; I have not measured it separately on the pipeline.
  • Anything that replaces a cached stage's compiled result in place has to be held by the queued commit, not just the variant. I hit a use-after-free of exactly that kind.

I'm not opening a PR from it, since the port is yours. Take anything from the branch that helps, and I'm happy to cross-test your port on this workload.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6137422913 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6137422913). Originally posted by [TheAggie](https://github.com/TheAggie) on 2026-10-13T03:17:44Z. --- @oneandonlydean @MichonGoddijn231849 a data point and an offer for the port, so we don't duplicate each other. I wanted the pipeline for a workload it hasn't been tried on (RetroArch's Flycast core, which renders through RADV on the PS5 GPU: about 2,700 small draws a frame, nearly all draw-cache hits), so I cherry-picked the original #1201 commit (`6fe6c40a7`, author kept) onto main `2a55cfe1e`. It took 10 conflicted files. Branch: [`perf/pipelined-draws-on-main`](https://github.com/TheAggie/AnyPS5/tree/perf/pipelined-draws-on-main) on my fork, three commits on main. What I changed on top of the cherry-pick: - Dropped the parts that aren't the pipeline and conflict with main: descriptor set recycling, the `BufferPool` size-class change, and the #1193 `ShaderMemory` page pool (main's `ShaderMemory` only needed a defaulted move constructor). - `enqueueLabelPacket` treated every nonzero `INT_SEL` as an end-of-pipe interrupt. Main excludes 3 (send data after write confirm), and `agc_driver` fails on it with the pipeline on. - `noteLabelStore` takes the queue now (Raghav314 mentioned this one), and the draw commit no longer captures `dataEntry`. - New: a `DMA_DATA` that stores nothing (source not immediate, and zero bytes or no destination) keeps the pipeline. RADV emits one between most draws. Without this, Crazy Taxi drained about 14,000 times a second on opcode 0x50, 5 s of every 10 s on the queue worker. - Dispatch: the HTILE clear note and the memory value fill note drain first, as Raghav314 described. Not done: the CB metadata pass in `precheckDraw` (Raghav314's report above) still runs ahead of queued draws, and I have not compared `commitLabel` / `commitDmaStore` line by line with main's current label code. Results, Windows 11, NVIDIA GeForce RTX 5070 Ti, MinGW-w64 GCC 15.2: - The `agc` tests on that branch (453): with the pipeline off 452 pass and 1 is skipped. With `APS5_PIPELINED_DRAWS=1` 451 pass, 1 is skipped and `agc_driver_pm4_failure` fails, because it expects a synchronous rejection (#1202 runs it with the pipeline off). I did not run the rest of the suite on this branch. - Crazy Taxi attract demo in Flycast (needs local changes outside this PR to boot, so it is measured on main plus those): audio produced at 62 to 67% of real time without the pipeline, 80 to 87% with it (4 runs). Queue worker 16 µs per draw packet, committer 14 to 17 µs per commit, about 2,300 drains per 10 s left (dispatches and flips). Two things from a narrower two-thread path I had been running locally, in case they are useful for the port: - The queue worker can run the shader validation memo and build the resource cache key before it enqueues, and hand both to the commit. It moved that work off the recording thread here; I have not measured it separately on the pipeline. - Anything that replaces a cached stage's compiled result in place has to be held by the queued commit, not just the variant. I hit a use-after-free of exactly that kind. I'm not opening a PR from it, since the port is yours. Take anything from the branch that helps, and I'm happy to cross-test your port on this workload. AI-assisted (Claude Code).
TideOPL commented 2026-10-13 10:02:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TideOPL on 2026-10-13T10:02:26Z.


Would you be able to rebase this onto current main?

On Minecraft Dungeons II (PPSA16064) gameplay (Windows 11, RTX 5070), queue 0 spends about 59 ms of a ~101 ms frame on draws:

  • about 30 ms recording them (Graphics::Draw under the GPU lock);
  • about 29 ms preparing them (capture and lookup ~17 ms, lock waits ~5 ms).

Overlapping the two halves looks like the biggest remaining win for that title. Merging the current head into a main-based build leaves conflicts in 21 files (the pipelining commit alone, 10), so I couldn't A/B it. Happy to test a rebased head.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6143102350 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6143102350). Originally posted by [TideOPL](https://github.com/TideOPL) on 2026-10-13T10:02:26Z. --- Would you be able to rebase this onto current `main`? On Minecraft Dungeons II (PPSA16064) gameplay (Windows 11, RTX 5070), queue 0 spends about 59 ms of a ~101 ms frame on draws: - about 30 ms recording them (`Graphics::Draw` under the GPU lock); - about 29 ms preparing them (capture and lookup ~17 ms, lock waits ~5 ms). Overlapping the two halves looks like the biggest remaining win for that title. Merging the current head into a main-based build leaves conflicts in 21 files (the pipelining commit alone, 10), so I couldn't A/B it. Happy to test a rebased head. AI-assisted (Claude Code).
gjonn commented 2026-10-13 13:26:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gjonn on 2026-10-13T13:26:13Z.


@TideOPL I rebased the five commits onto current main (6ac63bf0c): https://github.com/gjonn/AnyPS5/tree/rebase/pr-1201-pipelined-draws (head 077477553). I pushed it to my fork instead of force-pushing @MichonGoddijn231849's branch, so it can be A/B tested first. Michon can reset perf/pipelined-draws to it if it holds up.

Where main had changed the same code, I adapted the PR to it:

  • Draw decode: main made the decoder a free function with a static-ABI mode (DecodeGraphicsPrograms). The user-word re-read for data-only hits is now the free functions ReadUserWords and InitializeMerged, which take staticAbi.
  • Draw key: main's incremental RegisterStateKey already fingerprints every register except the user words and merged pointers. That fingerprint is now the shape key, through a new optional shapeKey out-parameter, in place of the PR's separate hashing loop.
  • Draw cache: eraseDrawEntry, which drops a draw whose unregistered program was rewritten, also drops the entry's shape mapping. A data-only hit is not taken from an entry whose programs are no longer current. The fragment's unexported-input defaults run before a stage compiles, as on main.
  • SRT evaluator: the templated evaluator now has main's null-root and inaccessible-read reporting, signed min/less-than, and zero for out-of-range constant-buffer reads. EvaluateRuntimeSourcesImpl passes poison and null-root counts to both walks.
  • Draw snapshots: main splits the bindings into a main set and a fragment set, so both are recycled per layout. Chain pools are reset as a whole and do not support freeing single sets, so a full recycle list now goes through DescriptorCache::Free instead of vkFreeDescriptorSets.
  • Packet worker: the PR's pipeline checks sit next to main's flip hold, the dispatch-ahead gate and landPendingWaits. A wait answered from the pipeline's pending labels opens the dispatch-ahead gate the way a real wait does. The pipeline drains before resolveGroupAhead, which reads guest memory. The drain before the copy kernel moved into the non-resolving dispatch branch.
  • releasedTails and the RegisteredReadableCovers memo use HostThreadLocal, as prx_thread_local_destructors requires. Label stores pass their queue to noteLabelStore, whose signature main changed.

It builds with MinGW in Release, and ctest passes 1073 of 1075. The two failures are agc_driver_pixel_ancillary_word and agc_driver_pixel_fixed_point_position, which main added after this PR was branched. Both draw into a linear target in arena memory, and the resident linear-target change (third commit) makes the next arena block fail the tests' "the color target is not write-watched" check. With APS5_NO_RESIDENT_LINEAR_TARGETS=1 they pass. That needs a look from the PR side before it merges. APS5_PIPELINED_DRAWS is still off by default, as in the original head, so turn it on for the A/B.

AI-assisted.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6146606861 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6146606861). Originally posted by [gjonn](https://github.com/gjonn) on 2026-10-13T13:26:13Z. --- @TideOPL I rebased the five commits onto current `main` (6ac63bf0c): https://github.com/gjonn/AnyPS5/tree/rebase/pr-1201-pipelined-draws (head 077477553). I pushed it to my fork instead of force-pushing @MichonGoddijn231849's branch, so it can be A/B tested first. Michon can reset `perf/pipelined-draws` to it if it holds up. Where `main` had changed the same code, I adapted the PR to it: - Draw decode: `main` made the decoder a free function with a static-ABI mode (`DecodeGraphicsPrograms`). The user-word re-read for data-only hits is now the free functions `ReadUserWords` and `InitializeMerged`, which take `staticAbi`. - Draw key: `main`'s incremental `RegisterStateKey` already fingerprints every register except the user words and merged pointers. That fingerprint is now the shape key, through a new optional `shapeKey` out-parameter, in place of the PR's separate hashing loop. - Draw cache: `eraseDrawEntry`, which drops a draw whose unregistered program was rewritten, also drops the entry's shape mapping. A data-only hit is not taken from an entry whose programs are no longer current. The fragment's unexported-input defaults run before a stage compiles, as on `main`. - SRT evaluator: the templated evaluator now has `main`'s null-root and inaccessible-read reporting, signed min/less-than, and zero for out-of-range constant-buffer reads. `EvaluateRuntimeSourcesImpl` passes poison and null-root counts to both walks. - Draw snapshots: `main` splits the bindings into a main set and a fragment set, so both are recycled per layout. Chain pools are reset as a whole and do not support freeing single sets, so a full recycle list now goes through `DescriptorCache::Free` instead of `vkFreeDescriptorSets`. - Packet worker: the PR's pipeline checks sit next to `main`'s flip hold, the dispatch-ahead gate and `landPendingWaits`. A wait answered from the pipeline's pending labels opens the dispatch-ahead gate the way a real wait does. The pipeline drains before `resolveGroupAhead`, which reads guest memory. The drain before the copy kernel moved into the non-resolving dispatch branch. - `releasedTails` and the `RegisteredReadableCovers` memo use `HostThreadLocal`, as `prx_thread_local_destructors` requires. Label stores pass their queue to `noteLabelStore`, whose signature `main` changed. It builds with MinGW in Release, and `ctest` passes 1073 of 1075. The two failures are `agc_driver_pixel_ancillary_word` and `agc_driver_pixel_fixed_point_position`, which `main` added after this PR was branched. Both draw into a linear target in arena memory, and the resident linear-target change (third commit) makes the next arena block fail the tests' "the color target is not write-watched" check. With `APS5_NO_RESIDENT_LINEAR_TARGETS=1` they pass. That needs a look from the PR side before it merges. `APS5_PIPELINED_DRAWS` is still off by default, as in the original head, so turn it on for the A/B. AI-assisted.
SleglJan commented 2026-10-13 15:09:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-13T15:09:15Z.

Code review location: core/libs/prx/libSceAgcDriver/Execution/src/Driver/Memory/WrittenBuffers.cpp; line 81

@@ -42,6 +58,70 @@ void Driver::noteDrawWriters(std::span<const Graphics::CompiledShader> stages, s
     }
 }
 
+bool ExactDrawWrites() {
+    static const bool exact = std::getenv("APS5_EXACT_DRAW_WRITES") != nullptr;
+    return exact;
+}
+
+std::vector<std::pair<std::uint64_t, std::uint64_t>> DrawWriteRanges(const Graphics::State& graphics, std::span<const Graphics::CompiledShader> stages, bool exact) {
+    constexpr std::uint64_t Slack = 64 * 1024;
+    constexpr std::uint64_t UnknownBytes = 64ull * 1024 * 1024;
+    std::vector<std::pair<std::uint64_t, std::uint64_t>> ranges;
+    const auto add = [&](std::uint64_t begin, std::uint64_t bytes) {
+        if (begin != 0) ranges.emplace_back(begin, begin + bytes);
+    };
+    for (const auto& stage : stages) {
+        if (stage.program == nullptr) continue;
+        visitWrittenBuffers(*stage.program, [&](std::uint32_t, std::uint64_t begin, std::uint64_t end, bool) { ranges.emplace_back(begin, end); });
+        for (const auto& binding : stage.program->bindings) {
+            if (binding.role != ShaderRecompiler::DescriptorRole::GuestImages || binding.kind != ShaderRecompiler::DescriptorKind::StorageImage) continue;
+            for (std::uint32_t element = 0; element < binding.count; ++element) {
+                const bool written = element >= binding.imageWritten.size() || binding.imageWritten[element];
+                if (!written || binding.guestDescriptor.size() < (static_cast<std::size_t>(element) + 1) * 8) continue;
+                const auto resource = Graphics::DecodeTextureResource(std::span<const std::uint32_t>(binding.guestDescriptor).subspan(static_cast<std::size_t>(element) * 8, 8));

Additions to your finding, from a stack where the same decode in #4724's appendWrittenRanges ended two 007 First Light runs, and where a unit test reproduces the throw in this walk:

  • The predicate in your fix is main's binder rule for storage elements (ShaderResources.cpp:3372 at 4008e68e3). It came with #639 (dccfa08de, merged 2026-10-08), after this PR's base; at 6fe6c40a7 the binder still decodes without it (ShaderResources.cpp:2657), so the difference appears once the branch is rebased past #639.
  • The rebase branch at 077477553 carries the binder's rule and still the unguarded decode (WrittenBuffers.cpp:85-86).
  • The port at 913a29b20 guards DispatchWriteRanges and DrawWriteRanges with IsNullTextureDescriptor, which by default treats only an all-zero descriptor as null (a zero base alone counts only under APS5_NULL_UNRESOLVED_IMAGES), while its binder keeps the rule (ShaderResources.cpp:3532), so a zero-base descriptor with non-zero remaining words still throws in the walks. #4779 would make the binder skip type-0 descriptors too, which a copied rule would still decode and throw on, so one shared predicate beats a copy.
  • The same decode in #4724's appendWrittenRanges ends the process when the ahead resolver reaches such a dispatch, since that call has no try around it: https://github.com/boykopovar/AnyPS5/pull/4724#issuecomment-6148352503.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:review-comment:4260402539 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#discussion_r4260402539). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-13T15:09:15Z. **Code review location:** `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Memory/WrittenBuffers.cpp`; line 81 ~~~~diff @@ -42,6 +58,70 @@ void Driver::noteDrawWriters(std::span<const Graphics::CompiledShader> stages, s } } +bool ExactDrawWrites() { + static const bool exact = std::getenv("APS5_EXACT_DRAW_WRITES") != nullptr; + return exact; +} + +std::vector<std::pair<std::uint64_t, std::uint64_t>> DrawWriteRanges(const Graphics::State& graphics, std::span<const Graphics::CompiledShader> stages, bool exact) { + constexpr std::uint64_t Slack = 64 * 1024; + constexpr std::uint64_t UnknownBytes = 64ull * 1024 * 1024; + std::vector<std::pair<std::uint64_t, std::uint64_t>> ranges; + const auto add = [&](std::uint64_t begin, std::uint64_t bytes) { + if (begin != 0) ranges.emplace_back(begin, begin + bytes); + }; + for (const auto& stage : stages) { + if (stage.program == nullptr) continue; + visitWrittenBuffers(*stage.program, [&](std::uint32_t, std::uint64_t begin, std::uint64_t end, bool) { ranges.emplace_back(begin, end); }); + for (const auto& binding : stage.program->bindings) { + if (binding.role != ShaderRecompiler::DescriptorRole::GuestImages || binding.kind != ShaderRecompiler::DescriptorKind::StorageImage) continue; + for (std::uint32_t element = 0; element < binding.count; ++element) { + const bool written = element >= binding.imageWritten.size() || binding.imageWritten[element]; + if (!written || binding.guestDescriptor.size() < (static_cast<std::size_t>(element) + 1) * 8) continue; + const auto resource = Graphics::DecodeTextureResource(std::span<const std::uint32_t>(binding.guestDescriptor).subspan(static_cast<std::size_t>(element) * 8, 8)); ~~~~ --- Additions to your finding, from a stack where the same decode in #4724's `appendWrittenRanges` ended two 007 First Light runs, and where a unit test reproduces the throw in this walk: - The predicate in your fix is main's binder rule for storage elements (`ShaderResources.cpp:3372` at 4008e68e3). It came with #639 (dccfa08de, merged 2026-10-08), after this PR's base; at 6fe6c40a7 the binder still decodes without it (`ShaderResources.cpp:2657`), so the difference appears once the branch is rebased past #639. - The rebase branch at 077477553 carries the binder's rule and still the unguarded decode (`WrittenBuffers.cpp:85-86`). - The port at 913a29b20 guards `DispatchWriteRanges` and `DrawWriteRanges` with `IsNullTextureDescriptor`, which by default treats only an all-zero descriptor as null (a zero base alone counts only under `APS5_NULL_UNRESOLVED_IMAGES`), while its binder keeps the rule (`ShaderResources.cpp:3532`), so a zero-base descriptor with non-zero remaining words still throws in the walks. #4779 would make the binder skip type-0 descriptors too, which a copied rule would still decode and throw on, so one shared predicate beats a copy. - The same decode in #4724's `appendWrittenRanges` ends the process when the ahead resolver reaches such a dispatch, since that call has no `try` around it: https://github.com/boykopovar/AnyPS5/pull/4724#issuecomment-6148352503. AI-assisted: yes (Claude Code).
MichonGoddijn231849 commented 2026-10-13 15:45:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-13T15:45:45Z.


Rebased onto current main (a56c905df), starting from @gjonn's rebase (thanks, it saved a lot of work; you're co-author on the rebased commits). The series is now #494 → #1191 → #1193 → #1201, each PR its own commits on top of the previous one.

  • @gjonn the two failures you found (agc_driver_pixel_ancillary_word, agc_driver_pixel_fixed_point_position) come from main's write-watch coverage: the resident linear target's host import unwatches a whole 64 KiB block, and a later sub-block allocation there is never watched again. Resident linear targets (#1191) are now opt-in, APS5_RESIDENT_LINEAR_TARGETS=1, so the default matches main. The full agc_* suite passes on Windows (483, 1 skipped).
  • @gjonn @SleglJan the null storage image in DrawWriteRanges is fixed in its own commit with the binder's rule (base address words zero) and a null T# case in agc_driver_draw_write_ranges. main writes that rule inline in each binder path, so I used the same rule rather than a new shared predicate here; a shared one is a good follow-up for main itself.
  • @TheAggie your INT_SEL 3 finding is in (own commit, co-author). With APS5_PIPELINED_DRAWS=1 only agc_driver_pm4_failure fails, as you saw. I haven't taken the empty DMA_DATA change yet; it belongs with the DMA commit items in #1202, which I'm porting next.
  • @Raghav314 the CB metadata pass in precheckDraw still runs ahead of queued draws. That's still owed, as a commit item or drain before it lands.
  • @TideOPL this head is ready for your A/B: the pipeline is still off by default here, so set APS5_PIPELINED_DRAWS=1.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6149413065 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6149413065). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-13T15:45:45Z. --- Rebased onto current `main` (a56c905df), starting from @gjonn's rebase (thanks, it saved a lot of work; you're co-author on the rebased commits). The series is now #494 → #1191 → #1193 → #1201, each PR its own commits on top of the previous one. - @gjonn the two failures you found (`agc_driver_pixel_ancillary_word`, `agc_driver_pixel_fixed_point_position`) come from main's write-watch coverage: the resident linear target's host import unwatches a whole 64 KiB block, and a later sub-block allocation there is never watched again. Resident linear targets (#1191) are now opt-in, `APS5_RESIDENT_LINEAR_TARGETS=1`, so the default matches `main`. The full `agc_*` suite passes on Windows (483, 1 skipped). - @gjonn @SleglJan the null storage image in `DrawWriteRanges` is fixed in its own commit with the binder's rule (base address words zero) and a null T# case in `agc_driver_draw_write_ranges`. `main` writes that rule inline in each binder path, so I used the same rule rather than a new shared predicate here; a shared one is a good follow-up for `main` itself. - @TheAggie your `INT_SEL` 3 finding is in (own commit, co-author). With `APS5_PIPELINED_DRAWS=1` only `agc_driver_pm4_failure` fails, as you saw. I haven't taken the empty `DMA_DATA` change yet; it belongs with the DMA commit items in #1202, which I'm porting next. - @Raghav314 the CB metadata pass in `precheckDraw` still runs ahead of queued draws. That's still owed, as a commit item or drain before it lands. - @TideOPL this head is ready for your A/B: the pipeline is still off by default here, so set `APS5_PIPELINED_DRAWS=1`.
Raghav314 commented 2026-10-14 13:33:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-14T13:33:50Z.


The CB metadata pass is on a branch now, as commits on top of this head (31c9a0f2e) so you can cherry-pick them: https://github.com/Raghav314/AnyPS5/commits/fix/1201-ordering-drains

  • c50e23120 fix(agc): a CB metadata pass drains the draw pipeline before it runs (the one that was owed; it fixes the 4x flicker I saw)
  • a9c15be3e fix(agc): entry validation drains queued draws that write its runs (a capture already drains first, validateVariant did not)
  • 41f385acb fix(agc): note an HTILE depth clear after the pipeline drain (NoteHtileDepthClear ran ahead of the queue-0 drain in Driver::dispatch)
  • e19e113b0 fix(agc): include HostThreadLocal outside the Windows block in GuestBufferMemory (this head doesn't build on Linux without it: 9c2ddf3a8 uses HostThreadLocal there, but the include sits under #ifdef _WIN32)

I ran the branch on my machine (Linux, CachyOS, GCC, RTX 4090): the full ctest passes, 1071 of 1071. With APS5_PIPELINED_DRAWS=1 the agc_* suite has agc_driver_pm4_failure failing ("pipelined commit failed: guest memory is not readable at 0x1000", so the rejection lands on the committer instead of the submit) and agc_driver_pixel_lds failing in some runs with a lost device (vkWaitForFences -4); both fail the same way on 31c9a0f2e without these commits. In Hades II with the same drains on main 98541c674 (plus #494, #1193, #1202 and #5687), a hub run with all the APS5_VERIFY_* switches shows no differing stages and the flicker is gone.

One more for the next rebase: the memory-value fill from #4603 (on main, not in this head yet) reads the fill value on the worker while the label store that writes it can still be queued. agc_driver_memory_value_fill failed in 2 of 3 runs here with the pipeline on, and passes 20 of 20 with a drain before the read in fillBuffer:

} else if (memoryFill) {
    if (queueId == 0 && DrawPipeline::Active() && (DrawPipeline::Queue0().Overlaps(memoryFill->valueAddress, 4) || DrawPipeline::Queue0().PendingLabel(memoryFill->valueAddress, 4))) DrawPipeline::Queue0().Drain(DrawPipeline::DrainReason::Labels, 0x15);

LLM assistance used.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6169587194 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6169587194). Originally posted by [Raghav314](https://github.com/Raghav314) on 2026-10-14T13:33:50Z. --- The CB metadata pass is on a branch now, as commits on top of this head (31c9a0f2e) so you can cherry-pick them: https://github.com/Raghav314/AnyPS5/commits/fix/1201-ordering-drains - `c50e23120` fix(agc): a CB metadata pass drains the draw pipeline before it runs (the one that was owed; it fixes the 4x flicker I saw) - `a9c15be3e` fix(agc): entry validation drains queued draws that write its runs (a capture already drains first, `validateVariant` did not) - `41f385acb` fix(agc): note an HTILE depth clear after the pipeline drain (`NoteHtileDepthClear` ran ahead of the queue-0 drain in `Driver::dispatch`) - `e19e113b0` fix(agc): include HostThreadLocal outside the Windows block in GuestBufferMemory (this head doesn't build on Linux without it: 9c2ddf3a8 uses `HostThreadLocal` there, but the include sits under `#ifdef _WIN32`) I ran the branch on my machine (Linux, CachyOS, GCC, RTX 4090): the full ctest passes, 1071 of 1071. With `APS5_PIPELINED_DRAWS=1` the `agc_*` suite has `agc_driver_pm4_failure` failing ("pipelined commit failed: guest memory is not readable at 0x1000", so the rejection lands on the committer instead of the submit) and `agc_driver_pixel_lds` failing in some runs with a lost device (`vkWaitForFences` -4); both fail the same way on 31c9a0f2e without these commits. In Hades II with the same drains on `main` 98541c674 (plus #494, #1193, #1202 and #5687), a hub run with all the `APS5_VERIFY_*` switches shows no differing stages and the flicker is gone. One more for the next rebase: the memory-value fill from #4603 (on `main`, not in this head yet) reads the fill value on the worker while the label store that writes it can still be queued. `agc_driver_memory_value_fill` failed in 2 of 3 runs here with the pipeline on, and passes 20 of 20 with a drain before the read in `fillBuffer`: ```cpp } else if (memoryFill) { if (queueId == 0 && DrawPipeline::Active() && (DrawPipeline::Queue0().Overlaps(memoryFill->valueAddress, 4) || DrawPipeline::Queue0().PendingLabel(memoryFill->valueAddress, 4))) DrawPipeline::Queue0().Drain(DrawPipeline::DrainReason::Labels, 0x15); ``` LLM assistance used.
SoRadGaming commented 2026-10-14 14:16:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SoRadGaming on 2026-10-14T14:16:57Z.


A/B on Windows with an AMD GPU: ASTRO BOT (PPSA21564 01.007.000), -lvl hub_crashsite (the full hub), no input, no profiler, warm shader and pipeline caches. FPS comes from the window's present counter over 120 s, after a 120 s settle once Level has started: hub_crashsite is logged.

Host: Windows 11 Pro 26200, Ryzen 7 5800X3D, Radeon RX 9070 XT (driver 32.0.23033.1002), 32 GB, WinLibs GCC 15.2.0, Release.

The base is main a3aeaf884 + #5671 + #5679 + #5707 + revert of #5596 (its comparison cost, #5692) + #5640, with APS5_NO_SNAPSHOT_CHECK=1 APS5_RESOURCE_CACHE_ENTRIES=4096. The change is this PR's head (31c9a0f2e) merged into that base, with APS5_PIPELINED_DRAWS=1.

hub FPS 10 s samples
base 3.05 3.0-3.1
base + a 2048-entry recompile result memo (control) 2.95 2.9-3.1
base + memo + this PR 4.86 (repeats: 4.88, 4.93, 5.01) 4.7-5.1
the same + @Raghav314's fix/1201-ordering-drains (c50e23120, a9c15be3e, 41f385acb, e19e113b0) + the memory-value fill drain above 4.89 4.8-5.1

In this scene queue 0 is the limit. Profiled, the base spends ~130 us per draw packet over ~2,200 draws per present, with the GPU busy about half the time. With the pipeline the worker takes ~72 us per packet (capture 32, recompile 12, decode 10) and the committer ~48 us per commit. The worker still waits ~8 us per draw for room at depth 8, and there are ~3,500 packet drains per 10 s, most on DISPATCH_DIRECT.

Startup throw: 2 of the first 11 pipelined launches stopped at their first presents, before the hub loaded, with [videoout] presentation failed: AGC graphics: a CMASK fast clear of a DCC color target, whose clear belongs in its DCC keys, was recorded. One run had the CPU frame dump on (APS5_NO_GPU_DUMP=1) and one had no dump settings at all. That comes from requireCmaskCodes(detiler->CmaskErrors()) in materializeCmaskClear. 16 later launches without the drains did not throw, nor did 16 with them. So the rate is low (2 in ~27 without), and 16 clean launches with c50e23120 do not show that it fixes this. It does look like the CB metadata ordering it addresses. The base never threw.

Two things broke in the merge with main a3aeaf884 and may hit the rebase:

  • ShaderDiskCache.cpp asserts fieldCount<IrResourcePlan>() == 21 on main, and denseValueIds and compact make it 23. Neither field is encoded, so a plan loaded from the disk cache comes back without the compact table and takes the old walk. Locally I rebuild it after DecodePlan (denseValueIds = true; buildCompactPlan(plan), which drops the table again if an id does not match). A counter showed 1,024 of 1,047 cached plans got the table, and the rest were empty plans.
  • In BufferFill.cpp the store lambda must capture memoryFill, which main uses inside it since #4603.

Hub frame captures (APS5_DUMP_FRAMES, GPU readback) match between base and change. A 30-minute boot → title → NEW GAME → intro run with the pipeline on did not throw. Not tested: the full test suite on this merge.

AI-assisted (Claude Code); the builds and runs are on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6170476659 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6170476659). Originally posted by [SoRadGaming](https://github.com/SoRadGaming) on 2026-10-14T14:16:57Z. --- A/B on Windows with an AMD GPU: ASTRO BOT (PPSA21564 01.007.000), `-lvl hub_crashsite` (the full hub), no input, no profiler, warm shader and pipeline caches. FPS comes from the window's present counter over 120 s, after a 120 s settle once `Level has started: hub_crashsite` is logged. Host: Windows 11 Pro 26200, Ryzen 7 5800X3D, Radeon RX 9070 XT (driver 32.0.23033.1002), 32 GB, WinLibs GCC 15.2.0, Release. The base is `main` a3aeaf884 + #5671 + #5679 + #5707 + revert of #5596 (its comparison cost, #5692) + #5640, with `APS5_NO_SNAPSHOT_CHECK=1 APS5_RESOURCE_CACHE_ENTRIES=4096`. The change is this PR's head (31c9a0f2e) merged into that base, with `APS5_PIPELINED_DRAWS=1`. | | hub FPS | 10 s samples | |---|---|---| | base | 3.05 | 3.0-3.1 | | base + a 2048-entry recompile result memo (control) | 2.95 | 2.9-3.1 | | base + memo + this PR | **4.86** (repeats: 4.88, 4.93, 5.01) | 4.7-5.1 | | the same + @Raghav314's `fix/1201-ordering-drains` (c50e23120, a9c15be3e, 41f385acb, e19e113b0) + the memory-value fill drain above | 4.89 | 4.8-5.1 | In this scene queue 0 is the limit. Profiled, the base spends ~130 us per draw packet over ~2,200 draws per present, with the GPU busy about half the time. With the pipeline the worker takes ~72 us per packet (capture 32, recompile 12, decode 10) and the committer ~48 us per commit. The worker still waits ~8 us per draw for room at depth 8, and there are ~3,500 packet drains per 10 s, most on DISPATCH_DIRECT. Startup throw: 2 of the first 11 pipelined launches stopped at their first presents, before the hub loaded, with `[videoout] presentation failed: AGC graphics: a CMASK fast clear of a DCC color target, whose clear belongs in its DCC keys, was recorded`. One run had the CPU frame dump on (`APS5_NO_GPU_DUMP=1`) and one had no dump settings at all. That comes from `requireCmaskCodes(detiler->CmaskErrors())` in `materializeCmaskClear`. 16 later launches without the drains did not throw, nor did 16 with them. So the rate is low (2 in ~27 without), and 16 clean launches with c50e23120 do not show that it fixes this. It does look like the CB metadata ordering it addresses. The base never threw. Two things broke in the merge with `main` a3aeaf884 and may hit the rebase: - `ShaderDiskCache.cpp` asserts `fieldCount<IrResourcePlan>() == 21` on `main`, and `denseValueIds` and `compact` make it 23. Neither field is encoded, so a plan loaded from the disk cache comes back without the compact table and takes the old walk. Locally I rebuild it after `DecodePlan` (`denseValueIds = true; buildCompactPlan(plan)`, which drops the table again if an id does not match). A counter showed 1,024 of 1,047 cached plans got the table, and the rest were empty plans. - In `BufferFill.cpp` the `store` lambda must capture `memoryFill`, which `main` uses inside it since #4603. Hub frame captures (`APS5_DUMP_FRAMES`, GPU readback) match between base and change. A 30-minute boot → title → NEW GAME → intro run with the pipeline on did not throw. Not tested: the full test suite on this merge. AI-assisted (Claude Code); the builds and runs are on my machine.
eliyarson commented 2026-10-14 17:01:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by eliyarson on 2026-10-14T17:01:46Z.


Hades II hub numbers for this branch, and three ordering cases in the pipelined path that I found while comparing it with the threaded-recording change in #5485.

Setup. raghav-1201-drains (this head 31c9a0f2e plus @Raghav314's four commits, e19e113b0), Release, Linux (CachyOS), Ryzen 9 5950X, RTX 3080 Ti, NVIDIA 610.57.04. Hades II hub, warm caches, no profiling variables set. FPS is the mean of the window-title readings over a 60 s hold after the hub settles, three runs per arm, interleaved with the arms of #5485 so drift is spread across all of them:

Build Runs Mean
this branch, flag off 34.46, 36.67, 36.83 36.0
this branch, APS5_PIPELINED_DRAWS=1 56.88, 59.85, 56.37 57.7
#5485 (on a much newer main), flag off 33.89, 33.98, 34.34 34.1
#5485, APS5_MT_RECORD=1 53.48, 51.84, 51.39 52.2

The pipelined runs had no crashes and no pipelined commit failed lines. Frames dumped every 60th present looked the same as the flag-off run; that sampling would not catch a flicker on a minority of frames. The bases differ by about 800 commits, so the flag-off rows are not a controlled comparison; each flag's gain over its own flag-off row is (+21.7 here, +18.1 for #5485). With APS5_PROFILE_DRAW=1 set (and #5485's APS5_DRAW_PREPARE_AHEAD=2, which this branch ignores), both builds lose several FPS, this one less than #5485.

Given that, I'd rather help this land than push #5485 as a competing design. The cases below are from reading the code at e19e113b0; I have not reproduced them in a test yet.

  1. Predicated draws read the predicate without draining. A predicated draw is on the keep list, so it doesn't drain, and then Pm4::PredicationPasses reads predication.address (PacketExecution.cpp around line 197, Pm4.cpp:554). recordQueuedLabelsBeforeRead only records the worker's own deferred labels. Sequence: SET_PREDICATION on P, WRITE_DATA P=1 (queued as a label commit), predicated DRAW: the worker reads the old P. A drain when Busy() && (Overlaps(P, bytes) || PendingLabel(P, bytes)) before the check would cover it.
  2. The pattern-fill kernel reads its control and source words without draining. 0x15 stays in the pipeline, and fillBuffer reads range->control and range->source under the GPU lock (BufferFill.cpp:160-170) with no Overlaps/PendingLabel check. It's the same shape as the memory-value fill @Raghav314 found for #4603, but for the pattern fill that is already on this branch. The drain has to come before inputLock.lock(), since Drain refuses to run under the GPU lock.
  3. A queued label can land before an older deferred one. enqueueLabelPacket doesn't check deferredLabels().labels.empty(), while enqueueDmaPacket and the draw path do (PacketMemory.cpp:318 vs :254). A predicated WRITE_DATA X=1 is never enqueued, so it is deferred on the worker. A following unpredicated WRITE_DATA X=2 is enqueued and committed, and the deferred X=1 is recorded later, so X ends as 1. The same labels.empty() guard would make it drain and keep the order.

Smaller: DrawWriteRanges doesn't add color.cmaskAddress, while a draw commit can write CMASK through refreshResidentTarget → materializeCmaskClear. The worker-side metadata passes drain anyway, so I expect little impact.

#5485 has a per-job write checker (APS5_MT_RECORD_CHECK=1): it records what each job actually wrote and compares that with the ranges published for it. Around (*commit)() in DrawPipeline::run it would map onto items.front().writes directly. On this base the write observer hooks would need porting with it. I can send any of the three fixes with a unit test each, and the checker, as commits on top of this head like @Raghav314 did, if that helps.

LLM assistance used.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6173787827 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6173787827). Originally posted by [eliyarson](https://github.com/eliyarson) on 2026-10-14T17:01:46Z. --- Hades II hub numbers for this branch, and three ordering cases in the pipelined path that I found while comparing it with the threaded-recording change in #5485. **Setup.** `raghav-1201-drains` (this head 31c9a0f2e plus @Raghav314's four commits, e19e113b0), Release, Linux (CachyOS), Ryzen 9 5950X, RTX 3080 Ti, NVIDIA 610.57.04. Hades II hub, warm caches, no profiling variables set. FPS is the mean of the window-title readings over a 60 s hold after the hub settles, three runs per arm, interleaved with the arms of #5485 so drift is spread across all of them: | Build | Runs | Mean | | --- | --- | --- | | this branch, flag off | 34.46, 36.67, 36.83 | 36.0 | | this branch, `APS5_PIPELINED_DRAWS=1` | 56.88, 59.85, 56.37 | 57.7 | | #5485 (on a much newer `main`), flag off | 33.89, 33.98, 34.34 | 34.1 | | #5485, `APS5_MT_RECORD=1` | 53.48, 51.84, 51.39 | 52.2 | The pipelined runs had no crashes and no `pipelined commit failed` lines. Frames dumped every 60th present looked the same as the flag-off run; that sampling would not catch a flicker on a minority of frames. The bases differ by about 800 commits, so the flag-off rows are not a controlled comparison; each flag's gain over its own flag-off row is (+21.7 here, +18.1 for #5485). With `APS5_PROFILE_DRAW=1` set (and #5485's `APS5_DRAW_PREPARE_AHEAD=2`, which this branch ignores), both builds lose several FPS, this one less than #5485. Given that, I'd rather help this land than push #5485 as a competing design. The cases below are from reading the code at e19e113b0; I have not reproduced them in a test yet. 1. **Predicated draws read the predicate without draining.** A predicated draw is on the keep list, so it doesn't drain, and then `Pm4::PredicationPasses` reads `predication.address` (`PacketExecution.cpp` around line 197, `Pm4.cpp:554`). `recordQueuedLabelsBeforeRead` only records the worker's own deferred labels. Sequence: SET_PREDICATION on P, WRITE_DATA P=1 (queued as a label commit), predicated DRAW: the worker reads the old P. A drain when `Busy() && (Overlaps(P, bytes) || PendingLabel(P, bytes))` before the check would cover it. 2. **The pattern-fill kernel reads its control and source words without draining.** 0x15 stays in the pipeline, and `fillBuffer` reads `range->control` and `range->source` under the GPU lock (`BufferFill.cpp:160-170`) with no `Overlaps`/`PendingLabel` check. It's the same shape as the memory-value fill @Raghav314 found for #4603, but for the pattern fill that is already on this branch. The drain has to come before `inputLock.lock()`, since `Drain` refuses to run under the GPU lock. 3. **A queued label can land before an older deferred one.** `enqueueLabelPacket` doesn't check `deferredLabels().labels.empty()`, while `enqueueDmaPacket` and the draw path do (`PacketMemory.cpp:318` vs `:254`). A predicated WRITE_DATA X=1 is never enqueued, so it is deferred on the worker. A following unpredicated WRITE_DATA X=2 is enqueued and committed, and the deferred X=1 is recorded later, so X ends as 1. The same `labels.empty()` guard would make it drain and keep the order. Smaller: `DrawWriteRanges` doesn't add `color.cmaskAddress`, while a draw commit can write CMASK through `refreshResidentTarget → materializeCmaskClear`. The worker-side metadata passes drain anyway, so I expect little impact. #5485 has a per-job write checker (`APS5_MT_RECORD_CHECK=1`): it records what each job actually wrote and compares that with the ranges published for it. Around `(*commit)()` in `DrawPipeline::run` it would map onto `items.front().writes` directly. On this base the write observer hooks would need porting with it. I can send any of the three fixes with a unit test each, and the checker, as commits on top of this head like @Raghav314 did, if that helps. LLM assistance used.
eliyarson commented 2026-10-14 20:04:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by eliyarson on 2026-10-14T20:04:25Z.


Fixes for cases 1 and 3 from my earlier comment are on a branch, as commits on top of this head (31c9a0f2e) so you can cherry-pick them: https://github.com/eliyarson/AnyPS5/commits/fix/1201-predication-label-order

  • 56b94480b fix(agc): a predicated packet drains queued writes to its predicate before reading it (case 1)
  • 1f894c9b6 fix(agc): a label packet behind a deferred label is not enqueued ahead of it (case 3: the deferredLabels().labels.empty() guard that enqueueDmaPacket and the draw path already have)

Each comes with a test that sets APS5_PIPELINED_DRAWS=1 itself: agc_driver_pipelined_predication_read (Vulkan; checks P 0 -> 1 runs the fill and P 1 -> 0 skips it) and agc_driver_pipelined_predicated_label_order (no Vulkan). Each failed 30 of 30 runs without its fix and passed 30 of 30 with it.

Built on top of @Raghav314's e19e113b0 for Linux, Ryzen 9 5950X, RTX 3080 Ti. With the flag unset, ^agc_ passes 487 of 487. With APS5_PIPELINED_DRAWS=1, agc_driver_pm4_failure fails as on this head, and agc_driver_pattern_buffer_fill fails in some runs both with and without these commits; that is case 2, which @oneandonlydean's c653e9ea1 on #1202 covers. Both commits also apply cleanly on c653e9ea1, and the new tests pass there.

A correction to case 1: I suspected COND_EXEC and SET_PREDICATION too, but they aren't on the keep list, so they already drain before reading. Only predicated packets that stay in the pipeline needed the check. The check runs only for predicated packets while the pipeline is busy, and drains only when a queued item writes the predicate's bytes.

CMASK in DrawWriteRanges and the write checker are still open; I can send those the same way if you want them.

LLM assistance used.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6177243069 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6177243069). Originally posted by [eliyarson](https://github.com/eliyarson) on 2026-10-14T20:04:25Z. --- Fixes for cases 1 and 3 from my earlier comment are on a branch, as commits on top of this head (31c9a0f2e) so you can cherry-pick them: https://github.com/eliyarson/AnyPS5/commits/fix/1201-predication-label-order - `56b94480b` fix(agc): a predicated packet drains queued writes to its predicate before reading it (case 1) - `1f894c9b6` fix(agc): a label packet behind a deferred label is not enqueued ahead of it (case 3: the `deferredLabels().labels.empty()` guard that `enqueueDmaPacket` and the draw path already have) Each comes with a test that sets `APS5_PIPELINED_DRAWS=1` itself: `agc_driver_pipelined_predication_read` (Vulkan; checks P 0 -> 1 runs the fill and P 1 -> 0 skips it) and `agc_driver_pipelined_predicated_label_order` (no Vulkan). Each failed 30 of 30 runs without its fix and passed 30 of 30 with it. Built on top of @Raghav314's e19e113b0 for Linux, Ryzen 9 5950X, RTX 3080 Ti. With the flag unset, `^agc_` passes 487 of 487. With `APS5_PIPELINED_DRAWS=1`, `agc_driver_pm4_failure` fails as on this head, and `agc_driver_pattern_buffer_fill` fails in some runs both with and without these commits; that is case 2, which @oneandonlydean's c653e9ea1 on #1202 covers. Both commits also apply cleanly on c653e9ea1, and the new tests pass there. A correction to case 1: I suspected COND_EXEC and SET_PREDICATION too, but they aren't on the keep list, so they already drain before reading. Only predicated packets that stay in the pipeline needed the check. The check runs only for predicated packets while the pipeline is busy, and drains only when a queued item writes the predicate's bytes. CMASK in `DrawWriteRanges` and the write checker are still open; I can send those the same way if you want them. LLM assistance used.
github-actions[bot] commented 2026-10-15 03:31:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T03:31:18Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#5115 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp L17
#5480 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cpp L11
#6208 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawPipeline.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Memory/DrawWriteRanges.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/SlimMutex.hpp
core/libs/prx/libSceAgcDriver/tests/execution/DrawWriteRanges.cpp
core/libs/prx/libSceAgcDriver/tests/execution/PipelinedDma.cpp
#6292 core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp L1071-1072, L1157-1158, L1196
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp L3, L1193
core/libs/prx/libSceAgcDriver/Graphics/src/UnitShadow.cpp L100
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6183760045 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6183760045). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T03:31:18Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #5115 | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp` [L17](https://github.com/boykopovar/AnyPS5/blob/2848b55b92c41bfeb080f6aebe7cc4cd8151e57b/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp#L17) | | | | #5480 | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cpp` [L11](https://github.com/boykopovar/AnyPS5/blob/2848b55b92c41bfeb080f6aebe7cc4cd8151e57b/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cpp#L11) | | | | #6208 | | | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawPipeline.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Memory/DrawWriteRanges.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/SlimMutex.hpp`<br>`core/libs/prx/libSceAgcDriver/tests/execution/DrawWriteRanges.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/execution/PipelinedDma.cpp` | | #6292 | `core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp` [L1071-1072](https://github.com/boykopovar/AnyPS5/blob/2848b55b92c41bfeb080f6aebe7cc4cd8151e57b/core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp#L1071-L1072), [L1157-1158](https://github.com/boykopovar/AnyPS5/blob/2848b55b92c41bfeb080f6aebe7cc4cd8151e57b/core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp#L1157-L1158), [L1196](https://github.com/boykopovar/AnyPS5/blob/2848b55b92c41bfeb080f6aebe7cc4cd8151e57b/core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp#L1196)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` [L3](https://github.com/boykopovar/AnyPS5/blob/2848b55b92c41bfeb080f6aebe7cc4cd8151e57b/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp#L3), [L1193](https://github.com/boykopovar/AnyPS5/blob/2848b55b92c41bfeb080f6aebe7cc4cd8151e57b/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp#L1193)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/UnitShadow.cpp` [L100](https://github.com/boykopovar/AnyPS5/blob/2848b55b92c41bfeb080f6aebe7cc4cd8151e57b/core/libs/prx/libSceAgcDriver/Graphics/src/UnitShadow.cpp#L100) | | |
adriadam10 commented 2026-10-15 09:40:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T09:40:38Z.


Rebased onto main (no merge commits; backup of 31c9a0f2e at adriadam10/AnyPS5:backup/MichonGoddijn231849-perf-pipelined-draws) and folded in the fixes from this thread, plus what the tests turned up with the pipeline on. The branch no longer sits on #1191 (#494 and #1193 are on main, and the pipeline doesn't need #1191's resident images). Default stays off (APS5_PIPELINED_DRAWS unset = today's inline path). #6203 was a byte-identical copy and is closed in favour of this one.

Picked from the threads (cherry-picked with -x, authors kept):

  • @Raghav314: CB metadata pass drains the pipeline first (c50e23120c), entry validation drains queued draws that write its runs (a9c15be3e1), HTILE depth clear noted after the drain (41f385acbf, conflict with main's 2-argument NoteHtileDepthClear resolved keeping main's version, moved after the drain).
  • @eliyarson: predicated packets drain writes to their predicate (56b94480b3); a label behind a deferred label is not enqueued ahead of it (1f894c9b64).
  • @oneandonlydean: fill inputs read after queued writes, no wait for room under the GPU lock (c653e9ea1d).

Found here and fixed:

  • BufferPool.cpp back to main's: the PR dropped the erase of an emptied size class, so evictOldest hit a dangling class (double free in agc_buffer_pool, segfault in agc_driver_graphics).
  • A pipelined commit captured raw pointers to the draw's stage-data hits and freshly materialized stages, freed when the worker returned (after main's stage-data hits); the commit now owns them (agc_driver_draw_cache_reuse aborted with the pipeline on).
  • A failed pipelined commit now stops queue 0 and goes through Driver::ReportFailure like a failed worker (except ProcessShutdown), instead of a log line; later commits are skipped. Without it agc_driver_pm4_failure hangs with the pipeline on.
  • Committer rethrows std::exception like the inline draw path.
  • After #1193 ShaderMemory is neither copyable nor movable; the draw holds it in a unique_ptr so the pipelined commit can own it.
  • Queued draw write ranges include the color target's CMASK (exact and estimated).
  • Memory-value fill (4 bytes at valueAddress) and buffer-pattern source drain queued writes before reading; the inputLock release moved into fillBuffer since main split out storeBufferFill.
  • ARCHITECTURE.md: a paragraph on the queue-0 draw pipeline.

New tests (each check proven by mutating the fix and seeing it fail): agc_driver_pm4_failure_pipelined (times out without ReportFailure), agc_driver_draw_cache_reuse_pipelined (aborts without the stage capture), CMASK rows in agc_driver_draw_write_ranges.

Local results (Linux, Radeon 660M, RADV, ANYPS5_ENABLE_SPIRV_TOOLS=ON), ctest -R 'agc|shader':

  • pipeline off: 594/595
  • pipeline on (APS5_PIPELINED_DRAWS=1 APS5_EXACT_DRAW_WRITES=1): 594/595
  • stress, pipeline on, --repeat until-fail:20 over the pipelined/fill/predication/label/draw-cache/failure tests: 16 tests x 20, all passed

The only failure, agc_driver_tessellation, segfaults on main too on this GPU. Windows full build dispatched next; merging with the pipeline off once it is green. #1202 (on by default) stays held on its open blockers.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6189118381 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6189118381). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-15T09:40:38Z. --- Rebased onto main (no merge commits; backup of 31c9a0f2e at `adriadam10/AnyPS5:backup/MichonGoddijn231849-perf-pipelined-draws`) and folded in the fixes from this thread, plus what the tests turned up with the pipeline on. The branch no longer sits on #1191 (#494 and #1193 are on main, and the pipeline doesn't need #1191's resident images). Default stays off (`APS5_PIPELINED_DRAWS` unset = today's inline path). #6203 was a byte-identical copy and is closed in favour of this one. Picked from the threads (cherry-picked with `-x`, authors kept): - @Raghav314: CB metadata pass drains the pipeline first (c50e23120c), entry validation drains queued draws that write its runs (a9c15be3e1), HTILE depth clear noted after the drain (41f385acbf, conflict with main's 2-argument `NoteHtileDepthClear` resolved keeping main's version, moved after the drain). - @eliyarson: predicated packets drain writes to their predicate (56b94480b3); a label behind a deferred label is not enqueued ahead of it (1f894c9b64). - @oneandonlydean: fill inputs read after queued writes, no wait for room under the GPU lock (c653e9ea1d). Found here and fixed: - `BufferPool.cpp` back to main's: the PR dropped the erase of an emptied size class, so `evictOldest` hit a dangling class (double free in `agc_buffer_pool`, segfault in `agc_driver_graphics`). - A pipelined commit captured raw pointers to the draw's stage-data hits and freshly materialized stages, freed when the worker returned (after main's stage-data hits); the commit now owns them (`agc_driver_draw_cache_reuse` aborted with the pipeline on). - A failed pipelined commit now stops queue 0 and goes through `Driver::ReportFailure` like a failed worker (except `ProcessShutdown`), instead of a log line; later commits are skipped. Without it `agc_driver_pm4_failure` hangs with the pipeline on. - Committer rethrows `std::exception` like the inline draw path. - After #1193 `ShaderMemory` is neither copyable nor movable; the draw holds it in a `unique_ptr` so the pipelined commit can own it. - Queued draw write ranges include the color target's CMASK (exact and estimated). - Memory-value fill (4 bytes at `valueAddress`) and buffer-pattern source drain queued writes before reading; the `inputLock` release moved into `fillBuffer` since main split out `storeBufferFill`. - ARCHITECTURE.md: a paragraph on the queue-0 draw pipeline. New tests (each check proven by mutating the fix and seeing it fail): `agc_driver_pm4_failure_pipelined` (times out without `ReportFailure`), `agc_driver_draw_cache_reuse_pipelined` (aborts without the stage capture), CMASK rows in `agc_driver_draw_write_ranges`. Local results (Linux, Radeon 660M, RADV, `ANYPS5_ENABLE_SPIRV_TOOLS=ON`), `ctest -R 'agc|shader'`: - pipeline off: 594/595 - pipeline on (`APS5_PIPELINED_DRAWS=1 APS5_EXACT_DRAW_WRITES=1`): 594/595 - stress, pipeline on, `--repeat until-fail:20` over the pipelined/fill/predication/label/draw-cache/failure tests: 16 tests x 20, all passed The only failure, `agc_driver_tessellation`, segfaults on main too on this GPU. Windows full build dispatched next; merging with the pipeline off once it is green. #1202 (on by default) stays held on its open blockers.
eliyarson commented 2026-10-15 10:24:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by eliyarson on 2026-10-15T10:24:09Z.


Thanks @adriadam10 for rebasing, folding in the predicate and deferred-label fixes, and chasing down the pipelined-commit lifetime and failure-path bugs, and to everyone whose fixes went in. I'll keep testing the pipeline on Hades II and report back on #1202.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6189880318 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6189880318). Originally posted by [eliyarson](https://github.com/eliyarson) on 2026-10-15T10:24:09Z. --- Thanks @adriadam10 for rebasing, folding in the predicate and deferred-label fixes, and chasing down the pipelined-commit lifetime and failure-path bugs, and to everyone whose fixes went in. I'll keep testing the pipeline on Hades II and report back on #1202.
SP4C3B4R-8 commented 2026-10-16 11:42:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SP4C3B4R-8 on 2026-10-16T11:42:46Z.


@MichonGoddijn231849 @oneandonlydean a question about where this goes next, so nobody does the same work twice.

On Windows (RTX 5070 Ti / 7800X3D), with #6763 (draw inputs copied instead of bound in place: the GPU time of the draws went 164 -> 45 ms per frame) and #6188, Astro Bot's Crash Site (~2200 draws per frame) is now bound by this PR's committer: it holds the GPU mutex 68% of the time at ~34 us per draw, and the packet worker spends 22.6 of its 33 us per packet waiting for it. Per draw: snapshots and descriptor sets ~7.6 us, pipeline/resource lookup ~8, vertex copies ~5, target refresh ~3, the Vulkan commands themselves ~3.

We are trimming those pieces one by one, but past that the single committer is the ceiling. Is anyone working on, or planning, recording draws on more than one thread (for example secondary command buffers per render pass, committed in order)? If it is on your list we will stay out of it and measure your branch on Windows; if not, we would like to know whether you would take it in that form before we start.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6214727330 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1201#issuecomment-6214727330). Originally posted by [SP4C3B4R-8](https://github.com/SP4C3B4R-8) on 2026-10-16T11:42:46Z. --- @MichonGoddijn231849 @oneandonlydean a question about where this goes next, so nobody does the same work twice. On Windows (RTX 5070 Ti / 7800X3D), with #6763 (draw inputs copied instead of bound in place: the GPU time of the draws went 164 -> 45 ms per frame) and #6188, Astro Bot's Crash Site (~2200 draws per frame) is now bound by this PR's committer: it holds the GPU mutex 68% of the time at ~34 us per draw, and the packet worker spends 22.6 of its 33 us per packet waiting for it. Per draw: snapshots and descriptor sets ~7.6 us, pipeline/resource lookup ~8, vertex copies ~5, target refresh ~3, the Vulkan commands themselves ~3. We are trimming those pieces one by one, but past that the single committer is the ceiling. Is anyone working on, or planning, recording draws on more than one thread (for example secondary command buffers per render pass, committed in order)? If it is on your list we will stay out of it and measure your branch on Windows; if not, we would like to know whether you would take it in that form before we start.
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!1201
No description provided.