Recompiler: since #2083, the f32 NaN select adds a SelectU32 reader of the packed pixel ancillary word, and 2 of 4 Stray S5a shaders fail again #2881
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 fisherjoey on 2026-10-10T17:25:14Z.
#2083 (merged 2026-10-09) picks f32 arithmetic NaN results on the bits with a select. In two of Stray's S5a pixel shaders, that select reads the packed pixel ancillary word. The ancillary lowering only accepts readers that extract a modelled field, so these two shaders fail again with
packed pixel ancillary input has an unsupported live use (used by SelectU32 ? ?). #1904 made all four compile before #2083 landed.Results
Offline replay: the real
ShaderRecompiler::Recompileon the requests Stray (PPSA02100) logged for these shaders, CPU only.main78aedb40(has #1904 and #2083)mainbc40a6b5+ #19046b41cf4dgit revert -m1 a8b032b2)Both failures read
shader info collection failed: packed pixel ancillary input has an unsupported live use (used by SelectU32 ? ?).To find the cause I bisected
main's first-parent history with the #1179 + #1904 code applied at each step.f1451396gives 4 of 4, and the next merge,a8b032b2(#2083), gives 2 of 4. Reverting #2083 on currentmainconflicts with later changes inFloatInstructions.cppandTranslationContext.hpp, which is why the revert row usesbc40a6b5.Related
bc40a6b5.(used by SelectU32)in #2749 may be this issue rather than #2548. I haven't checked them one by one.Possible fixes
Either the ancillary lowering accepts this select, or #2083 leaves the select out when the operand is the ancillary input. I don't have a branch for this yet. I can write one for whichever side you prefer.
Setup
Linux, Release build with
ANYPS5_ENABLE_SPIRV_TOOLS=ON, fresh shader disk cache for each replay. The requests are serialization version 13 and currentmainreads them directly. The other two S5a shaders (0x200e4d0000, 0x200e680000) can't be replayed offline because the SRT walk needs guest memory, so they aren't counted.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by LeandroSSB on 2026-10-11T01:14:26Z.
The "#2083 leaves the select out" option is implemented on my fork:
LeandroSSB/AnyPS5:fix/ancillary-nan-select(one commit,0467f908, onmainf1ae427b; the 11 commits since don't touch the recompiler's translation sources, only TechnicalDebt.md moved).nanResultF32returns the result unchanged — no selects emitted, pre-#2083 behavior exactly for that instruction — when any f32 source traces to the pixel input's ancillary VGPR. Walking toGetBuiltin(PackedAncillary)is impossible at translate time (SsaBuilderlinks the seed only after translation), so the walk chases the loader chain (BitCastF32U32/BitCastU32F32, abs/negBitwiseAnd32/BitwiseXor32, the denormal-flushSelectU32, the fma zero-factorSelectF32,DppMoveU32) down toGetVectorRegisterand compares the register index againstpsInputVgpr[Ancillary]— the same mapping the seed site uses. Because a translate-time read cannot know whether the seed or a later write dominates, adds on a reused ancillary VGPR also skip; that is what the real S5a shaders need (their adds read the reused register) and it only ever restores pre-#2083 semantics; it is recorded in TechnicalDebt, together with the unverified NaN-patterned-bit case (bits 6, 7, 12-15, 29-31 have no gfx1013 source per the table in #2548).Tested on Linux (GCC, full build, lavapipe, CI flags): the new
agc_driver_pixel_ancillary_nan(pixel stage with the ancillary input;v_movreuse +v_add_f32on the reused VGPR; Recompile must succeed in both float modes and the draw must show plain add semantics) passes including its Vulkan draw;agc_driver_f32_arithmetic_nan(#2083's own test) passes unchanged;pixel_ancillaryand its refusal contract are untouched and pass; fullctestshows exactly the three failures this environment also has onmain(import_audit,agc_driver_flat_apertures,agc_driver_image_packed16_load) — no new failures.Honest limitation: a single-add synthetic program also compiles with the select present (
MaskedSelectEliminatorremoves the masked copy in the simple shape), so the new test locks in the post-fix behavior but cannot by itself prove the skip fires. The decisive check is your offline replay: could you run0x200e360000and0x200e3c0000on this branch? If either shader contains an fma or a sub on the reused VGPR, those paths would be exercised too (the test only covers the add path). If the replay shows 4/4, this closes the regression; if not, the ancillary-lowering option is the remaining side.Not opened as a PR because of the intake pause; a maintainer is welcome to carry the commit.
AI-assisted (Claude Code); I reviewed the change and ran everything above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by ThatsLeo on 2026-10-11T12:01:15Z.
On
main8ec0e131this is gone for Stray: all 41 of its shaders that failed here compile, including the 10 that a helper-lane rule on the ancillary lowering could not take. Offline replay of the requests Stray (PPSA02101 v01.002) dumped onf1ae427b, where 31 of the 41 failed withpacked pixel ancillary input has an unsupported live use (used by SelectU32 ? ?).#3279's masked-lane proofs remove the select that keeps the word on lanes the initial EXEC leaves out, so the ancillary lowering no longer sees it.
0467f908was not needed for any of them; with it onf1ae427b, all 31 still failed.Two of the shaders (
0x200f780000,0x200f7a0000) now take 150 and 400 s to prepare: #3504.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-11T12:41:29Z.
@ThatsLeo thanks for the replay. That matches what the issue described: the select #2083 adds is one the masked-lane proofs in #3279 now remove, so the ancillary lowering on
mainno longer sees it. Closing as fixed by #3279. The slow preparation of the two shaders you found is tracked in #3504.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by LeandroSSB on 2026-10-11T13:20:07Z.
With #3279 resolving this on
main(ThatsLeo's replay: all 41 Stray shaders compile), my branch above is superseded — no carry needed. The TechnicalDebt note about unverified NaN-patterned ancillary bits (bits 6, 7, 12-15, 29-31 without a gfx1013 source, per the table in #2548) still applies to whatever path reads those bits and may be worth keeping in mind for #2548.