perf(shader): reuse compute pipelines across sampled component changes #28228
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28228"
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 EEkebin on 2026-11-29T10:18:37Z.
What
Direct sampled images in compute shaders can differ only in how the descriptor selects each returned component. Carry the four selectors and their typed zero/one overrides in one dispatch-data word per image index when the compute layout has a direct sampled pair. Store the words in push constants when the layout fits, or in the existing shader-data buffer. The shader reads its own image's word at dispatch. Image mode and normalized-value specialization are retained. Record the new layout field in shader disk cache format 99.
This trades constant folding of these particular component choices for pipeline reuse across them. The extra words can move a layout across the push-constant budget. The measured outcome here is the number of native pipelines created for a synthetic pair. The effect on steady-state GPU time and application frame rate is unmeasured.
Tested
Windows 10.0.26300, RTX 4090 (621.40), Release MinGW GCC 15.2. The fixture runs two dispatches of the same compute program and R32 float image. In the first, alpha selects constant one. In the second, alpha selects the red texel containing 0.25. Each dispatch checks all 32 lane outputs after GPU completion.
e89b87ab223cfa639e0c9d73agc_driver_runtime_imagesalso exercised a zero-byte push budget (storage-backed dispatch data). The PR created one native pipeline for the pair with either budget. Seven mixed-alpha cases under each budget checked 448 lane outputs, including float one, integer one, zero and sampled values. The float selector changes kept identical SPIR-V words and pipeline identity.agc_shader_disk_cacheexercised fresh child processes. The seed process recorded two variant misses. The warm process recorded one plan hit, two variant hits and zero variant misses. Both data layouts preserved their packed component word. Changing SPIR-V contents or adding a retained specialization changed the identity. A loose entry genuinely written by the format-98 baseline was placed at the expected format-99 lookup path and the candidate rejected it. A format-99 control loaded.agc_shader_image_limitspassed on both revisions. Focused Vulkan runs usedANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandVK_LOADER_DEBUG=layer. The loader inserted layer 1.4.369 and logged zero VUIDs. The disk-cache fixture explicitly enables its private cache.Overlap review. #13821 introduced the merged component-specialization path this changes for compute. The branch checker reviewed 2,134 open PRs. Eleven touch the same cache-format version line (#7085, #16472, #16631, #16812, #16814, #22602, #22690, #22692, #22703, #23244, #28176), and #20130 adds a neighboring disk-cache test invocation. If another serialization change lands first, this layout will need the next available format number. The checker could not merge 64 additional shared-file branches onto the base. Reviewing the shared-file diffs revealed no duplicate implementation of this dispatch-data layout.
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-29T10:35:42Z.
Review: APPROVED
Reviewed — looks good
The shader dispatch-data change and all ten changed files were reviewed at head
fa639e0c9d73852d80205f7fc3c22c4d3030eca0; no verified blocking defect was found.What I ran
Results
Findings
Blocking
None verified.
Non-blocking
None.
Not verified
files.jsonwas not present in the review folder; the review folder listing and manifest identify all ten changed files as included.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T20:21:05Z.
Review: COMMENTED
The exact runtime and disk-cache cases use a single sampled image index. Could the execution fixture bind two direct sampled images with different component mappings at once, then change just the second mapping while reusing the pipeline? Checking both outputs on the push and storage paths would catch a bad index or offset in the new per-image dispatch data.
Source review at
fa639e0c9d. Paired Vulkan execution is pending.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T04:11:57Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
7fca3a21294de8820a877d0283ab167fca09217cusing the prepared diff and manifest, then inspected the changed code and relevant callers throughrepo_read.py. No tests or build commands were run.Results
Negative Control
Not run; no source mutation or test execution was performed.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
Tests, build, and the reported Windows/RTX 4090 behavior were not independently run. The prepared
files.jsonlisted 10 changed files as reviewed and none as excluded.To get this to a good state
Nothing is required.
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.