feat(shader): accept SDWA byte destination selectors on v_cvt_norm_i16_f16 #28007

Open
cmsierrave-coder wants to merge 1 commit from upstream-pr/28007 into main
cmsierrave-coder commented 2026-11-28 03:40:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by cmsierrave-coder on 2026-11-28T03:40:17Z.


What

Enable SDWA byte destination selectors (BYTE_0..BYTE_3) alongside WORD_0/WORD_1 for RdnaOpcode::VCvtNormI16F16 (v_cvt_norm_i16_f16, VOP1 opcode 0x63) in core/shader/recompiler/RdnaDecoder/src/RdnaVectorOpDecoder.cpp.

The translation path (vCvtNormF16 -> write16Bits -> writeRawU32) already implements byte and word SDWA destination placement (BYTE_0..BYTE_3, WORD_0, WORD_1) with UNUSED_PAD, UNUSED_SEXT, and UNUSED_PRESERVE, matching v_cvt_norm_u16_f16. Added SdwaCvtNormI16F16Bytes.cpp (decoder acceptance/rejection checks + Wave32/Wave64 GPU execution tests across all byte/word destination selectors, unused modes, and WORD_1 neg), its Wave64 CMake test registration fragment, and a technical debt fragment in docs/dev/debt/changes/feat-shader-sdwa-cvt-norm-i16-f16-bytes.md.

Tested

Paired Vulkan validation on Windows 11 (non-elevated VK_LAYER_PATH with VK_LAYER_KHRONOS_validation 1.4.363, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer) comparing origin/main (a4ebd9084cc) vs this branch:

  • origin/main baseline (ctest -R "^agc_driver_sdwa_cvt_norm_(f16|u16_f16_bytes)(_wave64)?$" -V): 4/4 passed (agc_driver_sdwa_cvt_norm_f16, agc_driver_sdwa_cvt_norm_f16_wave64, agc_driver_sdwa_cvt_norm_u16_f16_bytes, agc_driver_sdwa_cvt_norm_u16_f16_bytes_wave64), 7.24 s, 0 skipped, 4/4 Insert instance layer "VK_LAYER_KHRONOS_validation", 0 VUID-/SYNC-HAZARD-/UNASSIGNED- errors.
  • Branch shared (ctest -R "^agc_driver_sdwa_cvt_norm_(f16|u16_f16_bytes)(_wave64)?$" -V): 4/4 passed, 7.28 s, 0 skipped, 4/4 layer insertions, 0 VUID-/SYNC-HAZARD-/UNASSIGNED- errors.
  • Branch new (ctest -R "^agc_driver_sdwa_cvt_norm_i16_f16_bytes(_wave64)?$" -V): 2/2 passed (agc_driver_sdwa_cvt_norm_i16_f16_bytes, agc_driver_sdwa_cvt_norm_i16_f16_bytes_wave64), 4.26 s, 0 skipped, 2/2 layer insertions, 0 VUID-/SYNC-HAZARD-/UNASSIGNED- errors.
  • debt_fold.py --check: exit 0; check_conventions.py --base origin/main: All conventions checks passed. (0 findings, 0 errors); pr_overlap.py --branch feat/shader-sdwa-cvt-norm-i16-f16-bytes: 4/6 shared PRs compared cleanly with 0 overlap, and PRs 17606 (v_cvt_u16_f16) and 25964 (v_lshl_add_u32/v_add_lshl_u32) were manually verified not to touch VCvtNormI16F16.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: Intel(R) Iris(R) Xe Graphics (driver 32.0.101.7088), Windows 11 (10.0.26200.0), VK_LAYER_KHRONOS_validation 1.4.363
  • AI-assisted: yes

Summary by CodeRabbit

  • New Features
    • Added support for byte-level destination selection when converting 16-bit floating-point values to normalized 16-bit integers.
    • Added execution coverage for Wave32 and Wave64, including checks for partial-register results.
  • Tests
    • Added decoder and runtime tests for valid and invalid conversion settings.
  • Documentation
    • Documented the new byte-destination support and verification coverage.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5536318483 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/28007). Originally posted by [cmsierrave-coder](https://github.com/cmsierrave-coder) on 2026-11-28T03:40:17Z. --- ### What Enable SDWA byte destination selectors (`BYTE_0`..`BYTE_3`) alongside `WORD_0`/`WORD_1` for `RdnaOpcode::VCvtNormI16F16` (`v_cvt_norm_i16_f16`, VOP1 opcode `0x63`) in `core/shader/recompiler/RdnaDecoder/src/RdnaVectorOpDecoder.cpp`. The translation path (`vCvtNormF16` -> `write16Bits` -> `writeRawU32`) already implements byte and word SDWA destination placement (`BYTE_0`..`BYTE_3`, `WORD_0`, `WORD_1`) with `UNUSED_PAD`, `UNUSED_SEXT`, and `UNUSED_PRESERVE`, matching `v_cvt_norm_u16_f16`. Added `SdwaCvtNormI16F16Bytes.cpp` (decoder acceptance/rejection checks + Wave32/Wave64 GPU execution tests across all byte/word destination selectors, unused modes, and `WORD_1` `neg`), its Wave64 CMake test registration fragment, and a technical debt fragment in `docs/dev/debt/changes/feat-shader-sdwa-cvt-norm-i16-f16-bytes.md`. ### Tested Paired Vulkan validation on Windows 11 (non-elevated `VK_LAYER_PATH` with `VK_LAYER_KHRONOS_validation` 1.4.363, `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `VK_LOADER_DEBUG=layer`) comparing `origin/main` (`a4ebd9084cc`) vs this branch: - `origin/main` baseline (`ctest -R "^agc_driver_sdwa_cvt_norm_(f16|u16_f16_bytes)(_wave64)?$" -V`): 4/4 passed (`agc_driver_sdwa_cvt_norm_f16`, `agc_driver_sdwa_cvt_norm_f16_wave64`, `agc_driver_sdwa_cvt_norm_u16_f16_bytes`, `agc_driver_sdwa_cvt_norm_u16_f16_bytes_wave64`), 7.24 s, 0 skipped, 4/4 `Insert instance layer "VK_LAYER_KHRONOS_validation"`, 0 `VUID-`/`SYNC-HAZARD-`/`UNASSIGNED-` errors. - Branch shared (`ctest -R "^agc_driver_sdwa_cvt_norm_(f16|u16_f16_bytes)(_wave64)?$" -V`): 4/4 passed, 7.28 s, 0 skipped, 4/4 layer insertions, 0 `VUID-`/`SYNC-HAZARD-`/`UNASSIGNED-` errors. - Branch new (`ctest -R "^agc_driver_sdwa_cvt_norm_i16_f16_bytes(_wave64)?$" -V`): 2/2 passed (`agc_driver_sdwa_cvt_norm_i16_f16_bytes`, `agc_driver_sdwa_cvt_norm_i16_f16_bytes_wave64`), 4.26 s, 0 skipped, 2/2 layer insertions, 0 `VUID-`/`SYNC-HAZARD-`/`UNASSIGNED-` errors. - `debt_fold.py --check`: exit 0; `check_conventions.py --base origin/main`: `All conventions checks passed.` (0 findings, 0 errors); `pr_overlap.py --branch feat/shader-sdwa-cvt-norm-i16-f16-bytes`: 4/6 shared PRs compared cleanly with 0 overlap, and PRs 17606 (`v_cvt_u16_f16`) and 25964 (`v_lshl_add_u32`/`v_add_lshl_u32`) were manually verified not to touch `VCvtNormI16F16`. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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: Intel(R) Iris(R) Xe Graphics (driver 32.0.101.7088), Windows 11 (10.0.26200.0), VK_LAYER_KHRONOS_validation 1.4.363 - [x] AI-assisted: yes <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Added support for byte-level destination selection when converting 16-bit floating-point values to normalized 16-bit integers. * Added execution coverage for Wave32 and Wave64, including checks for partial-register results. * **Tests** * Added decoder and runtime tests for valid and invalid conversion settings. * **Documentation** * Documented the new byte-destination support and verification coverage. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Plyxen commented 2026-11-28 07:01:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-11-28T07:01:43Z.

Review: APPROVED


Checked head 05751a7ae1. All on Windows 11 with WinLibs GCC 15.2 (Release), applied to main 4c7578e0a4 together with #28006, #27985, #28002, #28001, #27991, #27987, #27994. tools/check_conventions.py --head and tools/debt_fold.py --check passed and the full build succeeded. In the full CPU suite (5,135 tests) the only failure is windows_read_trap_unknown, which fails on main too (fixed in #28028). The full GPU suite (2,249 tests) on both GPUs, with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer and the 1.4.363 layer inserted, matches main on the same machine. The GPUs were an NVIDIA RTX 5080 (621.24) and an AMD Radeon gfx1036 iGPU (26.11.2). Only agc_driver_linear_target_import_creation fails, as on main (fixed in #28029), and neither log has a VUID- or SYNC-HAZARD line.

agc_driver_sdwa_cvt_norm_i16_f16_bytes_wave64 passes. The GPU suite list above predates the new tests, so I applied this PR again with #28001 and #27987 and ran the new tests 3 times on each GPU with the same environment: all pass, with the layer inserted and no VUID- or SYNC-HAZARD line.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6096379547 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/28007#pullrequestreview-6096379547). Originally posted by [Plyxen](https://github.com/Plyxen) on 2026-11-28T07:01:43Z. **Review:** APPROVED --- Checked head `05751a7ae1`. All on Windows 11 with WinLibs GCC 15.2 (Release), applied to `main` `4c7578e0a4` together with #28006, #27985, #28002, #28001, #27991, #27987, #27994. `tools/check_conventions.py --head` and `tools/debt_fold.py --check` passed and the full build succeeded. In the full CPU suite (5,135 tests) the only failure is `windows_read_trap_unknown`, which fails on `main` too (fixed in #28028). The full GPU suite (2,249 tests) on both GPUs, with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer` and the 1.4.363 layer inserted, matches `main` on the same machine. The GPUs were an NVIDIA RTX 5080 (621.24) and an AMD Radeon gfx1036 iGPU (26.11.2). Only `agc_driver_linear_target_import_creation` fails, as on `main` (fixed in #28029), and neither log has a `VUID-` or `SYNC-HAZARD` line. `agc_driver_sdwa_cvt_norm_i16_f16_bytes_wave64` passes. The GPU suite list above predates the new tests, so I applied this PR again with #28001 and #27987 and ran the new tests 3 times on each GPU with the same environment: all pass, with the layer inserted and no `VUID-` or `SYNC-HAZARD` line. AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-11-28 07:25:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T07:25:26Z.

Review: COMMENTED


Reviewed — no blocking findings

Independent execution checks were not run in this review, so a formal approval is not justified; the author reports passing Vulkan tests and convention checks.

What I ran

Read the prepared diff and all four changed files at head 05751a7ae11b728554d85b8841ea41086e303d42 through repo_read.py; inspected the related translation path and neighboring test registration. No commands or tests were run.

Results

Check Result Note
Changed code review passed All four changed files read
Vulkan and convention checks not run Passes reported by author
Negative control not run Not run independently

Findings

Blocking

None.

Non-blocking

None.

Not verified

Build and test results were not independently verified. The reported Wave32/Wave64 Vulkan runs, convention checks, and PR overlap checks are author supplied. No repository files were excluded; all four changed files listed in the manifest were read.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6096487723 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/28007#pullrequestreview-6096487723). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-28T07:25:26Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Independent execution checks were not run in this review, so a formal approval is not justified; the author reports passing Vulkan tests and convention checks. ## What I ran Read the prepared diff and all four changed files at head `05751a7ae11b728554d85b8841ea41086e303d42` through `repo_read.py`; inspected the related translation path and neighboring test registration. No commands or tests were run. ## Results | Check | Result | Note | |---|---|---| | Changed code review | passed | All four changed files read | | Vulkan and convention checks | not run | Passes reported by author | | Negative control | not run | Not run independently | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Build and test results were not independently verified. The reported Wave32/Wave64 Vulkan runs, convention checks, and PR overlap checks are author supplied. No repository files were excluded; all four changed files listed in the manifest were read. ## To get this to a good state Nothing is required.
ligmaSec commented 2026-12-03 20:46:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T20:46:02Z.

Review: COMMENTED


The execution fixture checks low-word inputs and negated high-word inputs across the new destination bytes. The decoder also accepts the DWORD source selector with those destinations. Could one execution row use that selector with different low and high halves and verify which half contributes to the byte?

Source review at 05751a7ae1. The head trial-merges onto 700fae9438. Paired Vulkan execution is queued.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6178224552 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/28007#pullrequestreview-6178224552). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T20:46:02Z. **Review:** COMMENTED --- The execution fixture checks low-word inputs and negated high-word inputs across the new destination bytes. The decoder also accepts the DWORD source selector with those destinations. Could one execution row use that selector with different low and high halves and verify which half contributes to the byte? Source review at `05751a7ae1`. The head trial-merges onto `700fae9438`. Paired Vulkan execution is queued. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/28007:upstream-pr/28007'
git switch 'upstream-pr/28007'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/28007'
git switch 'upstream-pr/28007'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/28007'
git switch 'upstream-pr/28007'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/28007'
git switch 'main'
git merge --squash 'upstream-pr/28007'
git switch 'main'
git merge --ff-only 'upstream-pr/28007'
git switch 'main'
git merge 'upstream-pr/28007'
git push origin 'main'
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!28007
No description provided.