shader: take the high half per lane in V_PK_FMAC_F16 #404

Manually merged
github merged 1 commit from gh-pr/404/head into gh-pr/404/base 2026-11-26 09:19:16 +00:00
Owner

@⁠brandostrong on GitHub · 2026-08-29 19:03 UTC · original
brandostrong:fix/vop2-pk-fmac-f16 → main · +74 −2 · 3 files · 1 commits · merged 2026-08-30 11:08 UTC

Problem

V_PK_FMAC_F16 is the only packed opcode reachable through VOP2, so it carries no OP_SEL field and the decoder left OP_SEL_HI clear. ReadF16LaneAsF32 picks a lane's half from OP_SEL_HI, so the high lane read the low half of src0, src1 and vdst and recomputed the low lane's result. vdst is also a source, so the error accumulates across a packed FMA chain.

Change

Set op_sel_hi on both sources and the destination in FinalizeVop2Instruction. Decoder only.

PackedFmacF16AccumulatesEachHalfIndependently fails on the previous decoder with [0x49804980] against expected [0x4fc04980] — the high half repeating the low lane's 11.0h instead of 31.0h. --pk-fmac-only runs it alone.

AI assistance

Claude again. This specific bug broke a compute shader in gta 5 and likely would also be causing problems across other game shaders that rely on fp16 multiply-accumulate operations(at least on vop2), since the bug would be sending valid but incorrect values.

**@⁠brandostrong** on GitHub · 2026-08-29 19:03 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/404) `brandostrong:fix/vop2-pk-fmac-f16` → `main` · +74 −2 · 3 files · 1 commits · merged 2026-08-30 11:08 UTC ## Problem `V_PK_FMAC_F16` is the only packed opcode reachable through VOP2, so it carries no `OP_SEL` field and the decoder left `OP_SEL_HI` clear. `ReadF16LaneAsF32` picks a lane's half from `OP_SEL_HI`, so the high lane read the low half of `src0`, `src1` and `vdst` and recomputed the low lane's result. `vdst` is also a source, so the error accumulates across a packed FMA chain. ## Change Set `op_sel_hi` on both sources and the destination in `FinalizeVop2Instruction`. Decoder only. `PackedFmacF16AccumulatesEachHalfIndependently` fails on the previous decoder with `[0x49804980]` against expected `[0x4fc04980]` — the high half repeating the low lane's `11.0h` instead of `31.0h`. `--pk-fmac-only` runs it alone. ## AI assistance Claude again. This specific bug broke a compute shader in gta 5 and likely would also be causing problems across other game shaders that rely on fp16 multiply-accumulate operations(at least on vop2), since the bug would be sending valid but incorrect values.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:19:13 +00:00
github manually merged commit 70d08e36cd into gh-pr/404/base 2026-11-26 09:19:16 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.