fix(shader): budget pixel lane proof for NHL 26 replay #6180
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6180"
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 MarcZX10 on 2026-10-15T00:44:40Z.
What
Raise the bounded
EntryLaneWalkproof budget from 512 to 2048 so a wave64 pixel shader can complete lane-63 analysis on a 32-lane host. Add a generated regression shader with loop-carried saved EXEC masks followed by a wave64 UMin scan; it verifies the 32-lane subgroup reduction is emitted. Resolves #5398.Tested
Linux x86_64, GCC 12.2, Release. Built
tests/agc_shader_memory_tests;ctest --test-dir /tmp/build-6180-proof-budget -R '^agc_shader_entry_lane_proof_budget$' --output-on-failurepassed (1/1). With the same generated request, a 512-budget control fails at the lane-63 read and the 2048 budget passes.python3 tools/check_conventions.py --base upstream/mainandgit diff --checkpassed.For the NHL 26 request from #5398, temporary local
EntryLaneWalk::Spendinstrumentation duringagc_shader_replay --preparerecorded 1,369 successful steps in each of its two proof walks, no budget refusals, and 679 steps remaining from the 2,048 budget. The instrumentation and captured request are not part of this PR. The Linux GCC 12 build needed the independent dependent-template compile fix from #6306 temporarily in the local tree; that adjustment is not part of this PR. No GPU runtime validation was performed.Checklist
mainNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repositorySpirvAluEmitterMath.cpp; coordinate integration with that proof-cache changeImported from boykopovar/AnyPS5. Originally posted by cookie42073-cmd on 2026-10-15T02:38:16Z.
Hey Marc, thanks for taking this on. I checked c44c700c on Windows and can confirm it gets the supplied NHL26 capture past the lane-63 stop.
This was on main
760ffa683(including #6015), Release/MinGW GCC 15.2, with SPIRV-Tools enabled and shader caches disabled. I used milescoviello's #6125 at 686ea1d3 for the replay-tool build repair in every comparison. Your fixture matches the decoded capture from @milchgeldkassierer in #5398 byte for byte.I also reran the saved-EXEC loop tests from the earlier patch attached to #5189, keeping those test additions identical across all three runs:
The added case is a synthetic saved-EXEC loop before UMin, with three mask round trips per iteration and four loop iterations. It fails before this PR too, so this is a remaining case, not a regression introduced here. With caching, the helper-inclusive and asymmetric-upper-mask controls still refuse compilation. The GPU run covered partial waves, four draws per layout, on an NVIDIA RTX 4070 SUPER, driver 617.42, Windows 11 build 26300. The 64-lane layout was still running on 32-lane hardware; this is not native 64-lane validation.
Both variants passed the full Windows build. This PR passed all 75 selected tests before the loop additions; the cached variant passed all 75 with them, with no skips. That selection includes the new quad/sample-mask tests and request serialization from #6015. Direct replay emitted identical 70,935-word SPIR-V in both successful variants; the separate PrepareShader path emitted 74,546 words in each.
I haven't run NHL26 itself or checked its images, other GPU vendors, arbitrary changing masks, a dedicated mutually dependent-Phi cache case, or the saved loop combined with non-default quad/sample masks. The earlier cached approach remains local, with no competing PR opened. Would you prefer the broader loop case as a follow-up after this lands, or to discuss it here first?
For the next title check, the useful evidence is the tested revision, any other local patches, GPU/driver/OS, and a log through the next stopping point. If another shader fails, its complete RecompileRequest would help. We already have the capture needed for this stop.
AI-assisted testing and write-up, with an independent review of the changes and before/after evidence.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:16:12Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/shader/recompiler/SpirvBackend/src/SpirvAlu/SpirvAluEmitterMath.cppL390-391Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/shader/recompiler/SpirvBackend/src/SpirvAlu/SpirvAluEmitterMath.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/shader/recompiler/SpirvBackend/src/SpirvAlu/SpirvAluEmitterMath.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/SpirvBackend/src/SpirvAlu/SpirvAluEmitterMath.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-15T13:27:21Z.
Thanks for the detailed comparison. I suggest keeping this PR focused on the lane-63 budget and its captured replay. The saved-EXEC loop case fails for a separate reason and the cached-proof approach changes the analysis mechanism, so it is better discussed and validated as a separate follow-up after this PR is resolved. The evidence you posted is useful for defining that follow-up’s regression cases.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-15T13:28:03Z.
Rebased this PR onto current
main(head99500f9d) and resolved the CMake test-list conflict while retaining current-main test setup. The PR is mergeable; eligibility, conventions, and progress-report checks pass. I attempted the focused Linux build, but GCC 12 stops in unchangedcore/shader/recompiler/Optimization/src/SrtWalker/SrtDescriptorEvaluation.cpp:183(read.read->Flags<MemoryFlags>(), missing dependent-template parse); the target test did not run on this rebased tree.git diff --checkpasses. The local failure is outside this PR’s four changed files.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-15T13:28:37Z.
Correction to my previous note: the exact GCC 12 compile failure is already addressed by open PR #6306, which adds the missing
templatedisambiguator at this call site. That fix is outside #6180’s diff; I’ll rerun the focused build once #6306 is merged rather than duplicate it here. #6180’s hosted eligibility, conventions, and report checks pass, and the rebased PR is mergeable.Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-16T15:14:44Z.
Ran the focused test on Linux, since your GCC 12 build stopped before it on the rebased head. GCC 16.2.1 compiles
SrtDescriptorEvaluation.cpp:183unchanged on99500f9d4, so #6306 was not needed here. Release,BUILD_TESTING=ON, SPIRV-Tools off, clean environment (env -i), head99500f9d4.ctest -R '^agc_shader_entry_lane_pixel_replay$' --no-tests=error -V:The NHL 26 wave64 pixel lane-63 shader compiles for a 32-lane host.EntryLaneWalkbudget set back to512u(only that line changed): fails 3 of 3 withv_readlane_b32 of lane 63 is outside the 32-lane host subgroup that runs this wave64 program at one lane per invocation. Restored to2048u, it passes again (1 run).mainat896e1b2b7(clean merge): passes 3 of 3. I did not run the512ucontrol on the merged tree.So on
99500f9d4the replay test fails without the budget change and passes with it, and it still passes merged withmainat896e1b2b7. Your c44c700c and99500f9d4change the same lines apart from the rebased Windows test list inCMakeLists.txt, so this adds Linux and the rebased head to cookie42073's Windows check of c44c700c. It is the CPU-side replay only; I did not run NHL 26 or anything on a GPU.Heads-up: #6645 edits
EntryLaneWalknext to the samebudgetline (it keeps512uand adds a proof cache), andgit merge-treeof99500f9d4with its head reports a conflict inSpirvAluEmitterMath.cpp.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T15:59:28Z.
Thanks for running the focused replay on the rebased head with the 2048 budget and the 512 negative control. The 3/3 pass/fail result confirms the budget change is necessary on Linux, and the clean merge with main still passes. I noted the adjacent #6645 conflict for coordination.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T02:17:49Z.
The budget change and its 512/2048 control look right. One request: could the regression test build the IR in code (like
verifyHalfWaveReduction, with a chain that needs more than 512 steps) instead of committing NHL 26's captured shader astests/data/*.req? Nothing else in the tree ships a title's shader binary, and it can stay attached here for the replay check. Also, how many steps does that shader need? If it's close to 2048, the next title will hit the limit.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T03:06:34Z.
Thanks. I agree the committed title capture is not a good permanent test fixture. The attached capture has been independently checked against the decoded #5398 request, and the Linux 512/2048 control shows the replay fails with 512 and passes with 2048, but we have not instrumented
EntryLaneWalkto report its exact number ofSpend()visits. I therefore can't give a trustworthy step count or claim how close it is to 2048.I started replacing the capture with a generated chain, but couldn't validate that the generated IR actually crosses the 512 proof-visit boundary on this rebased tree, so I have not kept that speculative test. Would you prefer I leave the verified capture replay in place for now, with the request attached to the PR, or hold this PR while I build and validate a synthetic >512-visit case? I can also add temporary instrumentation locally to measure the capture's exact visit count before deciding whether a generated case can represent it.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T03:22:31Z.
I replaced the committed NHL capture regression with a generated saved-EXEC test. It builds three loop-carried saved-EXEC masks before a wave64 pixel UMin scan. On Linux, the focused CTest passes with the 2048 budget; with only
EntryLaneWalkreset to 512, the same test fails at the expected lane-63 read.I also measured the attached NHL 26 request with temporary
Spend()instrumentation in the local replay tool: each of its two entry-lane proof walks consumes 1,369 successful steps, with no budget refusals and 679 of 2,048 remaining. I restored the instrumentation afterward; the request and instrumentation are not committed. The captured-request replay is no longer a repository test fixture.The updated PR description records the test setup and the overlap with #6645. Thanks for asking for a generated regression and the count; both points are now addressed.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T04:26:06Z.
Coordination update: the follow-up on #6582 now reports that the proof-cache candidate from #6645 compiles the retained PRAGMATA request at the original 512-step budget, and that both CPU control tests pass on the reported exact commit. This is reporter validation, not an independent run of #6645, but it materially changes the overlap picture: #6180's budget increase fixes the generated/NHL capture, while the cache proposal may also complete the harder PRAGMATA walk without raising the cap.
Both changes touch
EntryLaneWalk; please compare the proof-cache implementation and its cycle handling against this PR's generated regression before deciding how to sequence or combine them. I have not independently validated #6645 or its full test suite.Imported from boykopovar/AnyPS5. Originally posted by cookie42073-cmd on 2026-10-17T06:18:28Z.
Hey folks, small commit clarification on the coordination update above: Ondra97's successful retained PRAGMATA comparison tested overlordxrz-source's b76d8d31bf4cf97d53ec52f45b0dc3937fac5532. It explicitly excluded #6645's production changes. At the time of this check, #6645 still points to e6f33ead6115c06fc58cbde29efb9d2e7e4f284e, which has the earlier cycle-generation-guarded cache, rather than the new active/assumed/settled implementation. Thanks to overlordxrz-source for the rewrite and Ondra97 for running the private capture.
I checked b76 against its parent
93e54cedd3, keeping the cap at 512. Windows 11 Pro build 26300, MinGW GCC 15.2, Release, SPIRV-Tools ON, shader cache disabled. Test and tool additions were identical between the two production variants.agc_shader_entry_lane_proof_budgetcaseagc_shader_memorywith the saved-EXEC loop and helper/asymmetric-half negativesagc_driver_pixel_wave_reductionwith the saved-EXEC loopThe GPU was an NVIDIA GeForce RTX 4070 SUPER, driver 617.42, with a 32-lane host subgroup. The loop passed four draws for each 32- and 64-lane shader layout, with 840 partial waves per layout. This does not cover a native 64-lane host GPU.
After restoring b76 and rebuilding, the NHL output was byte-identical to the first successful run, and the selected CTest set passed again: 16/16, zero skips. Both production variants completed the default full build with the shared prerequisites below. I did not run the entire 1,330-test suite. A separate exact-source IR cycle audit found no defect in its tested proof rules; it also detected deliberately unsafe caching mutations. That is supporting coverage, not a proof of arbitrary shader correctness.
Exact setup, build prerequisites, and test-only diff
The candidate changes only
SpirvAluEmitterMath.cpp. For the parent control I replaced that file with its exact parent version, rebuilt, ran the controls, then restored the exact b76 source and rebuilt/retested. No #6180 budget change or #6645 production code was applied. The b76 production Git blob is9f59064e2e08a50a71fe77f10c9a08309cf9d4e9.I reused MarcZX100's generated test from #6180 head
ec780d902fd5b9439975a213f4360b18dd0fb8b7, plus the saved-EXEC CPU/GPU controls from our earlier public evidence. The public NHL request's trimmed text SHA-256 is10e4baf422516704748773bd95fcbf423eb3ef7808c6e2e8f2e9242e6d3d8adb; decoded bytes are4451ff47decb5d5e313b2150be20316c558ad87aaa81b09a33a98c47d3adf90b. Those are two representations of the same request. The successful SPIR-V SHA-256 is2882bd86eabbd649b2d0dd3ad4e232cdbd050fafbf7c6efefc8439c7bfc159bd.The initial candidate default build stopped because an existing GPU test used 65,536-byte static alignment, above MinGW's 8,192-byte object limit, and the output path was too long. I reproduced both errors by building that same failing target with the parent production source. I retained those failure logs, used a shorter build path, and applied the same already-upstream test/tool repairs to both:
Disassemble(data(), size(), ...)repair: f1905053.These repairs and the added tests do not change the shader production algorithm. The complete shared additions are below, including the new helper header.
The selected CTest expression was:
I configured
BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=ON, Release; built the default targets and explicitly builtagc_shader_replay; ran CTest with--no-tests=error --timeout 30 --parallel 4,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1, andANYPS5_GPU=NVIDIA GeForce RTX 4070 SUPER. Direct replay usedagc_shader_replay --spv <public-request.b64>.The clean merge-tree check against upstream
6a32550fd18606452187c557a8be29a427cc2141succeeds, but I have not built or tested that combined tree. No game startup, gameplay, cloth-hang fix, AMD/Intel/Linux result, or title-unblocked claim follows from these checks.@Ondra97, could you repeat the retained PRAGMATA request on b76 with SPIRV-Tools ON, keeping the same private input, and report the validator result, exit status and word count? The payload can stay private. That would close the remaining capture-validation gap before deciding who carries the rewrite and how #6180/#6645 should be sequenced.
AI-assisted testing and write-up: Codex, with a separate Codex review.
Imported from boykopovar/AnyPS5. Originally posted by cookie42073-cmd on 2026-10-17T06:40:09Z.
Quick follow-up on the b76 comparison above: I reran it against current upstream 6a32550fd18606452187c557a8be29a427cc2141. The public NHL 26 request still fails there, and passes with overlordxrz-source's b76d8d31bf4cf97d53ec52f45b0dc3937fac5532 applied. The cap stays at 512.
6a32550APS5_SPANNED_WAVE=1Both test sets had zero skips. The execution-test filter was empty and the build contained no
ExecutionTestNotBuiltfixtures. This is the selected set below, not the entire 1,375 registered tests. The default run hadAPS5_SPANNED_WAVEgenuinely unset; setting it to0would still enable it.The integration retains upstream's
state.spannedWavereduction guard andShuffleInHalfchanges. The LDS waterfall fixture explicitly completed both two-lane and spanned execution in both arms. The six opt-in repeats also include pixel/wave32 exclusion checks; I am not claiming all six execute the compute-spanning path. Request serialization, shader-cache separation, capture/replay and neighboring lane/helper-mask tests passed in both arms.Tested on NVIDIA GeForce RTX 4070 SUPER, driver 617.42, Windows 11 Pro build 26300, MinGW GCC 15.2, Release, SPIRV-Tools ON, shader cache disabled. The saved-EXEC pixel loop passed rendered-value checks for both 32- and 64-lane shader layouts on 32-lane host subgroups: four draws and 840 partial waves per layout. This does not test a native 64-lane host GPU.
Only
SpirvAluEmitterMath.cppchanged in the production integration. Its Git blob is88e85477cce1d1baf0a3700d6823d7157ae648c7; the production tree is1e513ac835893a8abc8b59a9c4cb35073eb587b1. The original author is preserved in the local cherry-pick.EntryLaneWalkis identical to original b76. The successful NHL output is byte-identical to the earlier b76 run: SHA-2562882bd86eabbd649b2d0dd3ad4e232cdbd050fafbf7c6efefc8439c7bfc159bd.The test additions were identical between arms: MarcZX100's generated case from #6180 head
ec780d902fd5b9439975a213f4360b18dd0fb8b7, plus the saved-EXEC CPU/GPU controls in the earlier comment. Only its four test files were carried; Adrià Franch's replay-tool fix and Romans Pokrovskis's alignment fix are already in this upstream. A fresh audit of the exact merged helper source passed the earlier cyclic-proof controls and detected both deliberately unsafe cache mutations. Those extracted helpers are unchanged from the first audit, so this refresh verifies integration identity rather than adding new proof-rule coverage. Conventions checks passed too.Selected CTest names
The opt-in repeats were
agc_driver_lds_mask_waterfall,agc_driver_read_first_lane,agc_driver_dpp16_inactive_source,agc_driver_wave32_exec_lane_bits,agc_driver_pixel_wave_reductionandagc_driver_pixel_helper_lanes.This adds current-main integration evidence for the existing #6180/#6645 discussion; no duplicate PR. It does not demonstrate NHL 26 gameplay or a title unblock, and I have not run the private PRAGMATA capture, AMD or Linux here. AI assistance was used for the validation setup and write-up, with an independent review before posting.