feat(shader): accept SDWA byte destination selectors on v_cvt_i16_f16 #17967

Merged
Zyylon merged 1 commit from upstream-pr/17967 into main 2026-11-15 20:22:38 +00:00
Zyylon commented 2026-11-10 01:41:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Zyylon on 2026-11-10T01:41:36Z.


What

Accept Sub-Dword Addressing (SDWA) byte destination selectors on v_cvt_i16_f16 (VOP1 opcode 0x53).

Updates vop1SdwaRules for VCvtI16F16 to allow sdwaSelBytes() | sdwaSelWords() (previously restricted to sdwaSelWords()). In AMD RDNA2 ISA §13.3.7 Table 88, 16-bit destination instructions accept byte destination selectors (BYTE_0..BYTE_3) alongside word destination selectors (WORD_0, WORD_1) and destination unused modes UNUSED_PAD, UNUSED_SEXT, and UNUSED_PRESERVE.

Sources:

  • AMD RDNA2 ISA Manual §§6.8, 12.8 opcode 83, 13.3.7 Table 88
  • LLVM 19.1.0 VOP1Instructions.td (lines 392-393) and SIPeepholeSDWA.cpp destination folding
  • Canonical technical debt documented in docs/dev/debt/shader.md under ### Functional strictly < 1000 characters

Tested

  • Physical GPU execution test agc_driver_sdwa_cvt_i16_f16_bytes executed on host AMD Radeon (TM) Graphics (Radeon 780M, driver 32.0.22050.4002, LLPC 25.20.50.04, Vulkan 1.4.329, Windows 11 Enterprise 26300):
    • Wave32: passed (returncode 0)
    • Wave64: passed (returncode 0)
  • Tested under Vulkan validation layers (ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation) with 5/5 consecutive passing CTest runs:
    • 0 VUID- validation errors
    • 0 missing layer warnings
  • Cross-vendor GPU verification on NVIDIA GeForce RTX 3070 (8 GB, driver 610.57.04, Debian 13, kernel 6.12.115, GCC 13.3.0 Release, Vulkan validation layer 1.4.335):
    • 26 of 26 SDWA tests passed 3 of 3 runs each under Vulkan validation layers (0 VUID- lines, 0 missing layer warnings)
    • Both -3.0 and 1000.0 pinned test rows passed
  • Hardware verification on AMD Radeon RX 6700 XT (driver 32.0.21045.16010, Windows 11 Enterprise) by @JJenkx (6/6 passed).
  • Native HIP oracle and recompiler verification across Radeon iGPU (gfx1036) and RX 9070 XT by @Nawid3333.
  • Verified 8 pinned input float16 values through 16-bit signed integer conversions (including negative -3.0 and byte with bit 7 set 1000.0), 6 sub-dword destination selections (BYTE_0..BYTE_3, WORD_0, WORD_1), and 3 unused modes (UNUSED_PAD, UNUSED_SEXT, UNUSED_PRESERVE).
  • Negative control test before implementation confirmed decoder threw std::invalid_argument on destination.sdwaSel == 0 (VOP1 SDWA destination selector 0 (unused 2, source selector 4) of opcode 0x53 at pc 0x0 is not supported).
  • Negative refusal tests confirming decoder throws std::invalid_argument on invalid selector 7, illegal destination unused mode 3, and SDWA omod on integer destination.
  • Clean 3-way mergeability confirmed against all 11 active sibling pull requests.
  • Passed python tools/check_conventions.py --base origin/main with 100% compliance.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: AMD Radeon (TM) Graphics (Radeon 780M), AMD Radeon RX 6700 XT, NVIDIA GeForce RTX 3070 (8 GB)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5234250637 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17967). Originally posted by [Zyylon](https://github.com/Zyylon) on 2026-11-10T01:41:36Z. --- ### What Accept Sub-Dword Addressing (SDWA) byte destination selectors on `v_cvt_i16_f16` (VOP1 opcode 0x53). Updates `vop1SdwaRules` for VCvtI16F16 to allow sdwaSelBytes() | sdwaSelWords() (previously restricted to sdwaSelWords()). In AMD RDNA2 ISA §13.3.7 Table 88, 16-bit destination instructions accept byte destination selectors (BYTE_0..BYTE_3) alongside word destination selectors (WORD_0, WORD_1) and destination unused modes UNUSED_PAD, UNUSED_SEXT, and UNUSED_PRESERVE. Sources: - AMD RDNA2 ISA Manual §§6.8, 12.8 opcode 83, 13.3.7 Table 88 - LLVM 19.1.0 VOP1Instructions.td (lines 392-393) and SIPeepholeSDWA.cpp destination folding - Canonical technical debt documented in docs/dev/debt/shader.md under ### Functional strictly < 1000 characters ### Tested - Physical GPU execution test `agc_driver_sdwa_cvt_i16_f16_bytes` executed on host AMD Radeon (TM) Graphics (Radeon 780M, driver 32.0.22050.4002, LLPC 25.20.50.04, Vulkan 1.4.329, Windows 11 Enterprise 26300): - Wave32: passed (returncode 0) - Wave64: passed (returncode 0) - Tested under Vulkan validation layers (ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation) with 5/5 consecutive passing CTest runs: - 0 VUID- validation errors - 0 missing layer warnings - Cross-vendor GPU verification on NVIDIA GeForce RTX 3070 (8 GB, driver 610.57.04, Debian 13, kernel 6.12.115, GCC 13.3.0 Release, Vulkan validation layer 1.4.335): - 26 of 26 SDWA tests passed 3 of 3 runs each under Vulkan validation layers (0 VUID- lines, 0 missing layer warnings) - Both -3.0 and 1000.0 pinned test rows passed - Hardware verification on AMD Radeon RX 6700 XT (driver 32.0.21045.16010, Windows 11 Enterprise) by @JJenkx (6/6 passed). - Native HIP oracle and recompiler verification across Radeon iGPU (gfx1036) and RX 9070 XT by @Nawid3333. - Verified 8 pinned input float16 values through 16-bit signed integer conversions (including negative -3.0 and byte with bit 7 set 1000.0), 6 sub-dword destination selections (BYTE_0..BYTE_3, WORD_0, WORD_1), and 3 unused modes (UNUSED_PAD, UNUSED_SEXT, UNUSED_PRESERVE). - Negative control test before implementation confirmed decoder threw std::invalid_argument on destination.sdwaSel == 0 (VOP1 SDWA destination selector 0 (unused 2, source selector 4) of opcode 0x53 at pc 0x0 is not supported). - Negative refusal tests confirming decoder throws std::invalid_argument on invalid selector 7, illegal destination unused mode 3, and SDWA omod on integer destination. - Clean 3-way mergeability confirmed against all 11 active sibling pull requests. - Passed python tools/check_conventions.py --base origin/main with 100% compliance. ### 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/CONTRIBUTING.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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: AMD Radeon (TM) Graphics (Radeon 780M), AMD Radeon RX 6700 XT, NVIDIA GeForce RTX 3070 (8 GB) - [x] AI-assisted: yes
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!17967
No description provided.