Repository navigation
perf(shader): specialize constant sampled-image components - #13821
adriadam10 merged 2 commits into
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The exact-head shader path is gated to eligible 32-bit sampled images, retains the existing fallback for excluded modes, and the supplied performance evidence meets the repository’s paired-capture requirements.
What I ran
Reviewed head dc226ce7afdff94b06bcbc5a884032f3f1d93f9f against base/current main e8c25dd3baa6e78531d5eee067fec5cbe8af3dcf; merge preview was clean. Local environment: Linux x86-64, Python 3.11.2; I did not compile. I ran:
python3 tools/pr_precheck.py --pr 13821 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13821
python3 tools/pr_test_quality.py --root <exact-head-checkout> --json core/libs/prx/libSceAgcDriver/tests/execution/RuntimeImages.cpp core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp core/shader/recompiler/PipelineSpecialization.hpp core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp
python3 tools/trace_digest.py <each decoded A1, A2, A3, A4, B1, B2, B3 and B4 trace>I also checked each downloaded trace’s SHA-256 against provenance.json, gzip integrity, and exact equality of the generated digest with its supplied digest file. The test-quality heuristic flagged the existing C++ fixture as possibly unregistered; I inspected the CMake CONFIGURE_DEPENDS source glob and test loop, which build and register agc_driver_runtime_images.
Results
| Check | Result |
|---|---|
| Diff and conventions/template | Passed |
| Current-main merge preview | Clean |
| C++ test registration | Confirmed by CMake inspection; heuristic warning was a false positive |
| Performance bundle | All 8 hashes matched; all gzip files valid; all 8 local trace_digest.py outputs exactly matched the supplied reports |
| Author-reported shader validation | Five focused tests passed on baseline and candidate with required Vulkan validation, no shader cache, four Radeon selections per arm, zero skips, missing layers, or VUIDs; not run locally |
| Hosted CI at review | Conventions, intake, eligibility, report, labels, portability passed; product Linux job skipped; Windows and relinker jobs were still running or queued |
The precheck’s optional ABI and test-quality helpers were absent from its isolated checkout. No exports changed, so an ABI audit was not applicable; I ran the workspace test-quality helper separately and resolved its registration signal as described above.
Raw output from local checks
All conventions checks passed.
/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13821/stack/stack-report.md
/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13821/stack/stack-report.json
A1: sha256_match=True gzip=valid digest_exact_match=True bytes=2027397
B1: sha256_match=True gzip=valid digest_exact_match=True bytes=1919404
B2: sha256_match=True gzip=valid digest_exact_match=True bytes=1901006
A2: sha256_match=True gzip=valid digest_exact_match=True bytes=1924524
B3: sha256_match=True gzip=valid digest_exact_match=True bytes=1966404
A3: sha256_match=True gzip=valid digest_exact_match=True bytes=1867525
A4: sha256_match=True gzip=valid digest_exact_match=True bytes=1989030
B4: sha256_match=True gzip=valid digest_exact_match=True bytes=1950471
Negative control
| Assertion | Change on base | Result |
|---|---|---|
RuntimeImages.cpp distinguishes constant-zero/one values from sampled components |
Not run against base | Not exercised; the C++ test requires an exact-head build, which I did not perform. |
Findings
Blocking: None found.
Non-blocking: The measured result is limited to the reported Sons of Sparta scene on one Radeon 760M system, with four run pairs. The PR states this limitation; it does not claim a general gain.
Sources
- Descriptor-based eligibility and specialization values at the reviewed head
- SPIR-V result specialization and fallback at the reviewed head
- Runtime image regression fixture at the reviewed head
- Paired measurements, validation summary, and trace provenance
Not verified
I did not compile or run the C++/Vulkan tests, independently reproduce the game captures, or test other GPUs, scenes, or consoles. The build, CTest, and hardware-validation results are author-reported. The PR head remained dc226ce7afdff94b06bcbc5a884032f3f1d93f9f when I submitted this review.
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Windows GPU run of head Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, Radeon RX 6700 XT with AMD proprietary driver 26.10.1 (Vulkan 1.4.315), WinLibs GCC 15.2.0 UCRT r7, Ninja, Release,
AI-assisted: yes (Claude Code). |
|
NVIDIA and Intel on Windows, for head Host: Windows 11 Pro 26200, i7-9750H, WinLibs GCC 15.2.0 (
Only these test targets were built, not the full suite, and no title was run. AI-assisted. |
✅ NVIDIA GPU test: passedPR head
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validation IDs already present on main (4 IDs in 390 tests)Skipped (48)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
Checked the diff: the spec constant ids ( |
What
Partially constant sampled-image views still carry runtime channel values through registration modules, so downstream arithmetic cannot fold an explicitly zero or one channel. This exposes eligible constant components to specialization while retaining the existing image-mode selection and all nonconstant components.
The values follow Vulkan component swizzle semantics: ONE uses integer 1 or floating 1.0 according to the view. This extends partial-channel propagation, distinct from #1417's all-constant views and #11952's direct-mode specialization. No new guest instruction semantics or relaxed FP mode is introduced.
Tested
God of War Sons of Sparta PPSA28997 v01.008.001, saved camp after Continue, guest-requested 1920×1080 output, Wayland/mailbox. AMD Ryzen 5 7640HS, Radeon 760M integrated GPU with shared system memory, RADV Mesa 25.0.7-2+deb13u1, Debian 13.7 / Linux 7.2.12-x64v3-xanmod1.
Fresh measured main
828ac0b2ae74versus candidate2898cf257380: mean frame time 45.724349 → 45.102210 ms. Four paired percentage reductions average 1.360314%, two-sided 95% Student-t CI [0.981098%, 1.739530%], df=3. Mean run FPS separately: 21.870307 → 22.171941.Within-arm ranges: main 0.259990 ms, candidate 0.195346 ms; sample SDs 0.124522 and 0.097929 ms. Primary metric was fixed prospectively as window duration / presents per run. Order: warm A, warm B, A1, B1, B2, A2, B3, A3, A4, B4. All ten attempts valid, no exclusions/replacements/appended runs. Acceptance required a positive paired mean and positive lower confidence bound; individual frames were not treated as independent repetitions. This supports this machine/scene only, with four pairs; other scenes/vendors and combined optimizations are unmeasured.
All eight timing traces, summaries, complete trace_digest outputs, protocol, provenance hashes and readiness-source patch. Traces are gzip JSON in base64 text; decoding and hash verification instructions are included. Same save, scene, resolution, present mode, focus/window geometry and per-arm warmed cache seeds; no cache changes or trace drops. Every run verified 50 native libraries and nine unique guest modules, hashing through its mount namespace, plus the actual loaded RADV ICD. No validation/profiling during timing. Guest output stayed on a pseudo-terminal. Identical private readiness hooks ran outside timing and are excluded from this PR. Trace
dirty:nullcomes from local dependency symlink status; exact source patches and loaded-library hashes are audited. VideoOut's only binary difference is generated revision text.The same five focused tests passed on main and candidate:
agc_shader_memory,agc_driver_runtime_images, and image-sample shared-sampler, unnormalized and VCC-sampler fixtures. Required Vulkan, no shader cache, verbose CTest and Khronos instance/device validation; four actual Radeon selections per arm, no skips, missing layers or VUIDs. Final hook-free head also passes the same checks. This is not a full-game validation-clean claim; historical vertex/index-buffer binding VUIDs remain outside this change.Two earlier independent eight-run cohorts observed 1.493919% and 1.475452% aggregate frame-time reductions (all pairs positive, no exclusions), previously withheld under a superseded 1.5% cutoff. Both complete run tables and recalculated intervals are retained in the bundle; they are historical, not current-main claims. Prior actual native analysis found one fragment 3981→3348 instructions, 40→32 VGPRs, no spills; another fragment was unchanged. That work reduction is separate from the fresh gameplay evidence.
Main advanced after timing to
e8c25dd3baa6only in relinker tests and import-audit tooling. Final headdc226ce7afdfmerges it; runtime, shader, build and dependency source trees are identical to the measured candidate. No retiming of unchanged runtime code was performed.Full overlap scan: 1,608 open PRs, 43 shared-file branches. Fourteen stale/conflicting branches were unresolved automatically and manually reviewed: #907, #5021, #5371, #5609, #6280, #6412, #6488, #7642, #7689, #9183, #9852, #10193, #10652, #11126. Their changes concern compare/gather/sRGB/unnormalized/table/heap/buffer/atomic paths; no duplicate partial-component specialization, SpecId collision or required dependency was found. Conventions pass.
Main/candidate summary lines and trace_digest excerpts (all runs in the bundle)
{"commit":"828ac0b2ae74","dirty":null,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"30:12"},"gpu":"AMD Radeon 760M (RADV PHOENIX)","driver":"radv Mesa 25.0.7-2+deb13u1","os":"Linux 7.2.12-x64v3-xanmod1","cpu":"AMD Ryzen 5 7640HS w/ Radeon 760M Graphics","cpu_threads":12,"memory_mib":23820,"title_id":"PPSA28997","title":"God of War Sons of Sparta","content_version":"01.008.001","resolution":"1920x1080","window":{"spec":"seconds 30:12","first_present":626,"ms":12012.731},"presents":263,"frame_ms":{"p50":45.574,"p90":46.233,"p99":47.685,"max":48.236},"gpu_busy_ms_per_present":42.637,"worker_busy_pct":{"queue worker 0x0":78.389},"top_phases_ms_per_frame":{"Driver.Packet":35.675,"Driver.Packet.draw":33.231,"Driver.Draw":33.191,"Driver.Draw.draw_enqueued":29.379,"Recorder.Sync":28.352,"VideoOut.Flip":9.090,"Driver.Present":9.082,"VideoOut.Flip.present":9.055},"trace_dropped":false,"trace":"aps5-trace-828ac0b2ae74-171038.json.gz"} {"commit":"2898cf257380","dirty":null,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"30:12"},"gpu":"AMD Radeon 760M (RADV PHOENIX)","driver":"radv Mesa 25.0.7-2+deb13u1","os":"Linux 7.2.12-x64v3-xanmod1","cpu":"AMD Ryzen 5 7640HS w/ Radeon 760M Graphics","cpu_threads":12,"memory_mib":23820,"title_id":"PPSA28997","title":"God of War Sons of Sparta","content_version":"01.008.001","resolution":"1920x1080","window":{"spec":"seconds 30:12","first_present":678,"ms":12023.329},"presents":266,"frame_ms":{"p50":45.135,"p90":45.615,"p99":46.881,"max":48.059},"gpu_busy_ms_per_present":42.017,"worker_busy_pct":{"queue worker 0x0":78.154},"top_phases_ms_per_frame":{"Driver.Packet":35.193,"Driver.Packet.draw":32.741,"Driver.Draw":32.703,"Driver.Draw.draw_enqueued":29.088,"Recorder.Sync":27.918,"VideoOut.Flip":9.008,"Driver.Present":8.995,"VideoOut.Flip.present":8.969},"trace_dropped":false,"trace":"aps5-trace-2898cf257380-171772.json.gz"}seconds 30:12 from present 626: 263 presents, frame p50 45.6 / p90 46.2 / p99 47.7 / max 48.2 ms, GPU busy 42.6 ms per present
AMD Radeon 760M (RADV PHOENIX), radv Mesa 25.0.7-2+deb13u1, Linux 7.2.12-x64v3-xanmod1, 1920x1080, commit 828ac0b, dropped: no
seconds 30:12 from present 678: 266 presents, frame p50 45.1 / p90 45.6 / p99 46.9 / max 48.1 ms, GPU busy 42.0 ms per present
AMD Radeon 760M (RADV PHOENIX), radv Mesa 25.0.7-2+deb13u1, Linux 7.2.12-x64v3-xanmod1, 1920x1080, commit 2898cf2, dropped: no
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)