perf(shader): share image table decode memo by image interface #28410
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28410"
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 muhmuhkuh on 2026-11-30T13:48:23Z.
What
Key the image table entry decode memo in
ResourceMaterializer::ResolveImageTablesby a canonicalized image decode interface ID (ImageResourcefields that affectTryRuntimeImageMode, the orderedruntimeImageModeslist, andGcnGuestShaders()) and the 8-dword image descriptor instead of(memoKey, resource, words).source,firstUsePc, non-NoTabletableindex,overwrite) when interning aDecodeInterfaceso different shaders or table slots with an identical image interface reuse cachedTryRuntimeImageModedecode results.std::unordered_mapmemo with a fixed-size direct-mapped cache (1 << 20slots, 256 striped mutexes) for 8-dword image descriptors.decodesanddecodesSharedcounters onImageTableReuseCounts(ResourceMaterializer::TableReuse()).verifySharedDecodeMemo()unit coverage inShaderMemory.cpp(--shared-table-resolution) verifying cross-variant decode reuse and non-collision across distinct sRGB, atomic,depthCompare, and orderedruntimeImageModesinterfaces.Tested
python tools/check_conventions.py --base origin/main— passed.ctestsuite (agc_shader_memory,agc_shader_disk_cache,agc_shader_bindless,agc_shader_table_resolution_growth,agc_shader_empty_table_resolution,agc_shader_shared_table_resolution,agc_shader_table_snapshot_reuse) — 7/7 passed.ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layer) forctest -R "^(agc_driver_image_table|agc_driver_image_table_reuse)$" -V:origin/main(2af8e79edfe1): 2/2 passed, validation layer loaded (notfound=0),VUID-errors = 0.abc8c15dca43): 2/2 passed, validation layer loaded (notfound=0),VUID-errors = 0.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-11-30T13:50:04Z.
Review: COMMENTED
Reviewed — no blocking findings
The reviewed implementation preserves cache correctness for the inspected decode path; the large test file was not read and no checks were run here.
What I ran
Reviewed head
abc8c15dca4309cc326f1f1f06376ca4c98fe8aeusingrepo_read.pyto inspect the prepared description, commit summary, manifest, diff, changed implementation, and relevant declarations and callers. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
ResourceMaterializer.cpp:2051retains every distinct decode interface in a process-wide map, with no eviction. Workloads that continuously encounter new shader interfaces can grow this map for the process lifetime. Consider bounding or otherwise limiting the interner if such workloads are expected.Sources
ResourceMaterializer.cpp:2049-2070interns canonicalized interfaces;ResourceMaterializer.cpp:2263-2280creates and uses interface IDs for table-entry decoding.Resources.hpp:77-131lists theImageResourcefields and equality operation used by the canonicalized identity.Not verified
ShaderMemory.cppwas listed as changed but excluded because it was too large for the review folder; its changed test code was not read.To get this to a good state
Nothing is required. Consider bounding the process-wide interface interner if shader-interface churn is expected.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T13:57:30Z.
Review: COMMENTED
Architecture findings (2)
Advisory architecture findings (2)
f33284c3-61ac-434d-9668-1da06c1f3b40Reviewing files that changed from the base of the PR and between
2af8e79edfandabc8c15dca.core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/Optimization/include/Optimization/ResourceMaterializer.hppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T17:57:50Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected changes key cached decode results by the image interface and ordered modes; I found no merge-blocking defect in the reviewed hunks.
What I ran
Reviewed head
6eccfd4526fa2611ecfbf84cc25826f62b8a5acfusing the pinned reader. No compiler, build system, or tests were run.Results
Negative control
Not run; no test or executable was run.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
Builds, tests, and the reported Vulkan comparison were not independently run. The PR description does not provide matched performance captures, summary records, traces, or digest output, so the performance claim is not verified. Reviewed the changed portions of
ShaderMemory.cppthrough the reader; its full text was omitted from the review folder because of size. Also read the changed portions ofResourceMaterializer.hppandResourceMaterializer.cpp.files.jsonlists no files excluded by artifact rules.To get this to a good state
Nothing is required. Optional: provide the matched performance report evidence for the performance claim.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T20:01:06Z.
Review: COMMENTED
The million-slot decode table has a fixed size, but the
decodeInterfaceregistry retains every distinct image interface and its entire runtime-mode vector for the process lifetime. Compiled artifacts can be evicted while their interface entries remain pinned. Can the registry share an explicit memory budget with the decode cache, with interface IDs kept unique across eviction so existing slots cannot become false hits?Source review at
6eccfd4526. The head trial-merges ontod2e04ef9b3. Paired Vulkan execution is queued.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-04T11:46:57Z.
Review: COMMENTED
Actionable comments
bc905dd1-bea7-48fb-9ae5-03e5d8fee673Reviewing files that changed from the base of the PR and between
6eccfd4526and460b53fa60.core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/Optimization/include/Optimization/ResourceMaterializer.hppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T12:03:35Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
460b53fa609156620302412262bb51d608666ac6; basemain(ab01aa5101d9f4e9a3cc54c145bb6a7b7699670e). No merged-preview check or tests were run. I inspected the prepared diff and changed lines in all three reviewed files, usingrepo_read.pyfor source context. The author-reported checks were not run by me.Results
Negative Control
Not run; no tests were run during this review.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
The claimed conventions, CPU tests, and Vulkan validation results are author-reported and were not independently confirmed. Performance effectiveness is also unverified: the prepared materials contain no matched baseline and change captures, summary records, traces, or digest output. The changed files reviewed were
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp,core/shader/recompiler/Optimization/include/Optimization/ResourceMaterializer.hpp, andcore/shader/recompiler/Optimization/src/ResourceMaterializer.cpp;files.jsonlists no excluded files.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-04T15:26:10Z.
Review: COMMENTED
Actionable comments
64e3a40d-e234-434d-8e88-b50f03c3f422Reviewing files that changed from the base of the PR and between
460b53fa60and14d3d2b37d.core/shader/recompiler/Optimization/src/ResourceMaterializer.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T15:44:57Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing is required.
What I ran
Reviewed head
14d3d2b37da73ef567e6d63067caf324ac28242d; no merged-preview check was run. Usedrepo_read.pyto inspect the changed source and test ranges, and read the prepared review files. No tests or build commands were run; no toolchain was used.Results
Negative control
Not run; no test execution was performed.
Findings
Blocking
None.
Non-blocking
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp:2097. Repository performance guidance calls for captures from the same machine and scene.Sources
Not verified
The reported tests were not independently run, and runtime behavior or performance on the stated Windows/NVIDIA setup was not confirmed. All three changed files listed under
files.jsonas reviewed were inspected;ShaderMemory.cppwas read through the pinned reader because its full text was too large forfiles/.files.jsonlists no rule-excluded files.To get this to a good state
Nothing is required. Optionally, add the same-machine, same-scene before/after summary lines and capture traces to substantiate the performance claim.
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.