Repository navigation
fix(shader-recompiler): admit first-lane reads of wave-uniform values in stencil replay - #18322
Conversation
… in stencil replay
|
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.
Some 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.
|
|
Windows check of head
AI-assisted: yes. |
|
#18530 changes the same line of |
|
Windows NVIDIA check of head Setup: Windows 11 Home 10.0.26300, i9-13900K, WinLibs GCC 15.2.0, Release, RTX 4080 (
Not checked: no title was run. AI-assisted: yes |
|
Windows check of head Setup: Windows 11 x64, WinLibs GCC 15.2.0 (r7), Ninja, Release,
AI-assisted: yes. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed the first-lane stencil replay change — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
- Head
115288655cf9d34f0947f709f2bff2e890f76b51, basemain. Read from the pinned diff; no merge preview and no build. - Read the diff hunks of the three changed files, plus the helpers they call at head.
- Commands:
python3 repo_read.py search "IsRuntimeUniformOp"
python3 repo_read.py search "bool IsRawRead"
python3 repo_read.py cat core/shader/recompiler/StencilReplay.cpp 1 60
python3 repo_read.py cat core/shader/recompiler/Optimization/src/SrtWalker/SrtInstructionPredicates.cpp 1 173
python3 repo_read.py cat core/shader/recompiler/Optimization/include/Optimization/SrtWalker/SrtInstructionPredicates.hpp 1 20
Results
| Check | Result | Note |
|---|---|---|
| Build and unit tests | not run | No build in this review |
| Author's ctest run | not run | Author-reported, not repeated |
| Diff read | passed | Three files, changed hunks and helpers |
Findings
Blocking
None.
Non-blocking
docs/dev/debt/libSceAgcDriver.md:172: the debt entry says "user data, scalar memory reads and arithmetic on them". The walk incore/shader/recompiler/StencilReplay.cppalso accepts descriptor handles,ReadConst, float compares, and the select and compare ops ofIsRuntimeUniformOp. The entry should name that set.core/libs/prx/libSceAgcDriver/tests/MaskedSelect.cpp:963: the description says "five new cases". The diff adds fourrun(registrations holding seven checks, so neither count matches.core/libs/prx/libSceAgcDriver/tests/MaskedSelect.cpp:986:const auto exportUnder =[]drops the space before[]that the other lambdas keep. The line changes only in whitespace.
The uniform walk (WaveUniformValues::Uniform) refuses cycles and deep chains by caching a refusal. That is conservative. I found no path in the code I read that admits a lane-varying value to ReadFirstLane. ReadLane stays refused.
Not verified
- Build,
agc_masked_select_tests, and the ctest set. The claims that the two admit cases fail onmainand that 19 of 20 tests pass are the author's and were not run here. - The offline PPSA03671 result, that the shader is now refused only by the mask proof.
- Console behaviour. The description does not claim it.
- Read scope: the three files were read as their changed hunks and the helpers above. The rest of
MaskedSelect.cppandStencilReplay.cpp, including the mask proof body and the call sites ofuniform, was not read. The full texts infiles/were not read.
To get this to a good state
Nothing is required.
|
@MarcZX10 thanks. All three are in AI-assisted. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing blocks this change; the focused tests and conservative uniformity checks support the stated admission rule.
What I ran
Reviewed head bf98c25574268e1e3796de1359ca80690c2ed2be. No test or build commands were run; repo_read.py was used to inspect the prepared diff and targeted source ranges. The author reports running tests on Linux 7.3 with an RTX 3080 Ti and NVIDIA 615.71.09; those runs were not independently verified.
Results
| Check | Result | Note |
|---|---|---|
| Diff and changed source | passed | All three changed files were read. |
| Targeted logic review | passed | First-lane values require recursively uniform operands. |
| Tests and build | not run | Results in the PR description are author-reported. |
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests or builds were run. Test execution and the reported GPU behavior were not independently verified. All changed files listed as reviewed in manifest.json were read: core/libs/prx/libSceAgcDriver/tests/MaskedSelect.cpp, core/shader/recompiler/StencilReplay.cpp, and docs/dev/debt/libSceAgcDriver.md. files.json was not available through the reader; the manifest lists all three changed files as included, with none excluded.
To get this to a good state
Nothing is required.
What
On a device without
VK_EXT_shader_stencil_export, stencil reference replay refuses every pixel shader that has aReadFirstLane. This PR admits aReadFirstLanewhose value every lane of the wave holds alike, so which lane it reads makes no difference between replay passes.MaskReplaySafetyintoWaveUniformValues, which the lane-op check and the mask proof now share.ReadConstBufferof aScalarBuffer,LoadAddressU32of aScalarAddress), when their own operands are uniform;FPRecip32/FPRecipIFlag32.ReadLanestays refused. Its shuffle can name an inactive lane.PPSA03671 hits this with
v_readfirstlane_b32in an unsigned divide by a scalar buffer value. That pixel shader then stops at the mask proof, on ans_cbranch_execzbody whose exec-restoring export tail the structurizer duplicated. That is left for a separate change, so this PR doesn't unblock the title alone.Tested
Linux 7.3, RTX 3080 Ti, NVIDIA 615.71.09 (no
VK_EXT_shader_stencil_export).agc_masked_select_testshas four new cases holding seven checks:LaneId, a vector-buffer read andFragCoordare refused;ReadLaneof a uniform value is still refused;ExecZeroskip on a scalar-buffer predicate is proven, and one on a vector-buffer predicate is not.main'sStencilReplay.cpp, and all cases pass with this change.ctest -R 'stencil|masked_select|read_first_lane|pixel_helper_lanes|exec_host_lanes|permlane16' -VwithANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, onmainand on this branch:agc_driver_stencil_ref_exportis skipped, since the device lacks the extension.VUID-lines and no missing-layer line in either log.PrepareResourceProgram, the logged PPSA03671 pixel shader's oneReadFirstLaneis uniform, and the shader is now refused only by the mask proof.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)