fix(agc): count thread-dimension dispatch groups without wrapping at 2^32 #12200
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12200"
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 MarcZX10 on 2026-10-28T03:23:32Z.
What
A
DISPATCH_DIRECTwith the thread-dimension bit (packet[4] & 0x20) converts each thread count to a group count as(threads + groupThreads - 1) / groupThreadsin 32 bits. With a thread count withingroupThreads - 1of 2^32 the sum wraps: 0xffffffff threads in 64-thread groups gave 0 groups instead of 67108864. For a buffer fill that meant zero records, so the guest's clear was skipped while the submission still reported success;BufferCopycopied fewer elements the same way, and the dispatch's thread count used the same expression.The conversion is now one helper (
ThreadDimensionGroupsinDriver.hpp) that adds in 64 bits; the quotient always fits in 32 bits.BufferFill.cpp,BufferCopy.cppandDispatch.cppuse it.Two commits: the fix, then the test (
testThreadDimensionGroupsinSubmit.cpp: 0 threads, partial groups, one thread per group at 0xffffffff, and 0xffffffff in 64-thread groups).Tested
Linux x86-64, a throwaway archive build with the host CPU gate patched, lavapipe.
agc_driver_testspasses with the change ("AGC driver submit tests passed").tools/check_conventions.py --base upstream/mainandgit diff --checkpass. Not run against the unfixed code; the wrap follows from the 32-bit expression.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)