shader: IMAGE_ATOMIC_FMIN/FMAX + DPP8 (Ghost of Yōtei boot) #338

Closed
github-bot wants to merge 2 commits from gh-pr/338/head into gh-pr/338/base
Owner

@⁠foufouadi on GitHub · 2026-08-28 16:21 UTC · original
foufouadi:feat/image-atomic-fmin-fmax → main · +299 −18 · 16 files · 2 commits · closed without merging

Two shader-recompiler additions needed for Ghost of Yōtei's boot compute shaders. Refs #108.

I previously worked on Yōtei boot/GPU issues in SharpEmu and started testing the same title on Kyty. These were the first two shader blockers I hit.

1. IMAGE_ATOMIC_FMIN/FMAX

The first compute shader uses MIMG opcodes 0x1e/0x1f (IMAGE_ATOMIC_FMIN/FMAX) on an R32F storage image.

Only integer image atomics were decoded, so the shader was rejected during CFG construction and Kyty exited before opening a window.

  • decode / translate / IR: add ImageAtomicFMin32 / ImageAtomicFMax32
  • SPIR-V: implement the float atomic through a compare-and-swap loop on the raw 32-bit texel using OpImageTexelPointer + OpAtomicCompareExchange, matching the existing buffer/shared float atomic lowering and avoiding an SPV_EXT_shader_atomic_float dependency
  • resource/descriptors: allow k32SInt / k32Float atomic image descriptors and expose them as R32Uint

2. DPP8

The next blocker was src0 escape 0xe9 (0xea for fetch-inactive) on VOP1/VOP2/VOPC.

Only DPP16 (0xfa) was recognised, so the second dword was interpreted as a normal source operand and failed with:

unsupported scalar source operand 0xe9

This adds:

  • DPP8/DPP8FI decoding for VOP1, VOP2 and VOPC
  • Dpp8MoveU32 / Dpp8UpdateU32 IR operations
  • SPIR-V lowering using the 8×3-bit lane selectors and OpGroupNonUniformShuffle, following the existing DPP16 path

Testing

Ghost of Yōtei, Windows Release build, Vulkan with shader validation enabled:

  • before: 0 shaders compiled
  • after IMAGE_ATOMIC_FMIN/FMAX: 2
  • after DPP8: 22
  • no SPIR-V validation errors

Yōtei now gets past both recompiler blockers and stops later on an unrelated compute workgroup-size limit: LocalSize Z 256 > device max 64.

The changes only add previously unsupported opcodes/formats; existing shader paths are unchanged.

**@⁠foufouadi** on GitHub · 2026-08-28 16:21 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/338) `foufouadi:feat/image-atomic-fmin-fmax` → `main` · +299 −18 · 16 files · 2 commits · closed without merging Two shader-recompiler additions needed for Ghost of Yōtei's boot compute shaders. Refs #108. I previously worked on Yōtei boot/GPU issues in SharpEmu and started testing the same title on Kyty. These were the first two shader blockers I hit. #### 1. IMAGE_ATOMIC_FMIN/FMAX The first compute shader uses MIMG opcodes 0x1e/0x1f (IMAGE_ATOMIC_FMIN/FMAX) on an R32F storage image. Only integer image atomics were decoded, so the shader was rejected during CFG construction and Kyty exited before opening a window. - decode / translate / IR: add ImageAtomicFMin32 / ImageAtomicFMax32 - SPIR-V: implement the float atomic through a compare-and-swap loop on the raw 32-bit texel using OpImageTexelPointer + OpAtomicCompareExchange, matching the existing buffer/shared float atomic lowering and avoiding an SPV_EXT_shader_atomic_float dependency - resource/descriptors: allow k32SInt / k32Float atomic image descriptors and expose them as R32Uint #### 2. DPP8 The next blocker was src0 escape 0xe9 (0xea for fetch-inactive) on VOP1/VOP2/VOPC. Only DPP16 (0xfa) was recognised, so the second dword was interpreted as a normal source operand and failed with: unsupported scalar source operand 0xe9 This adds: - DPP8/DPP8FI decoding for VOP1, VOP2 and VOPC - Dpp8MoveU32 / Dpp8UpdateU32 IR operations - SPIR-V lowering using the 8×3-bit lane selectors and OpGroupNonUniformShuffle, following the existing DPP16 path #### Testing Ghost of Yōtei, Windows Release build, Vulkan with shader validation enabled: - before: 0 shaders compiled - after IMAGE_ATOMIC_FMIN/FMAX: 2 - after DPP8: 22 - no SPIR-V validation errors Yōtei now gets past both recompiler blockers and stops later on an unrelated compute workgroup-size limit: LocalSize Z 256 > device max 64. The changes only add previously unsupported opcodes/formats; existing shader paths are unchanged.
Yotei's boot compute shader 0xf00717de7b897c69 uses MIMG opcodes 0x1e/0x1f
(IMAGE_ATOMIC_FMIN / IMAGE_ATOMIC_FMAX) on an R32F storage image; the
recompiler decoded only the integer image atomics, so the shader was
rejected in the CFG stage and the emulator aborted before opening a window.

- decode: add IMAGE_ATOMIC_FMIN/FMAX (MIMG 0x1e/0x1f) to the atomic table,
  Opcode enum and the formatter
- translate: classify as StorageImageUint, extend the store/atomic source
  range, dispatch to new IR ValueOpcodes ImageAtomicFMin32/FMax32
- ir: declare the two ValueOpcodes and mark them ImageAccess::Atomic
- spirv: emit a float-ordered compare-and-swap loop on the raw 32-bit texel
  (OpImageTexelPointer as u32 + OpAtomicCompareExchange), matching the
  existing buffer/shared float-atomic lowering; no SPV_EXT_shader_atomic_float
  dependency
- resource materialization: accept k32SInt/k32Float (not only k32UInt) as
  atomic image descriptor formats -- the CAS loop is bit-exact regardless
- renderer descriptors: accept the same formats and view atomic storage
  images as R32Uint

Verified: the shader now recompiles; Yotei proceeds past this failure to a
separate unimplemented scalar source operand in another compute shader.
Ghost of Yotei's boot compute shaders use DPP8 lane-permute operands
(src0 escape 0xe9, and 0xea for fetch-inactive) on v_mov_b32 / VOP2 /
VOPC. The decoder only recognised the DPP16 escape (0xfa), so the second
dword was mis-parsed and decode failed with 'unsupported scalar source
operand 0xe9'.

- decode: Operand gains dpp8 / dpp8_lane_selectors / dpp8_fetch_inactive;
  ApplyDpp8Modifier and DecodeVop1/Vop2/Vopc DPP8[Fi] handlers, registered
  at escape 233/234 next to SDWA (249) and DPP16 (250)
- ir: Dpp8MoveU32 / Dpp8UpdateU32 value opcodes + Dpp8MoveFlags
- translate: emit Dpp8MoveU32 for a DPP8 source read, Dpp8UpdateU32 for a
  DPP8 vgpr read-modify-write (no row/bank mask, so write == exec)
- spirv: EmitDpp8TargetLane resolves the per-lane target within each group
  of 8 from the 8x3-bit selectors; Dpp8MoveU32 lowers to
  OpGroupNonUniformShuffle + inactive-lane handling, mirroring DppMoveU32
- SpirvEmitter: declare the subgroup shuffle / local-invocation-id
  requirements for the new opcodes

Verified: Ghost of Yotei goes from 2 to 22 compiled shaders with no
SPIR-V validation errors; it then hits a separate compute workgroup
size limit (LocalSize Z 256 > device max 64), unrelated to this change.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:16:47 +00:00
github-bot closed this pull request 2026-11-26 09:16:47 +00:00
Author
Owner

@⁠Nmzik on GitHub · 2026-10-10 02:32 UTC · original

3b9e176b70

**@⁠Nmzik** on GitHub · 2026-10-10 02:32 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/338#issuecomment-6092785063) 3b9e176b700ca2af543751c70b9489b71f967e5b

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.