perf(shader): compute v_dot4 with packed integer dot products #5337

Closed
ErenYeager1836 wants to merge 1 commit from upstream-pr/5337 into main
ErenYeager1836 commented 2026-10-13 17:26:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ErenYeager1836 on 2026-10-13T17:26:23Z.


What

v_dot4_i32_i8, v_dot4c_i32_i8 and v_dot4_u32_u8 extract the four bytes of each source, multiply them pairwise and add the products to the accumulator. On GPUs supporting VK_KHR_shader_integer_dot_product with packed 4x8-bit dot products, this maps to hardware instructions (OpSDot / OpUDot with PackedVectorFormat4x8Bit, e.g. IDP.4A on NVIDIA) instead of individual byte extracts and arithmetic.

  • Enables DotProduct and DotProductInput4x8BitPacked SPIR-V capabilities when supported by the Vulkan target.
  • Adds IR operations SDot4x8 and UDot4x8 lowered directly to packed dot instructions.
  • Maintains fallback byte-extract lowering on devices without the feature.
  • Adds test cases in core/libs/prx/libSceAgcDriver/tests/execution/IntegerDot.cpp.

Carried from @karanvora2599 with author attribution preserved.

Tested

agc_driver_integer_dot test suite in AgcDriver execution tests. Passes conventions check.

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 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: none
  • Unblocks: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4846961143 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5337). Originally posted by [ErenYeager1836](https://github.com/ErenYeager1836) on 2026-10-13T17:26:23Z. --- ### What `v_dot4_i32_i8`, `v_dot4c_i32_i8` and `v_dot4_u32_u8` extract the four bytes of each source, multiply them pairwise and add the products to the accumulator. On GPUs supporting `VK_KHR_shader_integer_dot_product` with packed 4x8-bit dot products, this maps to hardware instructions (`OpSDot` / `OpUDot` with `PackedVectorFormat4x8Bit`, e.g. `IDP.4A` on NVIDIA) instead of individual byte extracts and arithmetic. - Enables `DotProduct` and `DotProductInput4x8BitPacked` SPIR-V capabilities when supported by the Vulkan target. - Adds IR operations `SDot4x8` and `UDot4x8` lowered directly to packed dot instructions. - Maintains fallback byte-extract lowering on devices without the feature. - Adds test cases in `core/libs/prx/libSceAgcDriver/tests/execution/IntegerDot.cpp`. Carried from @karanvora2599 with author attribution preserved. ### Tested `agc_driver_integer_dot` test suite in AgcDriver execution tests. Passes conventions check. ### 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 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: none - [x] Unblocks: none - [x] AI-assisted: yes
karanvora2599 commented 2026-10-13 21:53:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by karanvora2599 on 2026-10-13T21:53:51Z.


@ErenYeager1836, this is #4061 rebased onto main. #4061 was closed because no title's shaders run v_dot4_*: there are none in fma-rc's 837 shaders from 11 titles, so there's no frame to measure it on. Unless a title you run uses it, I'd close this one. If one does, its trace is what's missing.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6155998889 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5337#issuecomment-6155998889). Originally posted by [karanvora2599](https://github.com/karanvora2599) on 2026-10-13T21:53:51Z. --- @ErenYeager1836, this is #4061 rebased onto `main`. #4061 was closed because no title's shaders run `v_dot4_*`: there are none in fma-rc's 837 shaders from 11 titles, so there's no frame to measure it on. Unless a title you run uses it, I'd close this one. If one does, its trace is what's missing.
oneandonlydean commented 2026-10-14 02:28:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:28:31Z.


Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6159536283 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5337#issuecomment-6159536283). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T02:28:31Z. --- Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.

Pull request closed

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!5337
No description provided.