shader: decode FLAT, GLOBAL and SCRATCH D16 high-half loads #1924
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!1924
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1924/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?
@MrFr3di on GitHub · 2026-10-26 20:35 UTC · original
MrFr3di:shader/flat-d16-hi→main· +359 −38 · 6 files · 1 commits · merged 2026-10-26 21:34 UTCGame
Ghost of Yotei (PPSA26344, 02.002). Compute shader
0x79b0066f0cd1f3cdcontainsglobal_load_short_d16_hi v16, v18, s[0:1] offset:196(0xdc9480c4 0x10000012).FLAT-family opcode
0x25is not decoded on main (FLAT opcode is not implemented),so this shader cannot be recompiled while the game loads.
Change
0x25(FLAT/GLOBAL/SCRATCH_LOAD_SHORT_D16_HI) next to the low-half0x24.sdwa_sel = 5, other bits preserved). The existingpartial destination write then puts the raw halfword into bits
[31:16]and keeps bits[15:0],the same path
0x24and the BUFFER/DSD16_HIloads already use. No new IR opcode, emitter pathor Vulkan requirement.
Reference: AMD RDNA 2 ISA (FLAT D16_HI loads); LLVM
FLATInstructions.tdandflat-gfx10.s.Tests
shader_cfg: the captured instruction, the LLVM encoding offlat_load_short_d16_hi v1, v[3:4],offset and SADDR fields per segment, rejected modifiers, compile + SPIR-V validation.
shader_recompiler_compute(also in--flat-d16-only):0000/7fff/8000/ffffinto an old value, neighbour VGPR untouched;Testing
Windows 11, RTX 3060, clang-cl RelWithDebInfo:
shader_cfgshader_recompiler_compute_tests --flat-d16-onlyctest -R shader_recompiler_compute0x25to the low-half selector makes the decode test and each new GPU case fail.all three variants of CS
0x79b0066f0cd1f3cdare recompiled and loading continues.AI use
The implementation and testing were done with the help of Claude and Codex.
I reviewed the change myself.
@coderabbitai[bot] on GitHub · 2026-10-26 20:44 UTC · original
No actionable comments were generated in the recent review.
fee811c0-6f17-496b-ac98-a2c3c158072cReviewing files that changed from the base of the PR and between
f90a8b1589and6205f38801.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: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Walkthrough
The decoder now recognizes
FLAT_LOAD_SHORT_D16_HI, assigns it a partial-destination selector, and formats it as a memory instruction. The translator dispatches it throughFLAT_LOAD. New tests cover instruction decoding, address fields, high-half merging, partial EXEC masks, and execution at wave sizes 32 and 64.Suggested reviewers:
nmzik,claxten10Priority:
Normal
Change: Bug fix
Merge Risk:
Minimal · up to
6205fNo identified issue needs resolution before merge; normal checks still apply.
Pre-merge checks:
4 ·
1
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 3 functions across 4 files. (2 skipped: 2 too large.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.