fix(agc): retain registered headers sharing shader code #2856
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2856"
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 CouchRiv on 2026-10-10T16:41:57Z.
What
Registering another header for the same code address replaces the first snapshot on main. An ABI that still refers to the first registered header then fails, even when both headers were explicitly registered with different binary types.
Retain each registered header and its prepared state for unchanged code. ABI resolution finds the matching registered header; draws and dispatches select the registered binary type for their stage. Within a type, the last registered header wins as before. Re-registering an identical earlier header makes its original snapshot current again without preparing it again. Changed code invalidates the older registrations.
Unregistered header differences still throw. A geometry front entry matching both type 2 and type 4 is rejected as ambiguous. Main selected the last registration's type instead.
HeaderSelectiontests this new lookup refusal. Registration and static ABI preparation keep their existing timing; this adds no preparation fallback at draw.Retained headers live until code replacement or driver shutdown. Keeping their snapshots increases memory use and requires scanning the headers for a code address. Reordering an earlier registration also invalidates the registry's ABI and draw caches, while retaining the prepared artifacts.
Related public report
Public report #2700 records this refusal in Ghost of Yōtei (PPSA26344, 01.008) on Linux with lavapipe. It describes relocated pointer fields without a changed type. This change addresses explicitly registered headers; it does not accept an unregistered relocated copy or establish that the reported title is fixed. Ghost of Yōtei was not run here.
#1837 remains the rule for bound copies differing only in user_data or padding. This retains #639's registration and static ABI preparation.
Tested
CachyOS Linux, GCC Release build, RTX 4070 Ti (NVIDIA 615.78.08), AMD integrated GPU (RADV RAPHAEL_MENDOCINO), and Mesa lavapipe (llvmpipe, LLVM 23.1.1).
SharedCodeHeadersinagc_driver_prepared_shadersregisters one synthetic program as type 2 and type 4, resolves the first header and submits two draws. A third draw uses a newly registered type-2 header with distinct metadata pointers; a fourth follows re-registration of the original header. All complete without an exception. On mainde5e541d8with lavapipe, the two-draw fixture fails at ABI resolution with the replaced-header refusal, before its first draw.agc_driver_prepared_publicationasserts snapshot selection and lifetime, identical re-registration order, changed-code invalidation and ambiguous type rejection. The prepared shader, graphics, publication and export group passes 10/10 on all three drivers. The draw checks establish successful submission; they do not measure compilation counts.agc_driver_dcc_keys_first_writefailed; lavapipe 225 passed, 27 feature skips andagc_driver_f64_fma_subnormalsfailed. Both failures reproduce with the same error on an isolated build of mainde5e541d8.agc_driver; the same test segfaulted on isolated main. The final full RADV run passed it.tools/check_conventions.py --base origin/mainandgit diff --checkpass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T19:33:17Z.
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.
main)core/libs/prx/libSceAgcDriver/Execution/include/Driver/Shaders/ShaderRegistry.hppL12, L91-92Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T23:06:11Z.
Checked the diff,
prepared_graphics/prepared_publication/prepared_shaders(20 repeats) and the AGC driver ctest scope on current main; all pass, and the new tests don't build without the change.Added one commit: a bullet in
docs/dev/ARCHITECTURE.mddescribing the per-code header registry (header selection for ABI vs. by binary type for draws, last-wins within a type, invalidation on changed code), since this changes the registry's ownership model.Merging.