Recompiler: "packed pixel ancillary input has an unsupported live use" for a plain v_bfe_u32 of the render target index #1903
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-08T23:11:10Z.
Stray (PPSA02100 v1.05, Unreal Engine 4) aborts a few minutes into start-up on a pixel shader:
Setup: Linux (Nobara 44, kernel 7.2), RTX 5070 Ti, NVIDIA 595.91.07. Base is
main1be6f9f1+ #861 + #1836 + #1893.The shader (0x200e360000) reads the render target index with the usual extract,
v_bfe_u32 v4, v4, 16, 11. In IR that becomesBitFieldUExtract(ancillary, And(16, 31), UMin(And(11, 31), Sub(32, And(16, 31)))).lowerPackedAncillaryonly runs whenConstantFoldervisits theGetBuiltin, and at that point the extract's offset and count are not constants yet. They fold later in the same pass, so the ancillary value is never lowered and shader info collection rejects it. The existingpixel_ancillarytest builds the extract with immediate operands, so it doesn't cover this shape.Fix: lower the ancillary from the
BitFieldUExtract/BitFieldSExtractfold case too, once that extract's own operands have folded. Replaying Stray's 32 deferred ancillary shaders through the recompiler, 6 compile with the fix. The other 26 use the raw ancillary value in aSelectU32and are a separate case. The PR has a test that fails onmainand passes with the fix. PR: #____AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T03:08:29Z.
Could you retest Stray on current main? #1179 now lowers the packed ancillary after the whole fold pass (its
LateFoldtest is thisAnd(16, 31)shape), which should cover thev_bfe_u32case here.Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-10T04:42:16Z.
I tested #1179's code on Stray before it merged, at b4e02e2d (the later rebase to
d8b1ad71only touched a TechnicalDebt line). It didn't cover these shaders: 0 of the 4 replayable ones compiled (0x200e360000, 0x200e3b0000, 0x200e3c0000, 0x200e8b0000), and in game all 6 stayed deferred and the draw failed.The late fold handles the
And(16, 31)shape, but in the real shaders the ancillary word also has an exec-maskedSelectU32copy. That copy still counts as a reader when the check runs, becauseMaskedSelectEliminatoronly removes it later, so #1179 refuses the whole word. #1904 covers that case, with anExtractVectorMaskedCopytest inpixel_ancillary, and with it all 4 compile.A different set of 26 Stray shaders reads the whole word after the VGPR is reused, which neither PR covers. That's #2548.
I can rerun Stray on current main to confirm, and will post the result here.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-10T11:43:18Z.
Retested on current
main(bc40a6b5, #1179 included), offline, with the realShaderRecompiler::Recompileon the requests Stray logged for these shaders:main: 0 of 4. All four fail in shader info collection withpacked pixel ancillary input has an unsupported live use. 0x200e360000 and 0x200e3c0000 report(used by BitFieldUExtract 16 11, SelectU32 ? ?), and 0x200e3b0000 and 0x200e8b0000 report(used by BitFieldUExtract 16 11).main+ #1904 (6b41cf4d, merges cleanly): 2 of 4. 0x200e3b0000 and 0x200e8b0000 compile. 0x200e360000 and 0x200e3c0000 still fail, now with(used by SelectU32 ? ?).That's lower than the 4 of 4 I reported earlier. That test ran on an older base that didn't include #2083, and #2083 is the difference. Bisecting
mainwith the #1179 + #1904 code applied at each step,f1451396gives 4 of 4 and the #2083 merge (a8b032b2) gives 2 of 4. Reverting #2083 on top ofmain+ #1904 brings it back to 4 of 4. #2083 picks f32 NaN results on the bits with a select, which adds anotherSelectU32reader of the packed ancillary word in two of these shaders, and #1904's lowering doesn't accept that reader. So either #1904 needs to handle that select, or #2083's select should skip the ancillary input. I can update #1904 to accept that select if that's where you'd like it handled.The other two Stray shaders in this group (0x200e4d0000, 0x200e680000) still can't be replayed offline because the SRT walk needs guest memory, so they aren't counted.
Setup: Linux, CPU-only replay (no game run), Release build with
ANYPS5_ENABLE_SPIRV_TOOLS=ON, fresh shader disk cache for each run. The requests are serialization version 13, which currentmainreads as-is, and re-serializing them reproduces the input byte for byte.AI-assisted: yes