fix(recompiler): let optional-body merges reach ballots that helper lanes cannot contribute to #9906
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9906"
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 TheSovietWaffle on 2026-10-22T21:08:47Z.
What
On devices without
VK_EXT_shader_stencil_export,MaskReplaySafety::optionalBodyrefuses an EXEC- or VCC-skipped body when a merge phi isquadObserved. Since #9317 a merged value may reach aBallotonly when every use of that ballot funnels into a lane's own bit (ownBitBallot), which bounds what is read.This adds the dual case, which bounds what is written: a ballot whose argument
onHelperproves false on every helper lane. Helper lanes then contribute zero to every word of that ballot whatever the merged value holds on them, so its words are a function of real lanes only, and any consumer (an any-active early-exit gate, the export mask's merge phis) observes nothing about helper lanes. The exemption only applies to ballots the mask analysis has alreadyrestricted(they sit in a stable mask chain whosemaskStable/helperschecks passed); any other ballot still goes through the funnel or is refused.Onimusha: Way of the Sword (PPSA27836) needs this: after its discard,
Ballot(ownLane(liveWords) && !killed)(withliveWordsa ballot of non-helper lanes masked by the whole-quad active lanes) feeds both an any-active exit gate and the export mask's merge phis. @akkadbakkad89 agreed on #9317 that it should land as its own change on top of #9317.This branch is rebased onto
main570089a80, which now carries #9317 (merged asdef1f5dd9); the diff is this PR's own commit (one line inquadObservedand two test cases).Tested
Rebased 2026-10-26: on this head
83d2093a9(main570089a80), withANYPS5_REQUIRE_VULKAN=1andANYPS5_NO_SHADER_CACHE=1on the RTX 3080,agc_masked_select,agc_driver_sample_mask_depth_stencil,agc_driver_stencil_known_replace,agc_driver_stencil_null_feedback,agc_driver_stencil_ref_export_unused,agc_driver_stencil_replayandagc_driver_stencil_replay_no_gplpass andagc_driver_stencil_ref_exportskips (noVK_EXT_shader_stencil_export);tools/check_conventions.py --base origin/mainpasses. The results below were taken on the earlier #9317 base.Windows 10 Pro 22H2 (19045), WinLibs GCC 15.2.0 r7, Release, on #9317's head
92ebac241.agc_masked_select, two new cases: an optional body's merged value reachesBallot(own(live) && merged != 0), whose low word is also kept outside the own-bit funnel. Withlivea ballot of the non-helper lanes it is replay-safe; withlivea ballot that helper lanes are in, it is refused. With #9317'sStencilReplay.cppthe first fails (an optional wave body may merge a value into a ballot whose argument is false on every helper lane); with this change both pass.The Onimusha request (
shader_2111c51800, dumped withAPS5_DUMP_SHADERS) checked offline withPrepareResourceProgram+StencilReplaySafeon #9317 + #8145 + #9393 + #9904 + #9905 + this change: the request passes.With
ANYPS5_REQUIRE_VULKAN=1andANYPS5_NO_SHADER_CACHE=1, on #9317 and on this change:agc_masked_select,agc_driver_sample_mask_depth_stencil,agc_driver_stencil_known_replace,agc_driver_stencil_null_feedback,agc_driver_stencil_ref_export,agc_driver_stencil_ref_export_unused,agc_driver_stencil_replayandagc_driver_stencil_replay_no_gplpass on both GPUs below, exceptagc_driver_stencil_ref_exportskipped on the RTX 3080 (noVK_EXT_shader_stencil_export). Results are identical on #9317 and on this change.Not run: the Khronos validation layer (not installed on this host, so
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationhas nothing to load; neither log contains aVUID-line), a title.tools/check_conventions.py --base origin/mainpasses with no errors (its one warning,debt-lengthondocs/dev/debt/libSceAgcDriver.md, is in #9317's entry, which this PR does not touch) andgit diff --checkpasses.tools/pr_overlap.pywas not run (noghon this host).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)1002:164e), 32.0.21045.5002, Windows 10 22H2🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T05:50:54Z.
Review: APPROVED
Reviewed exact head
3740a402f2fac97794664f20bf87371a8404734don the #9317 stack. This separately recognizes ballots proven false on helper lanes; the tests cover accepted proof and negative controls. The author reports paired validation-layer runs on NVIDIA and AMD with no new VUIDs, and combined title-request evidence with #9904/#9905. Current-main diff-check passes; conventions report no errors and only the inherited #9317 debt-length warning. Sync is clean apart from the shared debt file. Preserve this helper-lane proof alongside the complementary return-block and own-bit-phi changes; I found no duplicate implementation. I did not rerun the C++/GPU tests locally.