shader: support DS_WRITE_B8_D16_HI #794
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!794
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/794/head"
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?
@DenizSAHIN570 on GitHub · 2026-09-23 20:23 UTC · original
DenizSAHIN570:feat/ds-write-b8-d16-hi→main· +60 −1 · 6 files · 1 commits · merged 2026-09-23 20:44 UTCSummary
Rationale
A GTA V (PPSA04264) compute shader contains this instruction and was rejected by the CFG builder:
The encoding comes from LLVM's AMDGPU backend (
DS_Real_gfx10<0x0a0>, next to DS_WRITE_B16_D16_HI at 0xa1 and the D16 reads at 0xa6/0xa7 already handled here). The semantics come from LLVM's selection pattern for it,DSWritePat<DS_WRITE_B8_D16_HI, i32, truncstorei8_hi16_local>, wheretruncstorei8_hi16istruncstorei8(srl(value, 16)), i.e. bits 23:16. I did not check AMD's ISA document itself.Validation
kyty_testsbuild against current main (569ec04)shader_cfg_tests: passed, including a decode check of the captured words above (address v19, data v20, offset 0x200, 8-bit data, sdwa_sel 2)DsWriteB8D16HiWritesByteTwo: pre-fills LDS with 0xdeadbeef, writes bits 23:16 of 0x11a22233 (0xa2) to byte address 1, reads the dword back and expects 0xdeada2ef. All four source bytes differ, so any other byte selection fails. It also checks that an unrelated VGPR is untouched.expected 0xdeada2ef, actual 0xdead33ef.shader_recompiler_compute_tests: the full run does not complete on my machine (Radeon RX 9070 XT, Mesa RADV), and it aborts identically on unmodified main at569ec04:GpuTilerCpuParity failed at detile bytes family=4 bpe=1(addressed in a separate PR)image format does not support required usage: format=129, because this GPU does not support D24_UNORM_S8_UINTSo I ran the DS cases through a local name filter that is not part of this PR: 31 DS cases pass on unmodified main; with this change 32 pass, the only difference being the new case. The opcode coverage check passes as well.
DS_OPCODE_LISTfollows the one-entry-per-line style of its neighbours. The pinned clang-format would re-pack that whole table even on unmodified main, so I did not reflow it. The other source edits are clean under the pinned formatter.Scope
This PR only adds DS_WRITE_B8_D16_HI.
AI assistance
An AI coding assistant was used for this change: to help analyse the failure, to draft the implementation and the tests, and to draft this description. I reproduced the original failure by running the game on my own machine and I reviewed the complete diff. The builds and test runs above were done in my environment and I checked their output. All communication on this PR comes from me.
@coderabbitai[bot] on GitHub · 2026-09-23 20:30 UTC · original
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
05b44081-e839-48c8-bac2-c186c364f251📥 Commits
Reviewing files that changed from the base of the PR and between
569ec04d1aand7611bcd8f3.📒 Files selected for processing (6)
src/graphics/shader/recompiler/frontend/decode/MemoryOps.cppsrc/graphics/shader/recompiler/frontend/decode/ShaderDecoder.cppsrc/graphics/shader/recompiler/frontend/decode/ShaderDecoder.hsrc/graphics/shader/recompiler/frontend/translate/Memory.cpptests/ShaderRecompilerComputeTests.cpptests/shaderCfgTests.cppIncluded review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Walkthrough
The change adds the
DS_WRITE_B8_D16_HIopcode to the shader decoder and translator. The decoder maps opcode0xa0to an 8-bit write and selects source byte 2. The translator includes the opcode in operand selection and dispatch. Tests check decoded instruction fields, the written 32-bit value, and the decoded opcode count.Suggested reviewers:
nmzikMerge Risk: ⚪ Minimal · up to
7611bThe new byte-write path has no identified merge-blocking issue after normal checks.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 4 files. (2 skipped: 2 too large.)
Comment
@coderabbitai helpto get the list of available commands.