fix(agc): fold GPU-side indirect dispatches over the workgroup count limit #25010

Open
mariushub wants to merge 1 commit from upstream-pr/25010 into main
mariushub commented 2026-11-21 14:49:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mariushub on 2026-11-21T14:49:49Z.


What

A DISPATCH_INDIRECT whose group counts stay on the GPU ran no workgroup at all when a count exceeded maxComputeWorkGroupCount: DispatchArguments.comp (#6360) writes 0x0x0 for such counts. The console takes 32-bit counts, and Y and Z are limited to 65535 on AMD and NVIDIA, so a title that dispatches more than 65535 groups along Y lost the whole dispatch. Direct dispatches over the limit already run in chunks (#7445); GPU-side indirect ones did not.

PS2 Classics hit this: the PS2HD emulator's GS rasterizer (gsKernelRenderTiles) is an indirect dispatch of one column of tiles, and with its default up-rendering a 3D scene needs more tiles than 65535. On Tomb Raider: Legend (PPSA22453) the menu dispatches it with 1x79988x1 and 1x169464x1 groups, so the rasterizer never ran and the menu stayed black (#23908). It does not happen with --gs-uprender=none, which needs four times fewer tiles. WALL-E's black menu (#19548) is also a PS2HD title; I have not tested it.

With this change such a dispatch runs as one linear dispatch:

  • DispatchArguments.comp: when a count exceeds the limit and the program was compiled for an indirect dispatch, the kernel writes T x 1 x 1 (T = x * y * z) and the original X and Y counts (words 6 and 7). It still writes 0x0x0 when T exceeds maxComputeWorkGroupCount[0] or 2^31 - 1, or the dispatch has 2^32 invocations or more, so the garbage count #6360 guards against (0xffffffff groups) still runs nothing.
  • VulkanDevice::recordDispatch: a program that reads the counts gets them copied into its ShaderData before the dispatch's leading barrier, as the thread-dimension limit already is, and zeros when the counts were read on the CPU. Split table call parts keep the old behaviour.
  • Recompiler: ShaderComputeStageInfo::groupFold, set for a DISPATCH_INDIRECT of a program that reads its workgroup ids, makes the entry prologue rebuild those ids (and the global ids of a partial-group dispatch) from the linear id and a new DispatchGroupCount ShaderData input; counts of 0 leave the ids as they are. Such a program keeps its ShaderData in a buffer, not in push constants, since the GPU writes the counts. A program that reads no workgroup id is folded without a separate variant. The flag is part of the recompile cache key, the dispatch cache key and the request serialization (version 64); the disk cache format moves to 96.
  • The ShaderData copy needs ShaderResources::shaderDataAllocation to find the binding of a program with an image table, which #24871 fixes (and #20067 too); without it such a program's folded dispatch throws, as its thread-dimension limit already does.
  • Debt fragment for the remaining gaps (counts that still run nothing, CPU-read counts, ShaderData out of push constants, linear launch order).

Tested

Windows 11 Pro 26100, WinLibs GCC 15.2.0, Release, on an NVIDIA GeForce RTX 5080 and the AMD Radeon iGPU of a Ryzen 7 9800X3D (gfx1036).

  • agc_driver_indirect_dispatch_limit, extended: 2 x (maxComputeWorkGroupCount[1] + 1) groups each store (Y << 16) | X at their linear index (131072 groups checked), once with group counts and once with thread counts and a partial last group; 1 x 0xffffffff x 1 runs no thread; 1x1x1 still runs. Two negative controls fail: without the fold in the argument kernel at group 0, and without the ShaderData copy at group 2 (stored 2, expected 65536).
  • Focused tests on main and on this PR, on both GPUs, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (SDK 1.4.335) and VK_LOADER_DEBUG=layer: every agc_driver_*indirect* test, agc_driver_prepared_shaders*, agc_driver_oversized_dispatch, agc_driver_cross_workgroup_flag, agc_driver_wave_id_in_workgroup, agc_shader_disk_cache*, agc_spirv_*, agc_shader_cache_housekeeping*, agc_shader_memory* and request_serializer (76 tests). All pass in the four runs, on main (e60b2f74ad) and on this PR; every log shows the loader inserting the layer, none contains was not found but was requested by env var VK_INSTANCE_LAYERS, and none contains a VUID- line.
  • Whole AGC group, request_serializer and shader_* tests (2079) on the iGPU: 23 failures, all among 26 I ran one at a time on main and on this PR before rebasing: 24 fail on both, agc_storage_write_back_host_retile passes on both, and agc_driver_store_over_untracked is flaky on main too (3 of 8 runs fail there).
  • Tomb Raider: Legend (PPSA22453): a frame capture of the black menu (APS5_FRAME_CAPTURE, 10 frames) replayed with agc_frame_replay --frames. main: every frame black. This PR: the menu renders, at the up-rendered resolution, on both GPUs (screenshot below). In game on the RTX 5080, with this change built on the earlier base dbd4eb7377 and each title's default configuration: the Tomb Raider: Legend menu and the Jak and Daxter: The Precursor Legacy (PPSA20928, 4x4 up-render) title screen now render. Both run slowly because the rasterizer now does its work: in the replay it costs about 37 ms per dispatch on the iGPU and 180 to 230 ms on the RTX 5080, the same as when the counts are read on the CPU (APS5_NO_GPU_INDIRECT=1), and an iGPU frame takes 65 ms here against 99 ms with the counts read on the CPU. The PS2 logo of both titles pauses for 1 to 2 s on the RTX 5080, and for less time on main. A frame capture of the logo replayed on this PR shows why: its first five frames run the rasterizer with 252552, 262088, 200232, 212196 and 149440 groups, which main skips, and each now takes 140 to 255 ms on the RTX 5080 and 105 to 170 ms on the iGPU. The movie that follows is not affected (35712 groups per dispatch, within the limit).
  • Not measured: the cost of ShaderData leaving push constants on a title with many indirect dispatches of programs that read their workgroup ids; the titles I have use few.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #24871
  • Fixes: none
  • Unblocks: PPSA22453 #23908
  • GPUs tested: NVIDIA GeForce RTX 5080 (driver 596.36, Windows 11 Pro 26100); AMD Radeon(TM) Graphics, gfx1036 iGPU of a Ryzen 7 9800X3D (AMD driver 24.10.24, Windows 11 Pro 26100)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5429088123 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25010). Originally posted by [mariushub](https://github.com/mariushub) on 2026-11-21T14:49:49Z. --- ### What A `DISPATCH_INDIRECT` whose group counts stay on the GPU ran no workgroup at all when a count exceeded `maxComputeWorkGroupCount`: `DispatchArguments.comp` (#6360) writes 0x0x0 for such counts. The console takes 32-bit counts, and Y and Z are limited to 65535 on AMD and NVIDIA, so a title that dispatches more than 65535 groups along Y lost the whole dispatch. Direct dispatches over the limit already run in chunks (#7445); GPU-side indirect ones did not. PS2 Classics hit this: the PS2HD emulator's GS rasterizer (`gsKernelRenderTiles`) is an indirect dispatch of one column of tiles, and with its default up-rendering a 3D scene needs more tiles than 65535. On Tomb Raider: Legend (PPSA22453) the menu dispatches it with 1x79988x1 and 1x169464x1 groups, so the rasterizer never ran and the menu stayed black (#23908). It does not happen with `--gs-uprender=none`, which needs four times fewer tiles. WALL-E's black menu (#19548) is also a PS2HD title; I have not tested it. With this change such a dispatch runs as one linear dispatch: - `DispatchArguments.comp`: when a count exceeds the limit and the program was compiled for an indirect dispatch, the kernel writes `T x 1 x 1` (T = x * y * z) and the original X and Y counts (words 6 and 7). It still writes 0x0x0 when T exceeds `maxComputeWorkGroupCount[0]` or 2^31 - 1, or the dispatch has 2^32 invocations or more, so the garbage count #6360 guards against (0xffffffff groups) still runs nothing. - `VulkanDevice::recordDispatch`: a program that reads the counts gets them copied into its ShaderData before the dispatch's leading barrier, as the thread-dimension limit already is, and zeros when the counts were read on the CPU. Split table call parts keep the old behaviour. - Recompiler: `ShaderComputeStageInfo::groupFold`, set for a `DISPATCH_INDIRECT` of a program that reads its workgroup ids, makes the entry prologue rebuild those ids (and the global ids of a partial-group dispatch) from the linear id and a new `DispatchGroupCount` ShaderData input; counts of 0 leave the ids as they are. Such a program keeps its ShaderData in a buffer, not in push constants, since the GPU writes the counts. A program that reads no workgroup id is folded without a separate variant. The flag is part of the recompile cache key, the dispatch cache key and the request serialization (version 64); the disk cache format moves to 96. - The ShaderData copy needs `ShaderResources::shaderDataAllocation` to find the binding of a program with an image table, which #24871 fixes (and #20067 too); without it such a program's folded dispatch throws, as its thread-dimension limit already does. - Debt fragment for the remaining gaps (counts that still run nothing, CPU-read counts, ShaderData out of push constants, linear launch order). ### Tested Windows 11 Pro 26100, WinLibs GCC 15.2.0, Release, on an NVIDIA GeForce RTX 5080 and the AMD Radeon iGPU of a Ryzen 7 9800X3D (gfx1036). - `agc_driver_indirect_dispatch_limit`, extended: 2 x (`maxComputeWorkGroupCount[1]` + 1) groups each store `(Y << 16) | X` at their linear index (131072 groups checked), once with group counts and once with thread counts and a partial last group; 1 x 0xffffffff x 1 runs no thread; 1x1x1 still runs. Two negative controls fail: without the fold in the argument kernel at group 0, and without the ShaderData copy at group 2 (`stored 2, expected 65536`). - Focused tests on `main` and on this PR, on both GPUs, with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (SDK 1.4.335) and `VK_LOADER_DEBUG=layer`: every `agc_driver_*indirect*` test, `agc_driver_prepared_shaders*`, `agc_driver_oversized_dispatch`, `agc_driver_cross_workgroup_flag`, `agc_driver_wave_id_in_workgroup`, `agc_shader_disk_cache*`, `agc_spirv_*`, `agc_shader_cache_housekeeping*`, `agc_shader_memory*` and `request_serializer` (76 tests). All pass in the four runs, on `main` (e60b2f74ad) and on this PR; every log shows the loader inserting the layer, none contains `was not found but was requested by env var VK_INSTANCE_LAYERS`, and none contains a `VUID-` line. - Whole AGC group, `request_serializer` and `shader_*` tests (2079) on the iGPU: 23 failures, all among 26 I ran one at a time on `main` and on this PR before rebasing: 24 fail on both, `agc_storage_write_back_host_retile` passes on both, and `agc_driver_store_over_untracked` is flaky on `main` too (3 of 8 runs fail there). - Tomb Raider: Legend (PPSA22453): a frame capture of the black menu (`APS5_FRAME_CAPTURE`, 10 frames) replayed with `agc_frame_replay --frames`. `main`: every frame black. This PR: the menu renders, at the up-rendered resolution, on both GPUs (screenshot below). In game on the RTX 5080, with this change built on the earlier base dbd4eb7377 and each title's default configuration: the Tomb Raider: Legend menu and the Jak and Daxter: The Precursor Legacy (PPSA20928, 4x4 up-render) title screen now render. Both run slowly because the rasterizer now does its work: in the replay it costs about 37 ms per dispatch on the iGPU and 180 to 230 ms on the RTX 5080, the same as when the counts are read on the CPU (`APS5_NO_GPU_INDIRECT=1`), and an iGPU frame takes 65 ms here against 99 ms with the counts read on the CPU. The PS2 logo of both titles pauses for 1 to 2 s on the RTX 5080, and for less time on `main`. A frame capture of the logo replayed on this PR shows why: its first five frames run the rasterizer with 252552, 262088, 200232, 212196 and 149440 groups, which `main` skips, and each now takes 140 to 255 ms on the RTX 5080 and 105 to 170 ms on the iGPU. The movie that follows is not affected (35712 groups per dispatch, within the limit). - Not measured: the cost of ShaderData leaving push constants on a title with many indirect dispatches of programs that read their workgroup ids; the titles I have use few. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #24871 - [x] Fixes: none - [x] Unblocks: PPSA22453 #23908 - [x] GPUs tested: NVIDIA GeForce RTX 5080 (driver 596.36, Windows 11 Pro 26100); AMD Radeon(TM) Graphics, gfx1036 iGPU of a Ryzen 7 9800X3D (AMD driver 24.10.24, Windows 11 Pro 26100) - [x] AI-assisted: yes
JJenkx commented 2026-11-22 08:41:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-11-22T08:41:43Z.

Review: COMMENTED


Tested on Linux with an AMD Radeon RX 6650 XT (RADV NAVI23) with and without the Khronos validation layer, and reviewed the diff. The focused GPU + VVL suite and negative control pass on Linux RADV, and code reading turned up one concrete bug on the indirect split-table-call path.

Code finding: uninitialized ShaderData group counts on GPU-side indirect split table calls

  1. core/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/Dispatch.cpp:413 sets compute.groupFold = indirectArguments != 0 && (...) on request before SplitTableCallPartsFor(request, ...) / dispatchSplitTableCall(..., request, ...) (Dispatch.cpp:428-430).
  2. SplitTableCallPartInvocation (ShaderRegistry.cpp:1487) copies request verbatim without clearing compute.groupFold, so an indirect split-table-call entry part that reads workgroup IDs or partial groups compiles with dispatchGroupCount == true.
  3. In VulkanDevice::recordDispatch (core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp:6115-6145):
    • foldThreads is forced to 0u when split is true, while readsCounts is still true.
    • When argumentImport != nullptr && argumentImport->address != 0, copied is a newly allocated uninitialized 32-byte buffer, and RecordDispatchArguments invokes DispatchArguments.comp with parameters.foldThreads == 0u.
    • DispatchArguments.comp:63-66 skips writing words[6] and words[7] when parameters.foldThreads == 0u.
    • VulkanDevice.cpp:6136-6137 then unconditionally copies bytes 24..31 (words[6..7]) from copied into ShaderData and sets countsCopied = true, bypassing the {0, 0} vkCmdUpdateBuffer fallback at line 6143.
    • If the uninitialized GPU memory at copied[24..27] is nonzero, the split part's entry prologue sees unfolded == false and corrupts its workgroup IDs.

Suggested fix: Clear compute.groupFold = false when compiling split table call parts (so they keep the old behaviour without moving ShaderData out of push constants or emitting prologue divides), and in VulkanDevice::recordDispatch guard the counts copy with if (readsCounts && foldThreads != 0u) (setting countsCopied = readsCounts && foldThreads != 0u) so {0, 0} is always written whenever foldThreads == 0u.


Linux AMD RADV hardware verification

Setup

  • Linux 7.3.5-arch1-1, GCC 16.2.1, Ninja, Release (ANYPS5_ENABLE_SPIRV_TOOLS=OFF).
  • Base: main 10a9c248ffc (includes merged #24871 c603d5d41133). Candidate: clean merge of PR head b0ebf5b48425 onto 10a9c248ffc.
  • GPU: AMD Radeon RX 6650 XT (RADV NAVI23) (vendor=0x1002 device=0x73ef subgroup=64, Mesa RADV 26.3.1).
  • Environment: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1; layer runs add VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (1.4.363) and VK_LOADER_DEBUG=layer.
  • Tests (73 tests on Linux matching agc_driver_.*indirect|agc_driver_prepared_shaders|agc_driver_oversized_dispatch|agc_driver_cross_workgroup_flag|agc_driver_wave_id_in_workgroup|agc_shader_disk_cache|agc_spirv_|agc_shader_cache_housekeeping|agc_shader_memory|request_serializer|agc_indexed_indirect_patches):
Run No layer VVL 1.4.363 Layer insertions VUID- / SYNC-HAZARD- / UNASSIGNED-
Base 10a9c248ffc 73/73 pass (96.57 s) 73/73 pass (100.83 s) 117 0
PR b0ebf5b48425 merged on 10a9c248ffc 73/73 pass (96.07 s) 73/73 pass (100.55 s) 117 0
Negative control (DispatchArguments.comp reverted to 10a9c248ffc, agc_driver_indirect_dispatch_limit) — Failed (0.16 s): AGC graphics: indirect dispatch fold: group 0 of 2x65536x1 stored 3735928559, expected 0 inserted 0
  • Zero skipped tests and zero was not found but was requested by env var VK_INSTANCE_LAYERS lines across all runs.
  • Not tested here: PS2 Classics titles (no dumps on this machine) and the indirect split-table-call runtime path noted above.

AI-assisted: yes (code review and scripted test runs on the Linux RADV machine above).

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6011305434 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25010#pullrequestreview-6011305434). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-11-22T08:41:43Z. **Review:** COMMENTED --- Tested on Linux with an AMD Radeon RX 6650 XT (RADV NAVI23) with and without the Khronos validation layer, and reviewed the diff. The focused GPU + VVL suite and negative control pass on Linux RADV, and code reading turned up one concrete bug on the indirect split-table-call path. ### Code finding: uninitialized `ShaderData` group counts on GPU-side indirect split table calls 1. `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/Dispatch.cpp:413` sets `compute.groupFold = indirectArguments != 0 && (...)` on `request` before `SplitTableCallPartsFor(request, ...)` / `dispatchSplitTableCall(..., request, ...)` (`Dispatch.cpp:428-430`). 2. `SplitTableCallPartInvocation` (`ShaderRegistry.cpp:1487`) copies `request` verbatim without clearing `compute.groupFold`, so an indirect split-table-call entry part that reads workgroup IDs or partial groups compiles with `dispatchGroupCount == true`. 3. In `VulkanDevice::recordDispatch` (`core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp:6115-6145`): - `foldThreads` is forced to `0u` when `split` is true, while `readsCounts` is still `true`. - When `argumentImport != nullptr && argumentImport->address != 0`, `copied` is a newly allocated uninitialized 32-byte buffer, and `RecordDispatchArguments` invokes `DispatchArguments.comp` with `parameters.foldThreads == 0u`. - `DispatchArguments.comp:63-66` skips writing `words[6]` and `words[7]` when `parameters.foldThreads == 0u`. - `VulkanDevice.cpp:6136-6137` then unconditionally copies bytes `24..31` (`words[6..7]`) from `copied` into `ShaderData` and sets `countsCopied = true`, bypassing the `{0, 0}` `vkCmdUpdateBuffer` fallback at line 6143. - If the uninitialized GPU memory at `copied[24..27]` is nonzero, the split part's entry prologue sees `unfolded == false` and corrupts its workgroup IDs. **Suggested fix:** Clear `compute.groupFold = false` when compiling split table call parts (so they keep the old behaviour without moving `ShaderData` out of push constants or emitting prologue divides), and in `VulkanDevice::recordDispatch` guard the `counts` copy with `if (readsCounts && foldThreads != 0u)` (setting `countsCopied = readsCounts && foldThreads != 0u`) so `{0, 0}` is always written whenever `foldThreads == 0u`. --- ### Linux AMD RADV hardware verification **Setup** - Linux 7.3.5-arch1-1, GCC 16.2.1, Ninja, Release (`ANYPS5_ENABLE_SPIRV_TOOLS=OFF`). - Base: `main` `10a9c248ffc` (includes merged #24871 `c603d5d41133`). Candidate: clean merge of PR head `b0ebf5b48425` onto `10a9c248ffc`. - GPU: `AMD Radeon RX 6650 XT (RADV NAVI23)` (`vendor=0x1002 device=0x73ef subgroup=64`, Mesa RADV 26.3.1). - Environment: `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`; layer runs add `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (1.4.363) and `VK_LOADER_DEBUG=layer`. - Tests (73 tests on Linux matching `agc_driver_.*indirect|agc_driver_prepared_shaders|agc_driver_oversized_dispatch|agc_driver_cross_workgroup_flag|agc_driver_wave_id_in_workgroup|agc_shader_disk_cache|agc_spirv_|agc_shader_cache_housekeeping|agc_shader_memory|request_serializer|agc_indexed_indirect_patches`): | Run | No layer | VVL 1.4.363 | Layer insertions | `VUID-` / `SYNC-HAZARD-` / `UNASSIGNED-` | |---|---|---|---|---| | Base `10a9c248ffc` | 73/73 pass (96.57 s) | 73/73 pass (100.83 s) | 117 | 0 | | PR `b0ebf5b48425` merged on `10a9c248ffc` | 73/73 pass (96.07 s) | 73/73 pass (100.55 s) | 117 | 0 | | Negative control (`DispatchArguments.comp` reverted to `10a9c248ffc`, `agc_driver_indirect_dispatch_limit`) | — | Failed (0.16 s): `AGC graphics: indirect dispatch fold: group 0 of 2x65536x1 stored 3735928559, expected 0` | inserted | 0 | - Zero skipped tests and zero `was not found but was requested by env var VK_INSTANCE_LAYERS` lines across all runs. - Not tested here: PS2 Classics titles (no dumps on this machine) and the indirect split-table-call runtime path noted above. AI-assisted: yes (code review and scripted test runs on the Linux RADV machine above).
MarcZX10 commented 2026-11-22 09:02:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T09:02:22Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this change; the inspected code supports the documented indirect-dispatch fold, and no verified defect warrants blocking merge.

What I ran

Reviewed head b0ebf5b484257a18f5ee0eeb51f74225ed61cc43. Read the prepared description, commit list, manifest, and full diff; inspected relevant source ranges through repo_read.py. No tests or builds were run by me.

Results

Check Result Note
Diff and targeted source review passed Fold logic and related plumbing inspected
Build and tests not run Author-reported results are not independently verified

Findings

Blocking

None.

Non-blocking

None.

Not verified

Full text of VulkanDevice.cpp and ShaderMemory.cpp was excluded from the prepared folder; I inspected only the relevant changed ranges via the reader. Other changed files whose full text was included in the manifest were not all read. Build, test results, hardware behavior, performance, and the author-reported negative controls were not independently verified. review/files.json was not available through the reader; exclusion details came from manifest.json.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6011413694 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25010#pullrequestreview-6011413694). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T09:02:22Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this change; the inspected code supports the documented indirect-dispatch fold, and no verified defect warrants blocking merge. ## What I ran Reviewed head `b0ebf5b484257a18f5ee0eeb51f74225ed61cc43`. Read the prepared description, commit list, manifest, and full diff; inspected relevant source ranges through `repo_read.py`. No tests or builds were run by me. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | Fold logic and related plumbing inspected | | Build and tests | not run | Author-reported results are not independently verified | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Full text of `VulkanDevice.cpp` and `ShaderMemory.cpp` was excluded from the prepared folder; I inspected only the relevant changed ranges via the reader. Other changed files whose full text was included in the manifest were not all read. Build, test results, hardware behavior, performance, and the author-reported negative controls were not independently verified. `review/files.json` was not available through the reader; exclusion details came from `manifest.json`. ## To get this to a good state Nothing is required.
Superseabas commented 2026-11-23 10:41:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Superseabas on 2026-11-23T10:41:45Z.

Review: COMMENTED


Windows check of head b0ebf5b484 with GCC 16 on an NVIDIA and an AMD GPU, merged onto main f5b7e1d1ac (which has #24871; clean merge), and a read of the split-table-call path JJenkx raised.

Setup: Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (x86_64-ucrt-posix-seh, r3), Release full build, run from PowerShell with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. GPUs, each picked with ANYPS5_GPU: NVIDIA GeForce RTX 5070 Ti (621.01) and the Ryzen 7 7700X's integrated AMD Radeon (1002:164e, Adrenalin 26.10.2). This was built together with #21745, which touches other files apart from ShaderMemory.cpp.

  • Every agc_driver_*indirect* test, the split table call tests, agc_driver_oversized_dispatch, agc_driver_cross_workgroup_flag, agc_driver_wave_id_in_workgroup, agc_driver_prepared_shaders*, agc_shader_disk_cache* and request_serializer (66 tests here): 66 of 66 on main, and with this PR in 3 of 3 runs, on both GPUs. No VUID- lines.

JJenkx's split-table-call finding holds, as far as I can trace it. Driver::dispatch sets compute.groupFold before SplitTableCallPartsFor. SplitTableCallPartInvocation copies request as it is, and ShaderInputInfoBuilder.cpp:101 passes the flag on, so a split part that reads its workgroup ids is compiled with DispatchGroupCount. In recordDispatch, foldThreads is 0 for it, so DispatchArguments.comp leaves words 6 and 7 alone, but readsCounts is still set, so they are copied into ShaderData and the zero fallback is skipped.

One detail makes non-zero words there likely, not only possible: Graphics::Buffer takes its memory from BufferPool, which clears a reused tail only on Apple. The 32-byte argument buffers of folded dispatches, which do write the real X and Y counts into words 6 and 7, go back to that pool. A split part that gets one of them later rebuilds its workgroup ids from those counts. SplitTableCallRun's indirect cases compile without groupFold, so the tests don't reach this path.

Version numbers: the request serializer's 64 is also taken by #24906, #23818 and #22251, so whichever lands later needs the next number. (I first listed the disk cache's 97 here too. That doesn't matter: the cache is also keyed on a hash of the recompiler sources.)

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6020183588 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25010#pullrequestreview-6020183588). Originally posted by [Superseabas](https://github.com/Superseabas) on 2026-11-23T10:41:45Z. **Review:** COMMENTED --- Windows check of head `b0ebf5b484` with GCC 16 on an NVIDIA and an AMD GPU, merged onto `main` `f5b7e1d1ac` (which has #24871; clean merge), and a read of the split-table-call path JJenkx raised. **Setup:** Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (`x86_64-ucrt-posix-seh`, r3), Release full build, run from PowerShell with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`. GPUs, each picked with `ANYPS5_GPU`: NVIDIA GeForce RTX 5070 Ti (621.01) and the Ryzen 7 7700X's integrated AMD Radeon (`1002:164e`, Adrenalin 26.10.2). This was built together with #21745, which touches other files apart from `ShaderMemory.cpp`. - Every `agc_driver_*indirect*` test, the split table call tests, `agc_driver_oversized_dispatch`, `agc_driver_cross_workgroup_flag`, `agc_driver_wave_id_in_workgroup`, `agc_driver_prepared_shaders*`, `agc_shader_disk_cache*` and `request_serializer` (66 tests here): 66 of 66 on `main`, and with this PR in 3 of 3 runs, on both GPUs. No `VUID-` lines. **JJenkx's split-table-call finding holds, as far as I can trace it.** `Driver::dispatch` sets `compute.groupFold` before `SplitTableCallPartsFor`. `SplitTableCallPartInvocation` copies `request` as it is, and `ShaderInputInfoBuilder.cpp:101` passes the flag on, so a split part that reads its workgroup ids is compiled with `DispatchGroupCount`. In `recordDispatch`, `foldThreads` is 0 for it, so `DispatchArguments.comp` leaves words 6 and 7 alone, but `readsCounts` is still set, so they are copied into ShaderData and the zero fallback is skipped. One detail makes non-zero words there likely, not only possible: `Graphics::Buffer` takes its memory from `BufferPool`, which clears a reused tail only on Apple. The 32-byte argument buffers of folded dispatches, which do write the real X and Y counts into words 6 and 7, go back to that pool. A split part that gets one of them later rebuilds its workgroup ids from those counts. `SplitTableCallRun`'s indirect cases compile without `groupFold`, so the tests don't reach this path. **Version numbers:** the request serializer's 64 is also taken by #24906, #23818 and #22251, so whichever lands later needs the next number. (I first listed the disk cache's 97 here too. That doesn't matter: the cache is also keyed on a hash of the recompiler sources.) AI-assisted: yes (Claude Code)
ligmaSec commented 2026-12-03 21:41:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T21:41:26Z.

Review: COMMENTED


This head conflicts with main f3c2cd73ab in seven files, including Recorder.hpp, BindingAllocator.cpp, and both request serialization files. Please reconcile the folded-dispatch shader-data words, serializer and cache version together. The fixture checks both group-count and thread-count paths, and its assertion that the arguments stay on the GPU is essential. The paired Vulkan run is pending the merge resolution.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6179099651 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25010#pullrequestreview-6179099651). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T21:41:26Z. **Review:** COMMENTED --- This head conflicts with `main` `f3c2cd73ab` in seven files, including `Recorder.hpp`, `BindingAllocator.cpp`, and both request serialization files. Please reconcile the folded-dispatch shader-data words, serializer and cache version together. The fixture checks both group-count and thread-count paths, and its assertion that the arguments stay on the GPU is essential. The paired Vulkan run is pending the merge resolution. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

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

Merge

Merge the changes and update on Forgejo.

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

git switch 'main'
git merge --no-ff 'upstream-pr/25010'
git switch 'upstream-pr/25010'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/25010'
git switch 'upstream-pr/25010'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/25010'
git switch 'main'
git merge --squash 'upstream-pr/25010'
git switch 'main'
git merge --ff-only 'upstream-pr/25010'
git switch 'main'
git merge 'upstream-pr/25010'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!25010
No description provided.