fix(shader): reuse completed pixel lane proofs #6645
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6645"
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 DangerChamp on 2026-10-16T01:10:16Z.
What
Fixes #6582 by memoizing completed entry-lane proofs by value and proof type, while avoiding cached results that depend on active Phi cycles.
Adds regression coverage for saved EXEC-mask loops and helper-lane safety on wave64 shaders running on 32-lane host subgroups.
Tested
Windows host with MinGW Release build:
agc_shader_memorypassedgit diff --checkpassedChecklist
main; no other open PR implements the same functions.mdfiles or images addedImported from boykopovar/AnyPS5. Originally posted by cookie42073-cmd on 2026-10-16T04:45:32Z.
Hey @DangerChamp, I've been testing this same proof-cache path.
EntryLaneWalkate6f33eadmatches the earlier published candidate apart fromprove→Prove, including the 512-step budget and cycle guard.There's a new reporter comparison worth linking here: the exact earlier candidate passes the NHL26 capture and added synthetic CPU controls, but the retained PRAGMATA request still exhausts its budget at 512. I haven't built your whole branch, so this isn't a run of #6645, but I don't think
Fixes #6582is demonstrated by the current evidence. Could we keep that claim pending a successful replay of that request?The next comparison I'm requesting on #6582 is the same cached proof at 2,048 steps, with the cycle-safety checks unchanged. Can we coordinate this PR's ordering with @MarcZX100's #6180 before any further code submission? I'll keep our follow-up work coordinated here rather than open another matching PR.
AI-assisted investigation and write-up, independently reviewed.
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-17T11:26:22Z.
Rebase handoff — rebased onto current
maincleanly (authorship unchanged).Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, AMD RX 9070 XT / RADV):tools/check_conventions.py --base origin/mainpassesmainregression (agc_driver_tessellationsegfault, #4727), not this PRTo pick it up:
Head is
13cde0efd.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T13:14:46Z.
Coordination update from #6582: on refreshed main
ca82d7dwith the existing 2,048-step budget and SPIRV-Tools enabled, the retained PRAGMATA request fails on unmodified main with the lane-63 refusal, then passes with overlordxrz-source’sb76d8d31EntryLaneWalk helper (534,483 optimized SPIR-V words; validation passes before and after optimization). Both public CPU controls pass on that comparison. This is stronger evidence for that captured failure than the older same-base 512-step comparison, but the live title still did not reach a confirmed menu/scene and hit host memory pressure. Since #6645 is already open for the same cache topic, I’m not opening a parallel PR. Could you and @overlordxrz-source coordinate whether to replace this implementation with the verified helper or rework #6645 against the refreshed capture?Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-19T02:41:21Z.
I tested the current #6645 implementation against the retained #6582 shader request. After rebasing its original commit onto main
40393b0and keeping #6180's 2,048-step budget, the request still failed with the lane-63 refusal (exit 1). An eight-round saved-EXEC CPU regression also failed; the PR's existing three-round test passed.I prepared a branch for this PR at
99ed46c854a38e27f8c96abe6d83caa1fc30722c, based on mainccbd40240f. It preserves DangerChamp's original commit and tests, replaces the provisional cycle cache with overlordxrz-source's settled per-(value, proof) algorithm fromb76d8d31, retains the 2,048-step budget, and extends the saved-EXEC test to eight rounds. The second commit credits the helper's source.On Windows 11 Pro (Ryzen 9 7900X, RTX 4070 Ti SUPER, NVIDIA driver 32.0.16.1742), Release
relinker,libs, and the affected test executables built. Four CPU CTests and the nativeagc_driver_pixel_wave_reductiontest passed with no skips; that test selected the RTX GPU with subgroup size 32. The unchanged private request (SHA-256a9f1f0318f46c97929ccebfffcfd8d9bebc8cbcfab132cabd4369bcc52f4a82e) replayed successfully, producing 491,708 SPIR-V words with SPIRV-Tools validation enabled. Conventions, whitespace, and main-sync checks passed. I did not run the title from this branch.The hosted PR still points to
e6f33eadand conflicts with main. This is a handoff for the existing PR, not a separate PR. Please review and coordinate whether to integrate the branch into #6645. AI-assisted integration and testing: yes.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T07:33:32Z.
Review: CHANGES_REQUESTED
Thanks for the work here. Reading the diff against the evidence in the thread, this doesn't yet fix #6582, so I can't merge it as is:
SpirvAluEmitterMath.cpp:347(Prove): a result is cached only ifcycleGenerationdidn't move while proving it. Inside a loop-carried saved EXEC mask every sub-proof crosses the Phi back edge, so none of them is cached and the loop is walked again for every use. That is the case the issue is about. Ondra97 measured it: with this commit rebased on main and the 2,048-step budget, the retained #6582 request still fails with the lane-63 refusal, and an eight-round saved-EXEC regression fails (the three-round test inShaderMemory.cpp:2306passes). Please extend the test to eight rounds so it pins what the PR claims (it has to fail on current main).b76d8d31, with the cycle handling it settled on. Ondra97 published a repair branch for this PR that does that and keeps your commit and tests: https://github.com/Ondra97/AnyPS5/tree/codex/pr6645-repair-20261019 (99ed46c85). Taking it (or equivalent) fits better than the provisional generation counter.EntryLaneWalkstill hasbudget = 512uhere (SpirvAluEmitterMath.cpp:412). Please rebase and keep 2,048.Fixes #6582should wait until the retained request replays successfully with your change; the CPU tests alone don't show it.Not checked by us: the Windows/NVIDIA replay of the PRAGMATA request (relying on Ondra97's report above).
Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-19T12:49:40Z.
@adriadam10 I updated the repair branch to
07a36519c450807ef0f82b6f63608d7c4091d0db, synced with mainb106f6f8c04cb619fb12c8b22bcedae36c6c67ac. It preserves DangerChamp's original commit and tests, with credit to overlordxrz-source for the settled proof algorithm.The branch contains the requested eight-round saved-EXEC regression, caches by
(value, proof type)with the settled cycle handling fromb76d8d31, and keeps the 2,048-step budget.I repeated the comparison on that exact main and repair head:
b106f6f8c0)07a36519c4)The request is unchanged: SHA-256
a9f1f0318f46c97929ccebfffcfd8d9bebc8cbcfab132cabd4369bcc52f4a82e.Release
relinker,libs, and the affected test executables built with MinGW-w64 GCC 15.2.0. The same five focused CTests passed on main and the repair:agc_shader_entry_lane_proof_budget,agc_shader_memory,agc_shader_replay_requests,agc_shader_replay_tool, andagc_driver_pixel_wave_reduction. Both runs usedctest -V,ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1, andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. The logs confirm that layer loaded and the RTX GPU was selected with subgroup size 32; neither run reported aVUID-error or skipped test. Conventions and whitespace checks also passed.Environment: Windows 11 Pro, Ryzen 9 7900X, 32 GB RAM, NVIDIA GeForce RTX 4070 Ti SUPER, driver
32.0.16.1742.These results verify the captured shader failure; I did not run the title from this branch. #6645 still points to
e6f33ead, so the repair needs to be integrated by the PR author before these changes and results apply to the PR head.AI-assisted integration, testing, and write-up: yes.