perf(shader): share immutable binding access metadata #1318

Closed
TibixDev wants to merge 5 commits from upstream-pr/1318 into main
TibixDev commented 2026-10-07 23:29:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TibixDev on 2026-10-07T23:29:29Z.


Status after review

Blocked on binding-plan benefit and metadata redesign.

Audited today's types: CompiledShaderArtifact already holds compiled/static shader data, while ShaderInvocation holds specialization, live descriptor bindings, push constants and vertex attributes. The remaining candidate is immutable descriptor-access vectors; live values still have to be materialized per invocation. This is narrower than treating the old complete binding object as shareable.

The serialized cache is now FormatVersion = 27; replaying this branch's old version edit would be incorrect. A replacement needs a new version chosen against its landing base and round-trip/invalidation checks. #1315 still has no demonstrated title benefit, and this stacked head has no isolated modern comparison. No code push or claim that the prior 448 → 160-byte layout result establishes runtime benefit on the new structures.

What

Prepare descriptor access metadata once per compiled shader variant. Share it across draw results. Materialize current descriptors, sampler coordinates, and push data on each use. Save the prepared metadata in versioned shader-cache entries.

Tested

Earlier branch-specific tests and measurements remain in the discussion. They have not been rerun on a redesigned current-main version of this PR. The review audit and shared NGS-assisted title exploration do not establish that this head is merge-ready. No full Linux/Windows platform CI was dispatched in this pass.

Checklist

  • Current-main implementation and outstanding review requirements complete.
  • Isolated title benefit / reference validation established where required.
  • Depends on: #1315.
  • AI-assisted: yes.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4779726502 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1318). Originally posted by [TibixDev](https://github.com/TibixDev) on 2026-10-07T23:29:29Z. --- ### Status after review **Blocked on binding-plan benefit and metadata redesign.** Audited today's types: `CompiledShaderArtifact` already holds compiled/static shader data, while `ShaderInvocation` holds specialization, live descriptor bindings, push constants and vertex attributes. The remaining candidate is immutable descriptor-access vectors; live values still have to be materialized per invocation. This is narrower than treating the old complete binding object as shareable. The serialized cache is now `FormatVersion = 27`; replaying this branch's old version edit would be incorrect. A replacement needs a new version chosen against its landing base and round-trip/invalidation checks. #1315 still has no demonstrated title benefit, and this stacked head has no isolated modern comparison. No code push or claim that the prior 448 → 160-byte layout result establishes runtime benefit on the new structures. ### What Prepare descriptor access metadata once per compiled shader variant. Share it across draw results. Materialize current descriptors, sampler coordinates, and push data on each use. Save the prepared metadata in versioned shader-cache entries. ### Tested Earlier branch-specific tests and measurements remain in the discussion. They have not been rerun on a redesigned current-main version of this PR. The review audit and shared NGS-assisted title exploration do not establish that this head is merge-ready. No full Linux/Windows platform CI was dispatched in this pass. ### Checklist - [ ] Current-main implementation and outstanding review requirements complete. - [ ] Isolated title benefit / reference validation established where required. - [x] Depends on: #1315. - [x] AI-assisted: yes.
TibixDev commented 2026-10-08 07:35:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TibixDev on 2026-10-08T07:35:48Z.


Rebased on da402739. Preserved current upstream and the #1315 prerequisite. Fixed the Linux CI failure: sampler validation now runs before SPIR-V emission, while immutable binding metadata remains shared. Reproduced the failure with SPIRV-Tools enabled; shader-memory, disk-cache and binding-materialization tests now pass three repetitions in that configuration. All tests below use SPIRV-Tools enabled.

Fedora 44 Release: agc_binding_materialization_tests, agc_shader_disk_cache_tests, agc_shader_memory_tests, agc_driver_tests, agc_driver_graphics_tests, agc_driver_recorder_tests build; the targeted tests and contribution checks pass. Windows CI is pending.
RADV and lavapipe: --binding-plan-only pass with core and synchronization validation; no validation errors.

Shader-memory, disk-cache and binding-materialization also pass with SPIRV-Tools disabled.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6055033701 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1318#issuecomment-6055033701). Originally posted by [TibixDev](https://github.com/TibixDev) on 2026-10-08T07:35:48Z. --- Rebased on `da402739`. Preserved current upstream and the #1315 prerequisite. Fixed the Linux CI failure: sampler validation now runs before SPIR-V emission, while immutable binding metadata remains shared. Reproduced the failure with SPIRV-Tools enabled; shader-memory, disk-cache and binding-materialization tests now pass three repetitions in that configuration. All tests below use SPIRV-Tools enabled. Fedora 44 Release: `agc_binding_materialization_tests`, `agc_shader_disk_cache_tests`, `agc_shader_memory_tests`, `agc_driver_tests`, `agc_driver_graphics_tests`, `agc_driver_recorder_tests` build; the targeted tests and contribution checks pass. Windows CI is pending. RADV and lavapipe: `--binding-plan-only` pass with core and synchronization validation; no validation errors. Shader-memory, disk-cache and binding-materialization also pass with SPIRV-Tools disabled.
adriadam10 commented 2026-10-11 11:39:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T11:39:21Z.

Review: CHANGES_REQUESTED


Thanks for the work here. Not mergeable as it stands:

  • This is stacked on #1315, which still conflicts with main and has an open question from @oneandonlydean (no measurable gain in the fixture or in a profiled run, 19 ms vs 21-22 ms per 6,000 builds). This PR needs that answered first.
  • Against current main it conflicts in 13 files (ShaderResources.{hpp,cpp}, DescriptorBindingBuilder.{hpp,cpp}, Recompiler.{hpp,cpp}, ShaderDiskCache.{hpp,cpp}, libSceAgcDriver/CMakeLists.txt and the Graphics/Recorder/ShaderDiskCache/ShaderMemory tests). #639 rewrote buildPrepare/buildComplete with compact bindings and runtime image metadata, so this is a redesign on the new structures rather than a mechanical rebase. The description says the change doesn't replace #639's ABI work; please show what is still left to share after it.
  • Please post before/after numbers on a rebased tree (same fixture or a real title, several runs), including the shader-cache FormatVersion bump, which also collides with other open PRs touching it.

Once #1315 is settled and this is rebased with numbers, happy to look again.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5483158253 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1318#pullrequestreview-5483158253). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T11:39:21Z. **Review:** CHANGES_REQUESTED --- Thanks for the work here. Not mergeable as it stands: - This is stacked on #1315, which still conflicts with `main` and has an open question from @oneandonlydean (no measurable gain in the fixture or in a profiled run, 19 ms vs 21-22 ms per 6,000 builds). This PR needs that answered first. - Against current `main` it conflicts in 13 files (`ShaderResources.{hpp,cpp}`, `DescriptorBindingBuilder.{hpp,cpp}`, `Recompiler.{hpp,cpp}`, `ShaderDiskCache.{hpp,cpp}`, `libSceAgcDriver/CMakeLists.txt` and the Graphics/Recorder/ShaderDiskCache/ShaderMemory tests). #639 rewrote `buildPrepare`/`buildComplete` with compact bindings and runtime image metadata, so this is a redesign on the new structures rather than a mechanical rebase. The description says the change doesn't replace #639's ABI work; please show what is still left to share after it. - Please post before/after numbers on a rebased tree (same fixture or a real title, several runs), including the shader-cache `FormatVersion` bump, which also collides with other open PRs touching it. Once #1315 is settled and this is rebased with numbers, happy to look again.
TibixDev commented 2026-10-12 04:52:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TibixDev on 2026-10-12T04:52:02Z.


Review-pass update:

Audited today's types: CompiledShaderArtifact already holds compiled/static shader data, while ShaderInvocation holds specialization, live descriptor bindings, push constants and vertex attributes. The remaining candidate is immutable descriptor-access vectors; live values still have to be materialized per invocation. This is narrower than treating the old complete binding object as shareable.

The serialized cache is now FormatVersion = 27; replaying this branch's old version edit would be incorrect. A replacement needs a new version chosen against its landing base and round-trip/invalidation checks. #1315 still has no demonstrated title benefit, and this stacked head has no isolated modern comparison. No code push or claim that the prior 448 → 160-byte layout result establishes runtime benefit on the new structures.

I have updated the PR description to match this status. The PR remains open; the outstanding review requirements are not being marked resolved. AI-assisted audit.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6117974869 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1318#issuecomment-6117974869). Originally posted by [TibixDev](https://github.com/TibixDev) on 2026-10-12T04:52:02Z. --- Review-pass update: Audited today's types: `CompiledShaderArtifact` already holds compiled/static shader data, while `ShaderInvocation` holds specialization, live descriptor bindings, push constants and vertex attributes. The remaining candidate is immutable descriptor-access vectors; live values still have to be materialized per invocation. This is narrower than treating the old complete binding object as shareable. The serialized cache is now `FormatVersion = 27`; replaying this branch's old version edit would be incorrect. A replacement needs a new version chosen against its landing base and round-trip/invalidation checks. #1315 still has no demonstrated title benefit, and this stacked head has no isolated modern comparison. No code push or claim that the prior 448 → 160-byte layout result establishes runtime benefit on the new structures. I have updated the PR description to match this status. The PR remains open; the outstanding review requirements are not being marked resolved. AI-assisted audit.
oneandonlydean commented 2026-10-14 05:09:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T05:09:13Z.


Closing for now: the author marked it blocked pending a redesign after #639. With the queue this large we're closing stalled perf PRs that don't show a gain in a title; reopen it with before/after numbers from a title scene (the summary lines from the performance report form) if you pick it up again.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6161374210 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1318#issuecomment-6161374210). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T05:09:13Z. --- Closing for now: the author marked it blocked pending a redesign after #639. With the queue this large we're closing stalled perf PRs that don't show a gain in a title; reopen it with before/after numbers from a title scene (the summary lines from the performance report form) if you pick it up again.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!1318
No description provided.