perf(agc): reuse frontend within shader registration pairs #2526
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2526"
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 Celegans12 on 2026-10-10T01:40:11Z.
What
Preparing normal and partial-thread compute variants repeats decoding and control-flow construction for the same program. Keep one immutable frontend until that registration pair finishes.
Reuse requires identical owned code words, stage, fetch-call allowance and user-data register range. Each variant still translates, plans resources and emits from separate mutable IR with its current inputs. Failed construction preserves the previous frontend.
APS5_NO_PERF_FRONTEND_PAIR=1disables reuse for same-build comparisons without changing disk-cache keys. Persisted layouts and shader interfaces are unchanged.This complements #2327's removal of the earlier registration precheck and #2363's publication-lock change; neither shares the frontend between variants.
One same-build integration replay, reuse on then off, reduced pair preparation from 198.414 s to 113.562 s (42.8%); both SPIR-V variants were byte-identical. It used exact captured code with reconstructed historical context and no header. This is one offline preparation comparison, not standalone timing, an exact captured request or FPS.
Tested
Windows 11, MinGW-w64 GCC 15.2.0,
-DBUILD_TESTING=ON: full build, libs and registration passed on main0c0dc1e9plus feature (tree07a69b63). Windows: 558 passes/3 skips. Linux/lavapipe: 541 passes/29 skips, 570 total; executed tests passed three times.agc_shader_frontend_pairand_offran; no full-suite failures.Skip gates and control
Windows upstream skip checker passed; strict local NVIDIA gate failed for two offscreen VideoOut skips. Both exact built modes passed native SDL; the third skip is the intentional missing-Vulkan negative case.
Linux's 29 skip names match #2521's run. Individual skip output was not captured; the current JUnit skip gate was not run.
Removing only the three cached-hit return lines, with API/tests unchanged, makes ON fail the required reuse assertion (exit 8) and OFF pass (exit 0), no skips. This controls the cache-hit mechanism, not bare main or end-to-end registration counts.
Not tested: standalone title or console behavior.
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 adriadam10 on 2026-10-10T06:20:49Z.
Checked on Linux (merged onto current main): scoped build + ctest 299/299,
agc_shader_frontend_pairand_offpass. Negative control: disabling the cached-hit return makes the ON test fail and OFF pass. Reuse is keyed on identical owned code words, stage, fetch-call allowance and user-data range, and each variant still translates on its own IR (verifyFrontendProgram). The newShaderPreparationContexttype isn't in the shader-cache reviewed-names check and doesn't need to be;PrepareShaderalready is. Not reproduced here: the 198 s → 114 s replay figure and the Windows run. Note that this conflicts textually with #2072 intests/ShaderMemory.cpp; whichever lands second needs a rebase. Merging.