perf(shader): define IrValue's trivial accessors in its header #9132
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9132"
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 milescoviello on 2026-10-21T12:57:29Z.
What
IrValue'sId,Arguments,Parent,ImmediateU32,IsPhi,HasUsesandUseCountonly return a member or compare one, but they were defined inIrValue.cpp. So every IR pass outside that file called them out of line. They are now defined inline inIrValue.hpp, next toOpcode,Type,ArgumentCountand the other accessors already there. Nothing else changes.Why these: in a DWARF profile of shader preparation (
agc_shader_replay --prepareover 152 Crimson Desert registration requests,main2f161d4f33), calls intoIrValue's out-of-line members were about 13 % of all leaf samples:HasUses3.1 %;Parent2.1 %;Id1.3 %;IsPhi0.3 %;ValidateProgramspent a quarter of its own 8.5 % inParent,IdandArgumentcalls.Tested
Ubuntu 24.04, GCC 13.3, Release (
build-rel, SPIRV-Tools off), i7-13700K, onmain2f161d4f33(rebased ontoce7d547175afterwards, no conflict).agc_shader_replay --spvover the 409 draw-time requests of MXGP 26 and Super Meat Boy 3D writes 409 SPIR-V modules on both builds. All 409 are byte-identical.agc_shader_replay --prepareover the same 152 requests, task-clock, 8 interleaved runs per build,ANYPS5_NO_SHADER_CACHE=1:mainThat's 1.8 % less CPU, and the ranges don't overlap.
Tests: the 37 tests matching
^shader|^request_serializer$|^agc_shaderpass.No Vulkan call changes, and the SPIR-V is identical, so I didn't run a validation-layer comparison.
Windows 11 Enterprise 26300, NVIDIA GeForce GT 1030 (driver 582.78), WinLibs GCC 15.2.0 r7 (UCRT), Release:
agc_validate_program,agc_masked_selectandagc_ir_reclaimpass 3 of 3 onmainand 3 of 3 with this change.Windows 11 Home 10.0.26200, NVIDIA GeForce RTX 4070 Laptop GPU (driver 616.92), WinLibs GCC 15.2.0 r7, Release, run by JulesB40 (results): this head merged onto
maind4cb89300fmatches thatmainacross all 1,125agc_tests with the Khronos validation layer on: 1,117 pass, the same 8 skip, and the same 18VUID-lines, all of them #11990's.Not tested: Clang.
Performance captures
The form asks for summary lines, so here are two from a title, with a caveat: this change speeds up shader compilation, and that doesn't show in frame time. The title whose start-up is compile-bound here, Crimson Desert, presents almost no frames then (2 in its first 600 s on 10-21), so it has no window to compare. These are from Super Meat Boy 3D (PPSA31162) start-up:
ANYPS5_NO_SHADER_CACHE=1, every shader goes through the recompiler.APS5_TRACE_SECONDS=10:60, 90 s runs, pad input, no other switch.main2816bd2754and of this PR merged onto it, two rounds interleaved with the other recompiler PR.In that window the shader prepare threads are 1-4 % busy, so the frames show no difference, as expected:
main2816bd2754, run 1main, run 2The measurement of this change is the replay timing under Tested. Traces and digests for all runs are in a release on my fork.
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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T12:57:44Z.
This pull request is labeled
perf, so it needs the summary line of a capture onmainand one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste bothaps5-summary.jsonllines, attach the two traces and add the output oftools/trace_digest.py.Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T12:58:34Z.
About the perf label's capture request: this change only affects shader compile time on the CPU. A frame capture would show it only as part of a title's start-up stalls, mixed with everything else that varies there. So it is measured where it applies: the replay of 152 Crimson Desert registration requests, task-clock over 8 interleaved runs per build (median 17.47 → 17.16 s, ranges not overlapping), with byte-identical SPIR-V for the 409 draw-time requests. If the maintainers want a title capture anyway, I can record Crimson Desert's start-up on both builds.
AI-assisted: yes (Claude Code)