AGC: splitting a dispatch over maxComputeWorkGroupCount with vkCmdDispatchBase uses a base at or past the limit #7375
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-18T03:22:03Z.
What
VulkanDevicesplits a compute dispatch whose group count exceedsmaxComputeWorkGroupCountintovkCmdDispatchBasechunks (288ee89d2d, #3212). Each chunk after the first starts at a base equal to a multiple of the limit, for examplebaseGroupX = 65535on a device whose limit is 65535. The spec doesn't allow that:VUID-vkCmdDispatchBase-baseGroupX-00421:baseGroupXmust be less thanmaxComputeWorkGroupCount[0].groupCountXmust be at mostmaxComputeWorkGroupCount[0]minusbaseGroupX.The same rules apply to Y and Z. Together they keep
base + countwithin the limit, sovkCmdDispatchBasecannot reach a group id at or pastmaxComputeWorkGroupCountin any dimension. A dispatch over the limit can't be split validly this way at all.Evidence
agc_driver_oversized_dispatchunder the Khronos validation layer 1.3.275 on lavapipe (ANYPS5_GPU=llvmpipe, limit 65535),mainb39d90bf14:The test passes, so lavapipe tolerates the invalid call. That is the only
vkCmdDispatchBaseerror in a validation-layer run of all 691^agc_tests there.Possibly related
The split throws on NVIDIA because, as
288ee89d2dmeasured, the driver "drops the first workgroups of a vkCmdDispatchBase dispatch with a nonzero base". On NVIDIA the X limit is 2^31 - 1 and the Y and Z limits are 65535, so a split happens only in Y or Z, and its second chunk starts at a base of 65535. That is the invalid case above. I haven't checked whether the dropped workgroups are this undefined behaviour or something else; NVIDIA may also behave that way for a valid nonzero base.A possible direction
A split that stays valid on every driver would dispatch each chunk with
vkCmdDispatchfrom group 0, and have the shader add the chunk's offset toWorkgroupIdandGlobalInvocationId. The offset could come from a push constant or shader data dword, asDispatchThreadLimitis read today. The device-memory LDS case, which throws today, would also need the total group counts rather than the chunk'sNumWorkgroups. This is only a sketch and not implemented.AI-assisted: yes (Claude Code)