Repository navigation
perf(shader): evaluate only the selected cosine polynomial - #16350
Conversation
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release, Radeon RX 6700 XT, AMD driver 26.10.1. Run through the Windows test queue with This PR adds no test, so I ran the existing GPU execution tests that go through the sine/cosine emitter it changes:
This is correctness only; I did not measure the performance effect on this machine. AI-assisted: yes. |
✅ NVIDIA GPU test: passedPR head
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (4, not counted against this PR)Validation IDs already present on main (9 IDs in 587 tests)Skipped (52)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. |
|
NVIDIA runs to go with JJenkx's Radeon check,
So the new AI-assisted: yes (Claude Code) |
|
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.
|
What
The cosine accuracy fallback evaluates both its sine and cosine polynomial alternatives before selecting the required range. This keeps two arithmetic chains live even though only one result is selected.
The original choice
p3 ? -cosine : p1 ? sine : cosineequals choosing sine whenp1 && !p3and choosing the original signed cosine otherwise, including when NaN makes both ordered comparisons false. Selected arithmetic, rounding/denormal modes, signed zero and upstream NaN repairs remain unchanged. This follows the existing conditional sine structure and retains the shared cosine chain.A pinned Kyty source comparison motivated inspecting the larger accuracy sequence. Kyty's native-only trig behavior is not substituted for AnyPS5's fallback. No cross-engine speed ratio is claimed.
Tested
Same five focused reduction, near-zero, GCN, unary and denormal-flush fixtures pass on pinned main and the final clean candidate with required Vulkan, disabled shader cache and actual Radeon/Khronos instance/device loading. Neither arm reports VUIDs, missing layers or skips. A private extension of the existing synthetic fixture also produced 39,424 bit-identical output words across supported float/fused modes and retained the same two existing unsupported denormal-mode refusals. All 16 synthetic modules validate.
The executing game's primary fragment module retains 27 sine and nine cosine operations and gains nine conditional cosine regions. Static FMA count is unchanged and SPIR-V grows; no native instruction-count saving is claimed.
Sons of Sparta, Radeon 760M, same owned saved camp, system RADV Mesa 25.0.7-2+deb13u1, journal enabled, immediate presentation, exact arithmetic and optimized GPL/LTO. Requested/render extent and presentation 1920x1080, windowed client 1152x648; physical VkImage extent was not separately measured. Main was pinned at
0fbe14c15361at the start of this batch; candidate is492014640f0a.Primary: run-level GPU timestamped command-span ms per delivered present, weighted over whole 1s summaries wholly inside first-present+50..110s. The screen and confirmation are separate prospective cohorts:
All 20 timed runs are valid, with zero exclusions or replacements. Frames are not independent replicates. This is a small command-span efficiency result at the approximately 60 FPS cap; no energy, uncapped FPS or stutter improvement is established. Divergent/backend behavior can limit the benefit on other workloads.
Complete timing-only evidence, protocols, every full upstream digest and original-byte/metric verifier. Both arms use the same disclosed minimal readiness hook; diagnostic draw probes are removed. Game data, shaders and screenshots remain private.
The overlap tool could not complete four shared-file comparisons (#5021, #7410, #12324, #13486). Manual source review of their unchanged audited heads found no duplicate conditional-cosine implementation or prerequisite; #13486's adjacent GCN limits are retained. This is not a claim that the tool returned a clean result.
Required original detailed 12s trace summaries from the first predeclared screen pair follow. These captures finish before the separate primary window used above. All 20 full original timing traces and benches are attached in the evidence bundle.
Main:
{"commit":"0fbe14c15361","dirty":true,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_BENCH":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"524288","APS5_TRACE_SECONDS":"30:12","APS5_TRACE_SUMMARY_EVERY":"1"},"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":1435,"ms":12012.005},"presents":720,"frame_ms":{"p50":16.684,"p90":16.692,"p99":16.707,"max":17.008},"gpu_busy_ms_per_present":9.955,"worker_busy_pct":{"queue worker 0x0":66.292},"top_phases_ms_per_frame":{"VideoOut.Flip":16.655,"VideoOut.Flip.vblank_wait":14.898,"Driver.Packet":10.981,"Driver.Packet.draw":9.073,"Driver.Draw":9.042,"Driver.Draw.device_setup":3.378,"Graphics.Draw":3.366,"Graphics.Draw.draw_and_resource_release":2.832},"trace_dropped":false,"trace":"aps5-trace-0fbe14c15361-3402525.json.gz"}Change:
{"commit":"492014640f0a","dirty":true,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_BENCH":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"524288","APS5_TRACE_SECONDS":"30:12","APS5_TRACE_SUMMARY_EVERY":"1"},"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":1461,"ms":12012.003},"presents":720,"frame_ms":{"p50":16.683,"p90":16.693,"p99":16.708,"max":16.735},"gpu_busy_ms_per_present":9.905,"worker_busy_pct":{"queue worker 0x0":66.536},"top_phases_ms_per_frame":{"VideoOut.Flip":16.657,"VideoOut.Flip.vblank_wait":14.894,"Driver.Packet":11.026,"Driver.Packet.draw":9.158,"Driver.Draw":9.125,"Driver.Draw.device_setup":3.383,"Graphics.Draw":3.316,"Driver.Draw.draw_enqueued":2.904},"trace_dropped":false,"trace":"aps5-trace-492014640f0a-3403744.json.gz"}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)