agc: a dispatch wider than maxComputeWorkGroupCount aborts instead of being split (Ghost of Yōtei PPSA26344, 129199x1x1 on the software device) #3212

Closed
opened 2026-10-11 01:32:15 +00:00 by Dextroid17 · 1 comment
Dextroid17 commented 2026-10-11 01:32:15 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-11T01:32:15Z.


What

On a device whose maxComputeWorkGroupCount is the value the Vulkan spec guarantees as a
minimum — (65535,65535,65535), which is exactly what the software device reports, per the
spec's Limits chapter — a legitimate compute dispatch aborts the whole process.
The driver throws; the presentation loop catches it, prints that line, and then calls
std::terminate() from inside its own handler — so the reported error still aborts the process
(SIGABRT, core dumped).

[videoout] presentation failed: compute shader 0x8000393600: Vulkan dispatch: workgroup count exceeds device limits (129199x1x1, device limit 65535x65535x65535)
terminate called after throwing an instance of 'std::runtime_error'
  what():  compute shader 0x8000393600: Vulkan dispatch: workgroup count exceeds device limits (129199x1x1, device limit 65535x65535x65535)
the run aborts here: terminate → SIGABRT, core dumped

Title that hits it: Ghost of Yōtei (PPSA26344), in the presentation path, on the software
device. The requested count is 129199x1x1 — just under twice the limit, so two chunks
along X would cover it.

Why this is a driver gap and not a title bug

Vulkan requires the caller to stay inside maxComputeWorkGroupCount; nothing splits a dispatch
automatically. Desktop drivers report large limits (typically 2³¹−1 per dimension), so on the
3080 Ti the identical dispatch is legal and the title carries on. That is why the title "aborts at
presentation" only on the software device — the failure is a property of the limit, not of the
shader or of the title's packet.

The driver already requires Vulkan 1.1 or newer (VulkanDevice.cpp:746 checks
properties.apiVersion < VK_API_VERSION_1_1), so vkCmdDispatchBase is core-available and
the split needs no feature bit and no VK_KHR_device_group fallback.

Where it throws

All three sites check the device limit and throw, and none of them split:

VulkanDevice.cpp:3459   record.x/y/z after an indirect dispatch's arguments are resolved
VulkanDevice.cpp:3610   direct dispatch, guarded `arguments == 0`
VulkanDevice.cpp:3897   the dispatch-recipe path, guarded `arguments == 0`

(Line numbers are from 3194b802, the tree these runs were made on, before the diagnostics
change described at the end; that change adds a few lines at each site, moving them to 3462 / 3616
/ 3905.)

This is not the indirect look-ahead of #2990

#2990 (merged, 30ab2f6e) fixed an indirect dispatch reading its arguments before the dispatch
that writes them had run, and the counts there were garbage
(16926492x1116079131x3241227624). 129199 is a plausible count for a surface-sized dispatch,
so this is a different cause — a real dispatch wider than a low device limit. The tree I measured
predates 30ab2f6e, but the count rules that class out on its own. (#2365 mentions this
message in a comment, and it is that same indirect class.)

Measured on

  • Device: llvmpipe (LLVM 23.1.1, 256 bits), Vulkan 1.4.354, via the lavapipe ICD
    (~/.local/opt/lavapipe/lvp_icd_abs.json) — the Linux CI device.
  • maxComputeWorkGroupCount = {65535, 65535, 65535} (vulkaninfo).
  • Run: systemd-run --user --scope -p MemoryHigh=18G -p MemoryMax=22G -p MemorySwapMax=8G -- ./app.elf
    with APS5_TEXTURE_CACHE_MIB=512 (caches pinned so memory growth cannot reach the cap first;
    the process peaked at 10.08 GiB and aborted on the dispatch, not on memory).
  • Reaches the presentation path having already decoded the scalar aperture sources 235..238
    (#1940) — i.e. this is the next wall after #1920's, not a regression of it.

Proposed fix

Split an oversized dispatch along one dimension into chunks within the device limit, using
vkCmdDispatchBase with the corresponding baseGroupX/Y/Z. The specification makes this exactly
equivalent rather than merely equivalent in practice: vkCmdDispatch is
vkCmdDispatchBase(0,0,0,groupCountX,groupCountY,groupCountZ), and a dispatch assembles
groupCount* local workgroups with WorkgroupId ranging from
[baseGroup*, baseGroup* + groupCount*) in each component (spec, Dispatching Commands). So the
shader sees the same global IDs it would have seen, and two chunks of 65535 cover 129199x1x1 on a
device sitting at the minimum limit.

vkCmdDispatchBase is core in Vulkan 1.1 (Provided by VK_VERSION_1_1), and this driver
already requires at least 1.1, so no feature bit and no VK_KHR_device_group fallback is needed.
Clamping and documenting the limit instead is the cheaper option, but it silently drops the tail of
the work.

Small diagnostics change, offered separately

The three throws do not print the requested count or the device limit, even though groupsText
is already computed at each site — so this arrives as an unidentifiable abort. I have a local
patch that adds both (comment-free, no TechnicalDebt entry needed, tools/check_conventions.py
clean) and it is what made this issue possible: the first run of the title on the software device
reported only "workgroup count exceeds device limits" with no numbers. Happy to submit it as its
own PR when intake reopens, or here if preferred.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5796975862 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3212). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-11T01:32:15Z. --- ### What On a device whose `maxComputeWorkGroupCount` is the value the Vulkan spec guarantees as a minimum — `(65535,65535,65535)`, which is exactly what the software device reports, per the spec's *Limits* chapter — a **legitimate** compute dispatch aborts the whole process. The driver throws; the presentation loop **catches it**, prints that line, and then calls `std::terminate()` from inside its own handler — so the reported error still aborts the process (SIGABRT, core dumped). ``` [videoout] presentation failed: compute shader 0x8000393600: Vulkan dispatch: workgroup count exceeds device limits (129199x1x1, device limit 65535x65535x65535) terminate called after throwing an instance of 'std::runtime_error' what(): compute shader 0x8000393600: Vulkan dispatch: workgroup count exceeds device limits (129199x1x1, device limit 65535x65535x65535) the run aborts here: terminate → SIGABRT, core dumped ``` **Title that hits it:** Ghost of Yōtei (PPSA26344), in the presentation path, on the software device. The requested count is `129199x1x1` — just under twice the limit, so **two chunks** along X would cover it. ### Why this is a driver gap and not a title bug Vulkan requires the *caller* to stay inside `maxComputeWorkGroupCount`; nothing splits a dispatch automatically. Desktop drivers report large limits (typically 2³¹−1 per dimension), so on the 3080 Ti the identical dispatch is legal and the title carries on. That is why the title "aborts at presentation" only on the software device — the failure is a property of the limit, not of the shader or of the title's packet. The driver already requires Vulkan 1.1 or newer (`VulkanDevice.cpp:746` checks `properties.apiVersion < VK_API_VERSION_1_1`), so **`vkCmdDispatchBase` is core-available** and the split needs no feature bit and no `VK_KHR_device_group` fallback. ### Where it throws All three sites check the device limit and throw, and none of them split: ``` VulkanDevice.cpp:3459 record.x/y/z after an indirect dispatch's arguments are resolved VulkanDevice.cpp:3610 direct dispatch, guarded `arguments == 0` VulkanDevice.cpp:3897 the dispatch-recipe path, guarded `arguments == 0` ``` (Line numbers are from `3194b802`, the tree these runs were made on, **before** the diagnostics change described at the end; that change adds a few lines at each site, moving them to 3462 / 3616 / 3905.) ### This is not the indirect look-ahead of #2990 #2990 (merged, `30ab2f6e`) fixed an indirect dispatch reading its arguments before the dispatch that writes them had run, and the counts there were garbage (`16926492x1116079131x3241227624`). `129199` is a plausible count for a surface-sized dispatch, so this is a different cause — a real dispatch wider than a low device limit. The tree I measured predates `30ab2f6e`, but the count rules that class out on its own. (#2365 mentions this message in a comment, and it is that same indirect class.) ### Measured on - Device: **llvmpipe (LLVM 23.1.1, 256 bits)**, Vulkan 1.4.354, via the lavapipe ICD (`~/.local/opt/lavapipe/lvp_icd_abs.json`) — the Linux CI device. - `maxComputeWorkGroupCount = {65535, 65535, 65535}` (vulkaninfo). - Run: `systemd-run --user --scope -p MemoryHigh=18G -p MemoryMax=22G -p MemorySwapMax=8G -- ./app.elf` with `APS5_TEXTURE_CACHE_MIB=512` (caches pinned so memory growth cannot reach the cap first; the process peaked at 10.08 GiB and aborted on the dispatch, not on memory). - Reaches the presentation path having already decoded the scalar aperture sources 235..238 (#1940) — i.e. this is the next wall after #1920's, not a regression of it. ### Proposed fix Split an oversized dispatch along one dimension into chunks within the device limit, using `vkCmdDispatchBase` with the corresponding `baseGroupX/Y/Z`. The specification makes this exactly equivalent rather than merely equivalent in practice: `vkCmdDispatch` **is** `vkCmdDispatchBase(0,0,0,groupCountX,groupCountY,groupCountZ)`, and a dispatch assembles `groupCount*` local workgroups with `WorkgroupId` ranging from `[baseGroup*, baseGroup* + groupCount*)` in each component (spec, *Dispatching Commands*). So the shader sees the same global IDs it would have seen, and two chunks of 65535 cover `129199x1x1` on a device sitting at the minimum limit. `vkCmdDispatchBase` is **core in Vulkan 1.1** (`Provided by VK_VERSION_1_1`), and this driver already requires at least 1.1, so no feature bit and no `VK_KHR_device_group` fallback is needed. Clamping and documenting the limit instead is the cheaper option, but it silently drops the tail of the work. ### Small diagnostics change, offered separately The three throws do not print the requested count or the device limit, even though `groupsText` is already computed at each site — so this arrives as an unidentifiable abort. I have a local patch that adds both (comment-free, no `TechnicalDebt` entry needed, `tools/check_conventions.py` clean) and it is what made this issue possible: the first run of the title on the software device reported only "workgroup count exceeds device limits" with no numbers. Happy to submit it as its own PR when intake reopens, or here if preferred. Written with AI assistance.
fdfawef324 commented 2026-10-11 06:34:18 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-11T06:34:18Z.


Fix branch ready: fdfawef324:fix/agc-split-wide-dispatches, one commit on main. I can't open it as a PR because of the intake check; anyone eligible is welcome to carry it as is.

  • A resolved dispatch past maxComputeWorkGroupCount is recorded as vkCmdDispatchBase chunks within the limits, as proposed above. Guest compute pipelines are created with VK_PIPELINE_CREATE_DISPATCH_BASE_BIT. Both the direct path and the recipe path record through recordDispatch, and a CPU-resolved indirect dispatch is split the same way.
  • A program whose LDS lives in device memory still throws, now with the reason. Its slices are indexed by NumWorkgroups, which differs per chunk. This is recorded in TechnicalDebt together with GPU-read indirect counts, which are not checked.
  • This is not only a software-device problem. An RTX 3060 (Windows, driver 32.0.15.9186) reports 2147483647x65535x65535, so a dispatch taller than 65535 aborts the same way there.
  • New agc_driver_dispatch_split: a unit check of the chunking, plus an end-to-end 1x65537x1 dispatch through Submit where each group stores its Y id. On main it fails with workgroup count 1x65537x1 exceeds device limits 2147483647x65535x65535; with the branch every group lands. It runs in 1.4 s.

Tested on Windows Server 2025, WinLibs GCC 15.2.0 r7, Release, RTX 3060. Full ctest passes, except the BDA tests that hang on NVIDIA (#3291). Not run on lavapipe.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106287649 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3212#issuecomment-6106287649). Originally posted by [fdfawef324](https://github.com/fdfawef324) on 2026-10-11T06:34:18Z. --- Fix branch ready: [`fdfawef324:fix/agc-split-wide-dispatches`](https://github.com/fdfawef324/AnyPS5/tree/fix/agc-split-wide-dispatches), one commit on `main`. I can't open it as a PR because of the intake check; anyone eligible is welcome to carry it as is. - A resolved dispatch past `maxComputeWorkGroupCount` is recorded as `vkCmdDispatchBase` chunks within the limits, as proposed above. Guest compute pipelines are created with `VK_PIPELINE_CREATE_DISPATCH_BASE_BIT`. Both the direct path and the recipe path record through `recordDispatch`, and a CPU-resolved indirect dispatch is split the same way. - A program whose LDS lives in device memory still throws, now with the reason. Its slices are indexed by `NumWorkgroups`, which differs per chunk. This is recorded in TechnicalDebt together with GPU-read indirect counts, which are not checked. - This is not only a software-device problem. An RTX 3060 (Windows, driver 32.0.15.9186) reports `2147483647x65535x65535`, so a dispatch taller than 65535 aborts the same way there. - New `agc_driver_dispatch_split`: a unit check of the chunking, plus an end-to-end 1x65537x1 dispatch through `Submit` where each group stores its Y id. On `main` it fails with `workgroup count 1x65537x1 exceeds device limits 2147483647x65535x65535`; with the branch every group lands. It runs in 1.4 s. Tested on Windows Server 2025, WinLibs GCC 15.2.0 r7, Release, RTX 3060. Full `ctest` passes, except the BDA tests that hang on NVIDIA (#3291). Not run on lavapipe. AI-assisted: yes.
Sign in to join this conversation.
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#3212
No description provided.