Recompiler: v_fma_mix* in FLOAT_MODE 0xcc (f16 rounding toward zero) is not implemented; ps5-opengl (PPSA99005) stops at its first draw #2631
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-10T08:51:55Z.
ps5-opengl (PPSA99005 v1.0.1, blackbearreloaded/ps5-opengl) stops at its first draw in the shader recompiler:
FLOAT_MODE204 is0xcc: f32 rounds to nearest even with denormals flushed, and f16/f64 keep denormals but round toward zero (FP_ROUND_16_64= 3). So it is the f16 rounding mode that is missing here, not the denormal handling:FloatInstructions.cpp:221acceptsv_fma_mix*only whenFLOAT_MODE & 0xccis0xc0(round to nearest even, denormals kept). Packed f16 instructions have the same check at line 14. Related to #981 (float mode is per shader).How it gets there: on
main42542127the title stops at the_umtx_opimport. With the three PRs still open on its path on top, #1482 (_umtx_op), #2106 rebased (pthread_sigmask) and #1872 (pthread_set_name_np), plus #2627 (compute headers without specials, merged since), it loads, Mesa reportsready GL=4.6 (Core Profile) Mesa 26.2.0 GLSL=4.60 size=3840x2160, and the first draw stops here (2 of 2 runs).Radeon 860M (RDNA 3.5), Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release. The title's own log (
download0/ps5-opengl.log) also prints the shader that fails, base64-encoded, right after the error.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-10T11:00:45Z.
Fix: AlxcBTW/AnyPS5#19 (
afba6fe4, onmainbe403084).v_fma_mixlo_f16andv_fma_mixhi_f16now round the exact product-sum once in the mode's f16 direction. The sum is already computed in f64 with round to odd; it is scaled by the f16 step, truncated, floored or ceiled, and scaled back. With f16 denormals flushed they still throw. Packed f16 is unchanged.TechnicalDebt records one directed row measured on gfx1036:
-1.5 * 2^-24 + 2^-126gives0x8002with f16 rounding toward -infinity. This change gives0x8002too. Round toward zero, the mode ps5-opengl uses, and toward +infinity follow the same rule but are not measured. Full CI passed, merged ontomain507f49fb. I can't open it as a PR while intake is limited, so it's here if a collaborator wants to cherry-pick it.Tested on Windows 11 with an RTX 5070 Laptop and a Radeon 880M:
agc_driver_mix_precisiongains ten rows, each run in all four rounding modes. Their expected values are the exact product-sum rounded with Pythonfractions.vector_fused_multiply_addnow expects the directed modes to be translated and checks the rounding field in the mode operand.agc_driverfloat tests pass on both GPUs.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-10T12:21:01Z.
Measured on RDNA2 hardware (gfx1036, Ryzen 7950X3D iGPU,
tools/hw-oracle) and compared withmain197ffac9and with AlxcBTW/AnyPS5#19 (afba6fe4, cherry-picked onto it). Both ran throughKernelReplay, on the same iGPU through RADV (Mesa 26.2.4) and on an RTX 3080 (NVIDIA 615.71.09). Linux (CachyOS, kernel 7.2.9, GCC 16.2.1), Release withANYPS5_ENABLE_SPIRV_TOOLS=ON.With #19, rounding toward zero (0xcc, the mode ps5-opengl uses) and toward +∞, which #19 lists as not measured, match the hardware on all 2,233 rows on both hosts. The TechnicalDebt row (
-1.5 * 2^-24 + 2^-126) gives 0x8002 toward −∞ and 0x8001 in the other three directions, on the hardware and with #19.Rows:
Each row runs through four forms:
v_fma_mixlo_f16andv_fma_mixhi_f16with three f32 sources,v_fma_mixlo_f16with f16 lo × f16 hi + f32, andv_fma_mixlo_f16with f32 × f16 lo + f16 hi. The f16 sources are a random normal f16 pair from [−4, 4] in every row, so those two forms gave no zero or subnormal result. The mode keeps f16 denormals and flushes f32 denormals (0xc0 | round16 << 2), at IEEE=0.mainThe counts are the same on both hosts. With #19, round to nearest even and toward zero also give 0 at IEEE=1, and toward zero gives 0 with f32 denormals kept.
1.0 * 1.0 + -1.0and2.0 * 1.0 + -2.0. The hardware gives −0 (0x8000 in the low half formixlo, 0x8000 in the high half formixhi), as IEEE 754 does for an exact zero sum rounded toward −∞; #19 gives +0.v_fma_mixlo/mixhi_f16 at pc 84 in FLOAT_MODE 12 (f16 denormals not kept) is not implemented, as its description says.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-10T12:55:01Z.
@SleglJan thank you for the measurement. I fixed the two rows toward −∞ in AlxcBTW/AnyPS5#19 (
a83dadf9, on top ofafba6fe4; full CI passed). The f64 sum is computed to nearest, so an exact cancellation like1.0 * 1.0 + -1.0came out +0. In that mode an exact zero sum now gives −0 unless both the product and the addend are +0, as IEEE 754 does for rounding toward −infinity. A nonzero sum that rounds to zero keeps its sign, so a tiny positive sum still gives +0.agc_driver_mix_precisiongains six rows for this: both of your cancellations,+0 + −0,−0 + −0, and ±2^-26 (a tiny positive gives +0 toward −∞ and a tiny negative gives 0x8001). They pass on an RTX 5070 Laptop and a Radeon 880M.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-10T13:15:31Z.
A second title stops here: PokeMMO Prospero (PPSA98001) on Windows. With its imports added (#1482, #2106, #1872 and
siglongjmpfrom AlxcBTW/AnyPS5#23), it stops after about 6 s atv_fma_mixlo/mixhi_f16 at pc 116 in FLOAT_MODE 204 … is not implemented. With AlxcBTW/AnyPS5#19 (a83dadf9) on top, it stays up for the full 40 s and draws its start screen at about 54 FPS on an RTX 5070 Laptop.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-10T14:35:15Z.
Rerun of the same sweep at a83dadf9 (both commits of AlxcBTW/AnyPS5#19 cherry-picked onto
main197ffac9). Same hosts and setup as above.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-10T16:51:44Z.
Thanks @SleglJan. Your rerun shows #19 at
a83dadf9matching the hardware in all four f16 rounding modes, for all four forms, on RADV and on the RTX 3080: 0 of 2,233 rows differ, including the two exact cancellations toward −∞. FLOAT_MODE 12 (f16 denormals flushed) still stops with the not-implemented message, as intended.AI-assisted: yes