perf(shader): bypass identity fragment export mappings #12280
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12280"
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 Filip722 on 2026-10-28T07:05:06Z.
What
Registration fragment modules dynamically extract four output components even when the runtime color mapping is the identity. On RADV this emits scalar comparisons, conditional selections and dependency waits for a vector that is already in the required order.
0xe4; keep the full mapper for other values and the existing specialization path for non-registration modules.No guest instruction semantics or rendering quality changes. Focused compilation of the actual materialized game fragment on Radeon 760M skips 58 native instructions in the identity path, including twelve conditional selections and ten dependency waits, with 32 VGPRs and no spills. The retained fallback increases static total from 1018 to 1023; the benefit is less executed work. This compiler check is separate from the gameplay measurements.
Tested
Updated with a merge commit onto main
3a40945e62b7e2543031d5da2b8e351ab603bc1a; original commits are preserved. Current exact head:90c9d5c8d327063ea30f6e907a192b71daafb018.The same six focused fixtures ran on current main and this exact head: shader memory, prepared exports, dual-source blending, AR exports and UINT16 exports pass in both. Alpha-to-coverage fails identically for the existing UNORM16_ABGR case (
half 0x3800, expected0.25). Prepared exports emits the same ten pre-existingVUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605messages in each. No new failure/VUID, skips or missing-layer warning; all five GPU fixtures loaded Khronos validation and selected the Radeon 760M.The only
SpirvModuleEmitter.cppdelta from measured baseccfb96757f9eto refreshed main is the depth-export clamp plus its<cmath>include; the MRT mapping hunk is unchanged. I parsed all 85 retained modules from the matched baseline camp warmup: all 64 fragment modules lack bothBuiltIn FragDepthandDepthReplacing. Thus the depth-export store/clamp cannot execute in that captured fragment path. No shaders or ISA are published. The five original traces and exact-commit confirmation retain their recorded revisions; no fresh current-main FPS claim is made.Debian 13, Ryzen 5 7640HS / Radeon 760M, RADV Mesa 25.0.7, Sons of Sparta PPSA28997 v01.008.001, stationary camp checkpoint. Baseline
ccfb96757f9ewas current main when pinned; candidate2b4efb1dc033contains only this change. Newer main0cd07dc4ab25merges cleanly; its depth-export/libc changes were reviewed but are not claimed as measured.The prospective A1/B1/B2/A2 comparison improves 20.434 → 20.761 FPS (+1.60%), with positive pairs +2.21% and +0.99%. Baseline range 20.397–20.471; candidate 20.674–20.848 FPS. The predeclared exact-commit confirmation is 20.833 FPS, within the candidate range and +1.77% versus preceding A2; GPU time 45.861 → 44.925 ms/present. All five captures passed, with no numerical exclusions. This supports a modest improvement in this scene on this GPU.
All captures used the same GPU
highpower state, restored by the wrapper after each run. Matched copied save and fixed Enter route; internal/output 1920x1080, focused 1152x648 Wayland client, mailbox, independently warmed caches cloned for each run. Loaded native libraries, save/guest-module hashes, cache payloads and continuous focus were verified. Scene checks ran outside the 90:30 windows. Both arms used a 524288-event timing buffer, selected before ordinary captures after a warmup overflowed the default. No ordinary trace dropped events; no per-draw profiling, SQTT, validation, shader dump or readback ran in a timed window. Normal game output retained its PTY;scriptrecorded that PTY.The two precommit candidate traces honestly retain the baseline commit label; their frozen binary/source hashes prove the production patch is byte-identical to the committed C1. Identical private clock/screenshot/disabled diagnostic hooks explain every dirty flag and are excluded from this commit. Exact-commit VideoOut differs only in its embedded revision literal. The evidence bundle includes the hook patch, frozen binary hashes, audits and all original timing traces, summaries and digests.
All five original timing traces, summaries, full digests, protocol and provenance. The README explains lossless trace decoding and SHA256 verification; no game assets or private hardware captures are included.
Main A2 and exact-commit C1, from
tools/trace_digest.py:seconds 90:30 from present 2438: 615 presents, frame p50 48.7 / p90 49.6 / p99 50.1 / max 50.4 ms, GPU busy 45.9 ms per present
AMD Radeon 760M (RADV PHOENIX), radv Mesa 25.0.7-2+deb13u1, Linux 7.2.12-x64v3-xanmod1, 1920x1080, commit
ccfb96757f(dirty), dropped: noseconds 90:30 from present 2466: 626 presents, frame p50 48.0 / p90 48.6 / p99 49.3 / max 51.9 ms, GPU busy 44.9 ms per present
AMD Radeon 760M (RADV PHOENIX), radv Mesa 25.0.7-2+deb13u1, Linux 7.2.12-x64v3-xanmod1, 1920x1080, commit
2b4efb1dc0(dirty), dropped: noThe same focused shader-memory, prepared-exports, dual-source-blend, AR-export, uint16-export and alpha-to-coverage fixtures ran on actual Radeon Vulkan with no shader cache and Khronos validation. The first five pass in both revisions. The alpha-to-coverage UNORM16_ABGR case fails identically in both; prepared exports emits the same ten existing
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605messages in both. Layer insertion and device selection were confirmed, without skips or missing-layer warnings; no new failure or VUID was introduced. Existing prepared-exports coverage exercises float/uint, multiple MRTs, mapping changes back to identity, cached/uncached materialization and shared registration variant reuse.The overlap tool completed; conflicting shared-file diffs were reviewed manually. #6235 changes raw numeric output types, including the mapper scalar type, but does not implement an identity bypass. It is independent work and has a pre-existing conflict with main. No existing PR was integrated or benchmarked.
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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T08:53:26Z.
Review: CHANGES_REQUESTED
The identity fast path and the report are well covered on the pinned base. The head is now behind current
main, and currentSpirvModuleEmitter.cppincludes the intervening depth-export clamp change (7ec9ce9132) in the same function. Please update the branch and rerun the required focused shader validation against currentmainand the updated head. Since the compared production source has changed in the same emitter file, please also refresh the performance pair or show that the depth-export change does not affect the measured scene/path. The current hosted shader/GPU jobs are skipped, so the older report is the only evidence at present.Imported from boykopovar/AnyPS5. Originally posted by imellag on 2026-10-28T18:45:02Z.
Review: APPROVED
macOS / MoltenVK data point. Apple M4 Pro, macOS 27.2, MoltenVK 1.4.2, x86_64 Release under Rosetta.
maindoesn't run titles on macOS yet, so the base is a support branch, notmain:main750cf6cf48+ only the macOS boot PRs #7631 #10552 #11249 #11447 #11554 #10669 #7804, + #12529 (the revert of #10337, which roughly doubles the GPU time on this GPU and would hide smaller changes). Change: that base + eight open shader performance PRs merged together (#12287 #11952 #12299 #12280 #11368 #11265 #8716 #8958, all clean merges). I did not measure each PR alone.Two alternated runs per side, warm shader cache,
APS5_TRACE_SUMMARY_EVERY=10:Together they don't raise the GPU time on MoltenVK. I'm checking open shader performance PRs on this GPU because #10337 was measured on RADV and doubled it here.
Focused tests below ran with
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationon the same two trees; the layer was found and both logs have the sameVUID-lines (12VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605, 20VUID-vkCreateDescriptorSetLayout-support-09582, from tests that fail the same way on the base).This PR on MoltenVK:
agc_driver_alpha_to_coverage,agc_driver_dual_source_blend,agc_driver_pixel32_ar_export,agc_driver_pixel_uint16_export,agc_driver_prepared_exportsandagc_shader_memorypass on the base and with this PR (agc_driver_alpha_to_coveragepasses here, so the UNORM16_ABGR failure in the description is RADV-only). The identity check costs one compare and branch on the identity path and keeps the full mapper otherwise. Approving from the macOS side.AI-assisted: yes (Claude Code ran the builds, runs and tests and drafted this review)
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T06:16:52Z.
Review: APPROVED
Re-checked — approved
The exact head
90c9d5c8d327063ea30f6e907a192b71daafb018incorporates the depth-export clamp from the refreshed base. The author reports the six relevant Vulkan fixtures passing on both baseline and change, including a second Windows/NVIDIA run (three repetitions, 6/6 each side) with no new validation messages; the pre-existing prepared-export VUIDs match on both sides. The PR includes the requested matched Demon’s Souls trace summaries and digests.I verified the current-main merge preview is clean and neither
SpirvModuleEmitter.cppnor the other changed paths have additional main-side edits since the refreshed base used for testing. Hosted policy and relinker checks pass; product jobs are skipped. I did not run GPU tests locally.