perf(shader): reuse starting pixel lane predicates #11699
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11699"
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-27T03:59:46Z.
What
A pixel shader that saves its initial EXEC, enters whole-quad mode, and restores that EXEC reconstructs its own lane bit from subgroup ballots. This change reuses the captured
HelperInvocation == 0predicate when the existing starting-lane proof establishes the mask's real-lane coverage. It removes the ballot, whole-quad expansion and lane-index chain when those values have no other consumers.The condition comes from the same entry ballot being projected. A non-helper invocation contributes its own predicate bit; a helper contributes zero. The other AND operands must cover the starting real lanes. This follows the SPIR-V ballot semantics and retains the helper distinction from Vulkan's helper-invocation rules.
Tested
Linux 7.2.12-x64v3-xanmod1, Ryzen 5 7640HS, Radeon 760M, RADV Mesa 25.0.7-2+deb13u1; Release GCC 15.2, default SPIRV-Tools setting OFF. Base
abed03546804575703dbedcdd3c65efc6bf5d0f2, candidate9c5397dc27b486f5e38638e39b96f94485a0c714.The same added homebrew case passes the pixel checks on both revisions (932 interior pixels per draw). Compiler statistics from each newly created Vulkan pipeline show:
Allocated SGPR/VGPR counts are unchanged; no spills. The unchanged reference fragment keeps the same native hash. The two guest wave sizes share the resulting candidate pipeline.
Paired
ctest -Vruns on the same Radeon withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation:agc_constant_bit_test,agc_masked_select,agc_driver_graphics,agc_driver_pixel_exec_interpolation,agc_driver_pixel_helper_lanes,agc_driver_pixel_implicit_derivatives,agc_shader_memory,agc_spirv_module. All eight pass on both revisions, actual validation-layer insertion is recorded, neither log reports the missing-layer warning, and neither contains aVUID-error or a skip.God of War: Sons of Sparta PPSA28997 01.008.001, early Cyclops fight on the same machine, copied save, fixed 8 inputs, immutable warm shader/driver caches, focused 1152x648 window, 1920x1080 output (guest internal rendering remains 4K), mailbox. Each capture uses the same ordinary
APS5_TRACE_SECONDS=138:20window, fully inside the verified fight; normal game output is inherited.This single pair does not demonstrate a gameplay speedup. The candidate was 0.807 ms slower at p50 and 1.076 ms slower in GPU time, both within the retained baseline ranges 2.565 ms / 2.296 ms. No FPS improvement is claimed. This PR's demonstrated result is fewer native instructions in the focused homebrew case. AI/pose is not deterministic replay; the baseline also had 16 KiB swapped in, with no swap-out. Both scene/focus audits passed, with no observed thermal flags or other readable active GPU clients.
performance_compare.pyreportswindow.first_present4114 versus 4168 as the sole configuration difference, so its strict matching-context mode rejects the pair. The requested wall-time window is seconds 138:20 in both. Both builds contain the disclosed identical lightweight screenshot/origin hooks outside the candidate commit, explainingdirty:true; the exact patch is in the evidence bundle. VideoOut's executable difference consists only of two immediate constants encoding the trace revision string. These limitations are why the gameplay timing is descriptive.Raw summary lines (main, then change):
Full validation logs, native statistics, raw summaries, trace digests, comparison and lossless gzip traces. The text gist carries each original
.json.gzas base64; clone/download it and runpython3 decode_traces.pyto recover the original bytes with SHA256 verification. Both trace payloads and every other published file were downloaded again and matched byte-for-byte.The overlap checker left #5021 uncomparable because its ARM64 port conflicts with main. Manual inspection found a separate vertex
ULessThan32rule and vertex tests; it does not implement this pixel rule.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-27T06:53:49Z.
Review: APPROVED
Reviewed head
9c5397dc27. The fold only reuses the entry real-lane predicate when the ballot is evaluated across the starting lanes and the other AND operands retain real-lane coverage; partial masks and divergent ballots remain unfurled. The added CPU cases cover those exclusions, and the execution case covers restoring the saved entry EXEC before export on wave32 and wave64. I also reviewed the paired hardware test/performance evidence in the PR description; it is appropriately explicit that the single gameplay pair does not establish a speedup. I did not independently rerun the GPU suite.