Shader recompile fails on v_cvt_f16_u16 SDWA with a byte source select (Silent Hill: Townfall) #2747

Closed
opened 2026-10-10 12:45:32 +00:00 by tv7 · 3 comments
tv7 commented 2026-10-10 12:45:32 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by tv7 on 2026-10-10T12:45:32Z.


Title: Silent Hill: Townfall (PPSA33286 v02.003.000, UE).
Build: Windows 11 Pro (10.0.26200), MinGW GCC 15.2.0 (WinLibs UCRT), Release, RTX 3070. Still present on main b69270dd9.

Shader recompilation fails on a byte source select of v_cvt_f16_u16 SDWA:

VOP1 SDWA destination selector 4 (unused 2, source selector 3) of opcode 0x50

That is v_cvt_f16_u16_sdwa ... dst_sel:WORD_0 dst_unused:UNUSED_PRESERVE src0_sel:BYTE_3: the title converts the top byte of a register into the low half of another and keeps the high half. The VCvtF16U16 entry in vop1SdwaRules (RdnaVectorOpDecoder.cpp) only allows word and dword source selects. The generic SDWA source path already zero-extends a byte select, which is the u16 value the conversion expects, so allowing every source select is enough. Same kind of gap as #2200 (v_not_b32).

Fix ready

I opened it as #2695, which was closed by the intake rule. It is on my fork for anyone who can take it:
tv7/AnyPS5 fix/sdwa-cvt-f16-u16-byte-sources (one rule line + a GPU test).

  • Rule: {RdnaOpcode::VCvtF16U16, sdwaSelAll(), sdwaSelWords(), sdwaSelAll(), false}
  • New test agc_driver_sdwa_cvt_f16_u16 (tests/execution/SdwaCvtF16U16.cpp) runs the four byte selects on the GPU (BYTE_3 into WORD_0 and BYTE_1 into WORD_1 with UNUSED_PRESERVE, BYTE_0 and BYTE_2 into DWORD) and checks the converted halves and the preserved bits. It fails on main with the error above and passes with the fix; full ctest 707/707 on b5f5362d3, check_conventions passes.
  • With it, Silent Hill: Townfall's shaders recompile and the title moves on to its first presentation (#2102).

Not checked on hardware.

Investigated and written by Claude (AI assistant) on a contributor's machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5791335360 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2747). Originally posted by [tv7](https://github.com/tv7) on 2026-10-10T12:45:32Z. --- **Title:** Silent Hill: Townfall (PPSA33286 v02.003.000, UE). **Build:** Windows 11 Pro (10.0.26200), MinGW GCC 15.2.0 (WinLibs UCRT), Release, RTX 3070. Still present on `main` b69270dd9. Shader recompilation fails on a byte source select of `v_cvt_f16_u16` SDWA: ``` VOP1 SDWA destination selector 4 (unused 2, source selector 3) of opcode 0x50 ``` That is `v_cvt_f16_u16_sdwa ... dst_sel:WORD_0 dst_unused:UNUSED_PRESERVE src0_sel:BYTE_3`: the title converts the top byte of a register into the low half of another and keeps the high half. The `VCvtF16U16` entry in `vop1SdwaRules` (`RdnaVectorOpDecoder.cpp`) only allows word and dword source selects. The generic SDWA source path already zero-extends a byte select, which is the u16 value the conversion expects, so allowing every source select is enough. Same kind of gap as #2200 (`v_not_b32`). ### Fix ready I opened it as #2695, which was closed by the intake rule. It is on my fork for anyone who can take it: [tv7/AnyPS5 `fix/sdwa-cvt-f16-u16-byte-sources`](https://github.com/boykopovar/AnyPS5/compare/main...tv7:AnyPS5:fix/sdwa-cvt-f16-u16-byte-sources) (one rule line + a GPU test). - Rule: `{RdnaOpcode::VCvtF16U16, sdwaSelAll(), sdwaSelWords(), sdwaSelAll(), false}` - New test `agc_driver_sdwa_cvt_f16_u16` (`tests/execution/SdwaCvtF16U16.cpp`) runs the four byte selects on the GPU (BYTE_3 into WORD_0 and BYTE_1 into WORD_1 with UNUSED_PRESERVE, BYTE_0 and BYTE_2 into DWORD) and checks the converted halves and the preserved bits. It fails on `main` with the error above and passes with the fix; full `ctest` 707/707 on b5f5362d3, `check_conventions` passes. - With it, Silent Hill: Townfall's shaders recompile and the title moves on to its first presentation (#2102). Not checked on hardware. *Investigated and written by Claude (AI assistant) on a contributor's machine.*
MarcZX10 commented 2026-10-10 13:49:34 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T13:49:34Z.


I refreshed the original fix from tv7’s intake-closed PR #2695 onto the latest upstream main (de5e541d) at 411f3171f85edd54a23b4d2a621397fb22f1432d. The cherry-pick preserves Lexroid’s original authorship and Claude co-author attribution.

Check Result
Fresh Linux GCC 12.2 Release build of agc_driver_sdwa_cvt_f16_u16_tests Passed
agc_driver_sdwa_cvt_f16_u16 CTest on llvmpipe (LLVM 15.0.6) Passed; all four byte selectors executed
Baseline control with the decoder rule reverted Failed at recompile with the reported unsupported byte source selector
Conventions and git diff --check Passed

The refreshed fork branch is fix/sdwa-cvt-f16-u16-byte-sources-2747. I have not rerun on AMD/NVIDIA hardware or retested Silent Hill: Townfall; those results remain tv7’s reported evidence. I have not opened an upstream PR because intake still requires 20 merged PRs and my count is 15.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6098166273 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2747#issuecomment-6098166273). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-10T13:49:34Z. --- I refreshed the original fix from [tv7’s intake-closed PR #2695](https://github.com/boykopovar/AnyPS5/pull/2695) onto the latest upstream `main` (`de5e541d`) at [`411f3171f85edd54a23b4d2a621397fb22f1432d`](https://github.com/MarcZX100/AnyPS5/commit/411f3171f85edd54a23b4d2a621397fb22f1432d). The cherry-pick preserves Lexroid’s original authorship and Claude co-author attribution. | Check | Result | | --- | --- | | Fresh Linux GCC 12.2 Release build of `agc_driver_sdwa_cvt_f16_u16_tests` | Passed | | `agc_driver_sdwa_cvt_f16_u16` CTest on llvmpipe (LLVM 15.0.6) | Passed; all four byte selectors executed | | Baseline control with the decoder rule reverted | Failed at recompile with the reported unsupported byte source selector | | Conventions and `git diff --check` | Passed | The refreshed fork branch is [`fix/sdwa-cvt-f16-u16-byte-sources-2747`](https://github.com/MarcZX100/AnyPS5/tree/fix/sdwa-cvt-f16-u16-byte-sources-2747). I have not rerun on AMD/NVIDIA hardware or retested Silent Hill: Townfall; those results remain tv7’s reported evidence. I have not opened an upstream PR because intake still requires 20 merged PRs and my count is 15.
MarcZX10 commented 2026-10-10 16:25:17 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T16:25:17Z.


Update: the refreshed fix is now proposed upstream as #2838, based on current main. The PR preserves the original patch authorship and AI co-author attribution.

The focused Linux Release Vulkan test ran on llvmpipe and passed. I also verified a red/green baseline: reverting the selector rule makes the test fail with the reported unsupported byte selector, and restoring it passes. The PR intake, conventions, and Linux registration checks have passed; macOS and relinker checks are still running. I have not reproduced the title on hardware, so the Windows/RTX 3070 result remains the reporter evidence.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6099661955 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2747#issuecomment-6099661955). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-10T16:25:17Z. --- Update: the refreshed fix is now proposed upstream as [#2838](https://github.com/boykopovar/AnyPS5/pull/2838), based on current `main`. The PR preserves the original patch authorship and AI co-author attribution. The focused Linux Release Vulkan test ran on llvmpipe and passed. I also verified a red/green baseline: reverting the selector rule makes the test fail with the reported unsupported byte selector, and restoring it passes. The PR intake, conventions, and Linux registration checks have passed; macOS and relinker checks are still running. I have not reproduced the title on hardware, so the Windows/RTX 3070 result remains the reporter evidence.
MarcZX10 commented 2026-10-10 16:28:08 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T16:28:08Z.


CI update for #2838: the Linux, macOS, and Windows relinker jobs passed, as did all register-context jobs, the macOS arm64 write-watch job, intake, conventions, and eligibility. The macOS Intel write-watch job failed only because write_watch_threads exceeded the 30-second CTest timeout; its other four tests passed. GitHub refused to rerun the failed job because it considers the workflow file broken. This job is unrelated to the shader decoder and its test.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6099687497 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2747#issuecomment-6099687497). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-10T16:28:08Z. --- CI update for [#2838](https://github.com/boykopovar/AnyPS5/pull/2838): the Linux, macOS, and Windows relinker jobs passed, as did all register-context jobs, the macOS arm64 write-watch job, intake, conventions, and eligibility. The macOS Intel write-watch job failed only because `write_watch_threads` exceeded the 30-second CTest timeout; its other four tests passed. GitHub refused to rerun the failed job because it considers the workflow file broken. This job is unrelated to the shader decoder and its test.
Sign in to join this conversation.
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#2747
No description provided.