fix(recompiler): pair structurally equivalent whole-quad evaluations in stencil replay #9266
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9266"
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 akkadbakkad89 on 2026-10-21T16:57:41Z.
What
On devices without
VK_EXT_shader_stencil_export,MaskReplaySafetyonly accepts a whole-quad (WqmU64) mask expansion when the low and high words extract the sameWqmU64node at indices 0 and 1.IrProgram::CreateValuedoes not intern values, so a title whose compiler emitss_wqm_b64twice on equivalent ballot inputs produces two distinctWqmU64nodes; a mask pairingextract(wqmA, 0)withextract(wqmB, 1)was refused even though the two evaluations are semantically identical.This was observed on Assassin's Creed Shadows (PPSA20397, #8514): shader
0x407325e400composes its own-lane mask from two same-blocks_wqm_b64instructions overballot(exec)sources, captured viaagc_shader_replay --materializeon a liveRecompileRequest— the pairing gate reportspaired=0on object identity alone.Both
maskStable()andhelpers()now pair the words throughequivalentWqm(): twoWqmU64s are equivalent when their source trees match opcode-for-opcode, treating same values and equal immediates as equal, and requiring anyBallotpair to sit in the same block with no execution-mask-affecting instruction (SetExec,SetExecLo,SetExecHi,Discard,Sendmsg,SetThreadBitScalarRegister,SetScalarMaskTag) between them. When a distinct high-side evaluation is accepted its node tree is added torestrictedso the untracked-lane-op checks keep their strength.This is one of several verifier gaps this shader hits; on its own it does not unblock the title (the EXEC-copy provenance is #9017's scope, multi-block optional bodies are #9030's, and a further
quadObservedrejection of a merged phi feeding a nestedexeczcondition remains — detail posted on #8514).Tested
Windows 10 Pro 22H2, WinLibs GCC 15.2.0 r7, Debug, on main
cecb540a6.agc_masked_select, two new cases: a mask pairingextract(wqmA, 0)withextract(wqmB, 1)over structurally identical, same-block ballot trees is replay-safe (stencil replay pairs structurally equivalent whole-quad evaluations for split low and high words); the same pair separated bySetExecLois refused (stencil replay refuses to pair whole-quad evaluations separated by an execution-mask change). Reverting the pairing relaxation makes the first fail while the second still passes; all pre-existing cases pass unchanged.agc_shader_replay --materializeon the captured0x407325e400request (ANYPS5_NO_SHADER_CACHE=1): the two same-blockWqmU64s now pair (paired=1, verified by instrumented build); the check then proceeds to the unrelatedcontrol()/optionalBodygate covered by #9030.python3 tools/check_conventions.py --base origin/main: pass.python3 tools/pr_overlap.py --branch fix/stencil-replay-wqm-duplicates: no same-scope overlap (#9017 toucheshelpers()' ballot provenance, #9030 touchesoptionalBody— disjoint hunks).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)agc_masked_select+agc_shader_replayon NVIDIA RTX 3070, driver 581.80, Windows 10 22H2Pull request closed