perf(shader): specialize constant sampled-image components #13821
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13821"
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-31T08:11:03Z.
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)
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
828ac0b2ae, dropped: noseconds 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
2898cf2573, dropped: noChecklist
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-31T08:16:10Z.
Review: APPROVED
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
dc226ce7afdff94b06bcbc5a884032f3f1d93f9fagainst base/currentmaine8c25dd3baa6e78531d5eee067fec5cbe8af3dcf; merge preview was clean. Local environment: Linux x86-64, Python 3.11.2; I did not compile. I ran: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 CMakeCONFIGURE_DEPENDSsource glob and test loop, which build and registeragc_driver_runtime_images.Results
trace_digest.pyoutputs exactly matched the supplied reportsThe 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
Negative control
RuntimeImages.cppdistinguishes constant-zero/one values from sampled componentsFindings
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
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
dc226ce7afdff94b06bcbc5a884032f3f1d93f9fwhen I submitted this review.