fix(shader): keep adjusted table S# reads planning-only #27947
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/27947"
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 Meh7an on 2026-11-27T22:06:58Z.
What
Follow-up to #27779, as asked in #27856. It is stacked on #27779: the first commit is #27779's, and once that merges only the second one remains. It moves the parts of #27856 that #27779 does not have onto #27779's rule, under which dword 3 of a table S# is stripped only when every use of the handle is an
_asample:canonicalizeSampleAdjustDword3records the ORs it strips in the column plan (adjustedWords). The planned-read check accepts a stripped OR whose users lead to the table handle, so the table read stays planning-only instead of a GPU memory access.TryMakeTableColumnalso strips dword 3 beforeResolveInvariantPhi, soOR(phi(read), v)resolves to the read. #27779's strip afterResolveInvariantPhistays, for an OR behind a phi.verifyAdjustedTableSamplerDword3inShaderMemory.cpp, run byagc_shader_bindless.Tested
Windows 11 Pro (build 26300), NVIDIA GeForce RTX 2080 Ti, driver 621.40, WinLibs GCC 15.2.0, Release.
verifyAdjustedTableSamplerDword3:TableWholeCodereads its S# from the per-lane-keyed heap and ORs(ballot & 0xff) << 12into dword 3.image_sample_athe sampler is planned through a sampler table, and all 12 table reads (T# and S#) are planning-only.image_sampleit still fails withGetSamplerResource dword 0 is not a valid runtime value.agc_shader_bindlessfails with "a table descriptor read stayed a GPU memory access".ResolveInvariantPhihas no test of its own, because no program in these tests has theOR(phi(read), v)shape. #27856 had the same gap.1aab4aaada5) and this branch, same machine:ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, the 57ctestentries that runagc_shader_memory_testsandagc_driver_image_table_tests.VUID-lines on both. Neither log containswas not found but was requested by env var VK_INSTANCE_LAYERS.Checklist
main; no other open PR implements the same functions. Stacked on #27779's head, which is based onf73d791b3df.tools/pr_overlap.py --branchstopped early: it cannot fetch the head of #14217. Known overlap: #27779 (this builds on it) and #27856 (closed in favour of this pair).NotImplemented_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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-27T22:14:51Z.
Review: COMMENTED
Actionable comments posted: 1
a4cf153c-9348-4948-9dfe-8fc8fdf593e9Reviewing files that changed from the base of the PR and between
b19e5a8a96and0a8d778a10.core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cppcore/shader/recompiler/Optimization/src/ResourceTracker.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T11:41:49Z.
Review: APPROVED
Reviewed — looks good
Nothing in the inspected diff shows a verified defect that blocks merging; the new planning-only handling is guarded by adjusted sampler uses and has targeted planning and execution coverage.
What I ran
Reviewed head
0a8d778a10ee1f00154d2f774f5ad9e04d59d427from the prepared diff and repository reader (repo_read.py). No commands or tests were run; the test results in the PR description are author-reported.Results
Findings
Blocking
None verified.
Non-blocking
ResolveInvariantPhiOR(phi(read), v)case has no dedicated test. Adding coverage for that shape would exercise the second path throughtableSamplerDword3(core/shader/recompiler/Optimization/src/ResourceTracker.cpp:866).Not verified
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppwas read at the changed lines only; the rest of that file was not inspected.core/shader/recompiler/Optimization/src/ResourceTracker.cpp,core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp, and the changed lines incore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp. Files reviewed per manifest: all three. Excluded by the review bundle: none.To get this to a good state
Nothing is required. Optional: add a test for the
OR(phi(read), v)case.Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T20:45:52Z.
Review: COMMENTED
The new tracker fixture confirms that every descriptor load is planning-only when the words feed only the adjusted sampler. Could it also use the original dword in an observable scalar computation and verify that read stays live? That checks the negative path in the new recursive use test.
Source review at
0a8d778a10. The head trial-merges onto700fae9438. Paired Vulkan execution is queued.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.