perf(agc): read mesh pipelines' sampled image tables through the bindless heap #28487
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28487"
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 17bryen on 2026-12-01T01:29:23Z.
What
With
APS5_BINDLESS_IMAGES=1, draws on the geometry path (the guest vertex/geometry program running as a Vulkan mesh shader) now read their sampled image tables through the bindless heap, the same way compute dispatches and plain vertex/pixel draws already do with the heap in #20519. Before, every shader of such a draw, its pixel shader included, kept per-draw table arrays, so each draw decoded and bound every table entry on the CPU while holding the GPU mutex. On PPSA38500 that per-draw table work is the largest part of the ~5.5 minutes of black screen in a warm story load.BindlessLowering(Recompiler.cpp) no longer refuses a request that carries a mesh configuration. The driver hands that configuration to every stage of a geometry or tessellation-geometry draw (StageMeshConfiguration), so this gate also kept those draws' pixel shaders off the heap.ResourceMaterializer::BindlessCandidateaccepts the mesh stage.A heap graphics pipeline may also bind the mesh window. The
Require(!meshWindow)inPipeline.cppgoes; the layout keeps the mesh window at set 3 and the heap at set 4.Why the exclusion existed:
02b8c9c7a09says mesh pipelines stay on per-draw tables "since the mesh window takes set 3". In every commit of #20519 the heap is set 4 (BindlessImageAbi::HeapDescriptorSet = 4u), so that reason does not apply to the code.Every descriptor set checked against set 4:
No other mesh-specific obstacle:
SpirvModule::EmitEntryPoint.The debt line in the heap's own fragment (
docs/dev/debt/changes/perf-agc-bindless-heap.md, from #20519) drops mesh pipelines from the classes that keep per-draw arrays. Achangefragment cannot name an entry that is itself still a pending fragment.Heap off: unchanged, since every edit sits behind the heap switch. Heap on: non-mesh paths unchanged.
The branch is this PR's commits on #20519, then a merge of upstream main
184c5100c16(89e1cb27514), then a merge of #20519's rebased head27e873a41a6(c4c4b52ea4b), then two commits: the mesh tests check the lazy heap path instead of pinning it off (f5472801749), and the debt line is kept under the length limit (2565a71a98c).fc294cbbb53, so its new commits conflicted with the old copy in 28 files.What stays per draw on these draws: the shader memory capture and the per-draw recompile (variant matching), storage, nested, packed and BY tables, and the separate render pass the heap starts for every heap draw.
Tested
Windows 11, RTX 5090 (NVIDIA driver 617.14), Ryzen 9 9950X3D; GPU tests also on the Ryzen 9 9950X3D integrated AMD Radeon(TM) Graphics (AMD driver 26.11.2).
New
agc_driver_mesh_image_table(heap off) andagc_driver_mesh_image_table_bindless(heap on),agc_driver_image_table_tests --mesh-pixel. The draw is a geometry-path draw:MeshGeometryCodeas the mesh program, and a pixel shader sampling a table T#, compiled with the mesh compile context the driver passes. Cases:Before the change, the heap-on test fails at its first case: the mesh pipeline's pixel shader is not lowered to the heap.
GPU tests on this branch (built at
f5472801749;2565a71a98conly shortens the debt line) and on #20519's head27e873a41a6as the base, same machine.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, validation layer 1.4.363.1,ctest -V -j 1, each configuration in its own runner process.VK_LOADER_DRIVERS_SELECT=*amd*andANYPS5_GPU=AMD.Insert instance layer "VK_LAYER_KHRONOS_validation"and none showswas not found but was requested by env var VK_INSTANCE_LAYERS.VUID-linesAPS5_BINDLESS_IMAGES=1forcedAPS5_BINDLESS_IMAGES=1forcedAPS5_BINDLESS_IMAGES=1 APS5_BINDLESS_LAZY=1forcedAPS5_BINDLESS_IMAGES=0, and the heap mesh test runs whichever heap mode the environment selects. Under lazy mode a heap draw may first read null (every pixel zero); the test accepts only that or the resolved image, then draws again and compares strictly. Fault cases likewise accept a null first read and require the fault on the second draw.agc_driver_pointer_phi_{sampler,ballot,copies,lane_and,high,high_second_lane,lane_not}_table. These are per-draw table tests that #20519 does not pin off the heap, and this PR touches none of their code.Before the change (an earlier #20519 head, on main
2af8e79edfe, without these commits),agc_driver_mesh_image_table_bindlessfails with "the mesh pipeline's pixel shader was not lowered to the descriptor heap".PPSA38500, story load on a warm shader cache.
APS5_BINDLESS_IMAGES=1 APS5_BINDLESS_LAZY=1 APS5_LAZY_SHADER_PREPARE=1 APS5_PAUSE_CLOCK_FOR_PIPELINES=1 APS5_PROFILE_DRAW=1, same menu input. Base: two warm boots of the same stack without this change. Change: one boot (copy of the same cache folder, after one boot that re-translated for the changed front end).[draws])[draws]bindings time[resources] images took, over 50 ms)[draws]phasepipeline)drawpipelinephase, per holdRemoved: the per-draw table resolve under the GPU mutex.
Black screen not shorter in this boot: presents stopped at +170 s and did not resume before the 20-min cap; base stopped at +150 s / +161 s and did not resume either. Two causes:
The matched pair is below.
Table S#s with a border colour: we found faults for these entries while measuring this change. They are an existing limitation: main's per-draw path and the heap both refuse such entries, and this PR only moves where mesh draws report them. Main's per-draw path refuses them in
ShaderResources::addSamplerTable(ShaderResources.cpp, "a sampler table entry with a border needs dynamic texture numeric-class pairing"), and the heap's resolver refuses them with the same text. The existing testRunBorderSwizzleTestsintests/execution/ImageTable.cppasserts the refusal. Counts of faults with that reason in the boots' logs, both kinds sampling zeros:Rendering of those entries is unchanged.
Not measured:
PPSA38500, matched pair: two warm boots back to back on the same machine, in the same Windows session, with nothing else running.
3f991f1e66a4); change = the same stack with this PR's two commits (44fd218e2372). Both clean.APS5_TRACE_SECONDS=60:60andAPS5_TRACE_SUMMARY_EVERY=10.tools/performance_compare.py --require-matching-contextaccepts with no configuration difference.Story load, same two boots:
[draws])[draws]resources / bindings time[resources] images took, over 50 ms)draw[draws]phasepipeline)The abort: the change's boot ended at +271 s on
AGC graphics: a sample mask that differs between the pixels of a quad, from a pixel program with early depth or stencil tests that writes memory, is unsupported.Black screen: its end is not measured. The abort and the cap cut both boots off before presents resumed.
Not tested: the title's picture with this change was not compared against the base; a mesh program that itself samples a table (no such test program exists; the change's GPU tests sample in the pixel shader of a mesh pipeline); a mesh-window pipeline on the heap outside the title (needs NVIDIA and a mesh program with relative VGPR addressing); Intel GPUs; title boots on AMD.
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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-01T01:32:16Z.
Review: COMMENTED
Reviewed — no blocking findings
The full review is incomplete: I inspected selected ranges in six changed source files, and no concrete defect surfaced in those ranges.
Nothing blocks this; the points below are optional.
What I ran
Head reviewed:
207e62865d1eb177873c63164e0f5d9c07e6aaa9. No merged-preview check or tests were run; this was source inspection only. The reader returned source excerpts but could not append its audit log because the run folder is read-only.Results
Negative control
Not run. No test was executed, so no change-to-code negative control was available.
Findings
Blocking
None identified in the inspected ranges.
Non-blocking
The mesh-stage lowering and descriptor set layout changes appear consistent in the inspected excerpts. A complete review is still needed before treating this as a formal approval.
Sources
Not verified
Pinned source ranges were read in
core/shader/recompiler/Recompiler.cpp,core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp,core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp,core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp,core/libs/prx/libSceAgcDriver/Graphics/src/TextureService.cpp, andcore/libs/prx/libSceAgcDriver/Graphics/src/BindlessTable.cpp. These were partial ranges, not complete files. The other changed files were not reviewed from pinned source.The 15 files excluded from the review folder by size were
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp,core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp,core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp,core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp,core/shader/recompiler/Recompiler.cpp,core/shader/recompiler/Recompiler.hpp,core/shader/recompiler/ShaderDiskCache.cpp,core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp,core/shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp,core/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cpp,core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp,core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvDescriptors.cpp,core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp,core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp, anddocs/dev/ENVIRONMENT.md. Selected ranges of the two recompiler files were read through the pinned reader. Runtime behavior, GPU validation, and the author-reported tests were not independently verified.To get this to a good state
Nothing is required for the inspected excerpts. The remaining changed files and behavior need review before a formal approval is justified.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-01T06:15:05Z.
Review: COMMENTED
Reviewed — no blocking findings
No blocking defect was verified in the mesh-stage changes inspected; the review is incomplete because most changed files were not read.
What I ran
Reviewed head
a62686c8e9c2d7864ceee68b5c6ba5ecce3aa9f5. Read the prepared description, commits, manifest and diff, then usedrepo_read.pyto inspectRecompiler.cpp,ResourceMaterializer.cppandPipeline.cpp. No tests or build checks were run.Results
Findings
Blocking
None verified in the code inspected.
Non-blocking
None.
Not verified
The prepared folder lists 76 changed files: 58 included and 18 excluded as too large. I did not read every included file or inspect the excluded files through the reader, so their behavior and any issues outside the mesh-stage changes are not verified. The author-reported test results in the description were not run by me.
To get this to a good state
Nothing is required. The review is incomplete, so this comment does not provide an approval of the full change.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-01T13:24:43Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
Inspected PR head
89e1cb27514200f2afd97cc9d0b57e3127ac5e67against basemain; no merged-preview check was run. I usedsed,rg,python3to inspect the prepared bundle, andpython3 repo_read.py search/catfor pinned-head source context. No tests, builds, or compilation were run.Results
Negative control
Not run; no tests were run.
Findings
Blocking
None in the inspected code.
Non-blocking
None.
Sources
Not verified
files.jsonlists 76 changed files and zero rule-based exclusions. I read head context forPipeline.cppandRecompiler.cpp, plus targeted hunks indiff.patch; I did not read the other 74 changed files at the pinned head. The diff and bundle metadata were not fully reviewed, so this is not a complete review and does not justify approval.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-01T13:36:44Z.
Review: COMMENTED
🏛️ Architecture findings (3)
Advisory architecture findings (3)
💬 Code review
Actionable comments posted (14)
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-03T03:17:13Z.
Review: COMMENTED
Reviewed — comments
This review is incomplete because the pinned reader could not provide source context for the changed files, so I cannot make a formal merge recommendation.
What I ran
2565a71a98c3b33d5e68532b1505e973baa5ef2d.python3 repo_read.py search Version core/shader/recompiler/ShaderDiskCache.cpp; the reader failed while writing its access log because the run folder is read-only.Results
Negative control
Could not run; no tests were executed.
Findings
Blocking
No blocking defect was verified. The source review is incomplete.
Non-blocking
None established from the materials inspected.
Sources
No source behavior claims are made; pinned source context was unavailable.
Not verified
The repository source contents for all 79 changed files were not read individually. The manifest marks 16 files as unavailable in
files/; the remaining changed files were also not inspected individually. Tests reported in the PR description are author-reported and were not run in this review.To get this to a good state
Nothing is required based on verified findings. A complete review requires working pinned-reader access to the changed source files.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-03T03:26:31Z.
Review: COMMENTED
Actionable comments
0ea17476-529f-480c-a1b6-bf4de8ee36a5Reviewing files that changed from the base of the PR and between
89e1cb2751and2565a71a98.core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/BindlessTable.hppcore/libs/prx/libSceAgcDriver/Graphics/include/DescriptorHeap.hppcore/libs/prx/libSceAgcDriver/Graphics/include/TextureService.hppcore/libs/prx/libSceAgcDriver/Graphics/src/BindlessResolvers.cppcore/libs/prx/libSceAgcDriver/Graphics/src/BindlessTable.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DescriptorHeap.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DeviceImageKeys.cppcore/libs/prx/libSceAgcDriver/Graphics/src/TextureService.cppcore/libs/prx/libSceAgcDriver/tests/BindlessTable.cppcore/libs/prx/libSceAgcDriver/tests/DeviceImageKeys.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/TextureService.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_bindless_images_tests.cmakecore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_bindless_table_tests.cmakecore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_heap_device_replacement_tests.cmakecore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_image_table_tests.cmakecore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_split_table_call_run_tests.cmakecore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_texture_service_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/HeapDeviceReplacement.cppcore/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cppcore/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceTracker.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hppcore/shader/recompiler/SpirvBackend/src/SpirvEmitter.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppdocs/dev/ENVIRONMENT.mddocs/dev/debt/changes/perf-agc-bindless-heap-gaps.mddocs/dev/debt/changes/perf-agc-bindless-heap.mdIncluded 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 ligmaSec on 2026-12-03T14:23:17Z.
Review: COMMENTED
Ran the same image-table and GCN scalar buffer CTests on
mainand this head integrated using lavapipe. The scalar controls passed and the full image-table suite hit its 30-second timeout on both runs. The branch's runtime-address case passed. Its mesh case skipped because the device lacked a mesh path for these programs. All three logs show Khronos validation 1.4.369 being inserted, with no missing-layer diagnostic orVUID-messages.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.