feat(agc): resolve runtime sampler addresses through device image keys #13929
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13929"
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 Celegans12 on 2026-10-31T13:02:32Z.
What
Stacked on #13928; please review the runtime-address sampler changes and merge resolution.
After ordinary sampler planning fails, admit a GPU-loaded S# address only when its image already has an admitted device-table column. Carry the four GPU-loaded words into the lookup and sample through its resolved slot. Existing stage, subgroup and all-consumer demotion rules remain; no CPU descriptor capture or new fallback is added.
Coverage checks pointer-loaded keys, cold misses, colors, mutation, relocation and filter/LOD-only differences. An unsupported border sampler produces a shader fault, a drain diagnostic, no fallback and valid output after restoration. The parent supplies ownership and bounded diagnostics. Device image ABI 4 and cache format 76 are unchanged here; the source-version key still changes with the recompiler sources. Direct T# with runtime-only S#, new stages and wider divergence remain outside this change.
The combined-stack scan reports 64 other shared-line or export overlaps and 138 conflicting branches it could not compare. Reconcile shared changes as those PRs land.
Tested
Based on
main096c45570fplus #13928; merges cleanly with9090972b7e. Windows 11 / MinGW-w64 GCC 15.2.0, Release with-DBUILD_TESTING=ONand SPIR-V Tools: 34 selected serializer, shader-cache, table, sampler, refusal and heap cases passed three times on NVIDIA RTX 3080 Laptop / 610.62 with validation 1.4.363; no VUIDs or skips. The runtime GPU poison case recorded the fault and recovered after restoring the valid sampler.Ubuntu 24.04 WSL / Mesa 25.2.8 llvmpipe / LLVM 20.1.2, validation 1.4.363: 15 cases passed three times and 19 heap-dependent cases skipped; no VUIDs. Userfaultfd write protection was unavailable, so the same-texture sampler-refresh subcase did not run.
Not tested: native Linux descriptor-heap execution, macOS, full suite, live fragment/multiwave divergence, current titles/FPS, persistent-cache growth or windowed presentation. The 128-thread annotation coverage is structural only. The parent's title-scale cache-growth report remains unresolved.
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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T13:07:02Z.
Review: COMMENTED
Re-checked — final commit, stack review pending
I reviewed only the final commit
87d9bdfdc053813e2e561c5d2a3e0ddb3ae47aceon parentde14864edf9f6f626afd0b057f208c1942998aae, as the PR requests; this is not approval of the inherited stack.What I ran
Reviewed the final-commit diff against its parent and refreshed the PR at head
87d9bdfdc053813e2e561c5d2a3e0ddb3ae47ace, basecd087bd12c258cf6dbb82e203bafd20d9fe2596c. Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0. No local build or GPU test was run.Results
main; the target PR itself previews cleanly when applied aloneRaw precheck output
The precheck report records the helper-script execution failures and the stack result. It does not identify a failing product test.
Sources
Not verified
I did not review the inherited changes from #10193 or #13928 in this focused pass, and did not run the GPU tests. #13928 has no recorded review yet; #10193 remains in changes-requested state and its author says the reported shader-cache growth is still unresolved. I therefore cannot approve the cumulative stack from this final-commit-only review.
To get this to a good state
Have the parent PRs reviewed and resolve the outstanding #10193 cache-growth finding; then request review again on the updated stack. I can reassess the exact new head and its dependency chain then.
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T21:28:15Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The runtime-address sampler planning in
ResourceTracker.cppis small and works on its own: the new shader test fails without it. But on a device withoutVK_EXT_descriptor_heap, the device-image sampler tests skip with a messagetools/check_skips.pydoes not accept, so the Linux (lavapipe) CI job fails its skip check on this merge.What I ran
Head
313aa2c8324621f9c1755ba90ffe2fa938baeddc,main9090972b7e91fd266819cbd77a8b058e177b5682, merged with--no-ff(treeb78c672fe7c08e7db15d5100fd0bf5ea66e3aef8). Debian 13 VM, 2× Xeon Gold 6136, GCC 14.2.0, Release/Ninja, lavapipe (Mesa 26.1.6, LLVM 19). Lavapipe does not exposeVK_EXT_descriptor_heap.Per the description, I focused on the PR's own commit
39ed098b9a74(ResourceTracker.cppand the sampler tests) and on how the merge resolved. I did not review the inherited #9508, #10193 or #13928 code line by line.Results
git diff --checkcheck_conventions.pymaincheck_skips.py(script)agc_driver_device_image_samplers_*, plusagc_driver_presentation_pass_gpu_heap). The 10th,guest_net_ctl, also skips unexpectedly onmainagc_shader_device_runtime_sampler_columns,agc_shader_device_runtime_address_columns,agc_shader_device_pointer_columns,agc_shader_device_image_tables,agc_shader_disk_cache,agc_device_image_keys,agc_driver_device_image_tableandagc_driver_device_image_samplersagc_shader_device_runtime_sampler_columnsfails without the PR's hunk, passes with itSkip lines on lavapipe
check_skips.pyaccepts a skip only when everyskipped, ...line matchesDEVICE_LIMITATION(the device (has no|reports|lacks|does not|...)). Theagc_driver_device_image_path_*andagc_driver_heap_draw_sample_*_heapskips pass this check. The sampler test's line, and the presentation test's "the device offers no host memory type" line, do not.Negative control
The PR's production change is the
PlanRuntimeAddressColumnhunk incore/shader/recompiler/Optimization/src/ResourceTracker.cpp. Restoring that file frommainwould also drop the whole stack below it, so instead I reverse-applied only commit39ed098b9a74's hunk and rebuilt.agc_shader_device_runtime_sampler_columnsthen fails:GetSamplerResource dword 0 is not a valid runtime value; chain: LoadAddressU32@pc=0x00000044(GetAddressResource(ReadFirstLane(...LoadBufferU32x2...))).I then restored the merged file, rebuilt, and the test passed again.
git status --porcelainis empty.The GPU-side runtime cases (
_runtime_address,_runtime_filter,_runtime_lod_bias,_runtime_poison) skip on lavapipe, so I could not run them before and after the change.Findings
Blocking
core/libs/prx/libSceAgcDriver/tests/execution/DeviceImageSamplers.cpp:584printsskipped, descriptor heap features, limits or validation policy do not permit the device image path; ...and line 588 printsskipped, runtime sampler addresses require the enabled and supported device image path. Neither matchesDEVICE_LIMITATIONintools/check_skips.py..github/workflows/build.ymlrunscheck_skips.pyafter ctest on Linux and Windows. On lavapipe, which has noVK_EXT_descriptor_heap, the four runtime registrations this PR adds and the four_gpu_path/_poison_gpu_pathones from #13928 are flagged. The mergedmainwould fail that step.DeviceImagePath.cpp:399:skipped, the device lacks VK_EXT_descriptor_heap, which the GPU heap the device image path reads its tables through needs. Then rerunpython3 tools/check_skips.py build/ctest.xmlon a device without the heap.Non-blocking
agc_driver_presentation_pass_gpu_heapis flagged by the same check. It is inherited from #9508, not from this PR's commits. Its heap skip line matches, but the earlier subcase linepresentation source in host memory: skipped, the device offers no host memory type for the image(core/libs/prx/libSceAgcDriver/tests/PresentationPass.cpp) does not, so the whole skip counts as unexpected. The fix belongs in #9508: either word the line asthe device has no host memory type ..., or stop printingskipped,for a subcase when the test as a whole skips._runtime_filterand_runtime_lod_bias._runtime_poison, and documented under "Device image table samplers" indocs/dev/debt/libSceAgcDriver.md. The entry also states the 64-key rejection bound that request 2 asked about.Not verified
To get this to a good state
DeviceImageSamplers.cpp:584and:588, either in this PR or in #13928 where the first one comes from, to a wordingcheck_skips.pyaccepts. Then confirmcheck_skips.pypasses on a lavapipe or no-heap run.agc_driver_presentation_pass_gpu_heapsubcase wording with #9508._runtime_*sampler tests on a driver withVK_EXT_descriptor_heap, with validation, at the new head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T06:40:52Z.
Review: COMMENTED
Reviewed — comments
This review covers head
313aa2c8324621f9c1755ba90ffe2fa938baeddc; the change is extensive and many changed files were not fully inspectable within this review, so a formal merge decision is not justified.What I ran
No tests or build commands were run. I read the PR description, commit list, manifest, and targeted diff sections, then inspected selected changed source files at the pinned head.
Results
Findings
Blocking
None verified.
Non-blocking
None.
Not verified
The changed set is very large. I did not read every file listed in the manifest, including the non-text Vulkan-Headers submodule and files excluded from the prepared bundle for size; the claims about those files and the overall behavior are not verified. The author-reported Windows and WSL test runs were not independently run.
Files read:
review/description.md,review/commits.md,review/manifest.json, relevant sections ofreview/diff.patch,core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/HeapStages.cpp,core/libs/prx/libSceAgcDriver/Graphics/src/DeviceImageTable.cpp, andcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp. The manifest and file listing contain many additional changed files that were not read; exclusions are noted inreview/manifest.jsonand the file listing.To get this to a good state
Nothing is required. The review is incomplete, so no approval is given.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:49:59Z.
Review: COMMENTED
I verified that the exact head contains current #13928. The trial merge onto
c1601e56d5conflicts throughout the device image-key stack. For this PR’s own delta, please retain the runtime sampler-pointer case that mutates the four words between uses and independently checks a cold miss. Also keep the mixed-consumer refusal, so resolving one GPU consumer cannot silently replace the others’ planning. The core stack needs to merge before a paired run.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.