perf(shader): adaptive SPIR-V, drop exact emulation where the device provably gives RDNA's bits #11183
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 tibzejoker on 2026-10-25T20:52:17Z.
Exact emulation is most of the SPIR-V we emit for float-heavy compute: up to ~400x the size of the source ISA. Part of it can go where the host GPU provably gives RDNA's bits. This issue tracks that series ("adaptive SPIR-V"), so steps don't collide and closed attempts are not repeated.
Rule for every step: a capability, a spec guarantee or a startup probe only chooses between two paths that give RDNA's bits; it never relaxes semantics. #6503 already does this for the f32 denormal flush (
FloatFlushProberuns the emulated and the hardware build on the device and keeps hardware only if they agree). Background: #4977.Where the words are (current
main)Measured offline with
agc_shader_replayon 79 compute requests from Grand Theft Auto V (open world),maine1ef22e88, RTX 4090 target (native f16 modes, no f32 denormal mode). 2,036,728 words in total;0x25b390800alone is 552k. Attribution: each emitted instruction traced back to the IR op and ISA instruction that produced it (88 % of words attributed; the rest is header, types, constants). The f16 sub-buckets are estimates (±25 % between them, total solid).main(#1252, #2411, #7698); what is left is mostly inside the f16 FMA emulationPlanned steps (one PR each, each with a test that fails on
mainand its own before/after numbers)3rdparty/SPIRV-Toolsand3rdparty/SPIRV-Headersback to v2025.4 /01e057791by accident, which undid #5319;spv::OpFmaKHRand spirv-val'sSPV_KHR_fmasupport are gone again.OpFmaKHR(#11265: #4072 rebased, @queeeef's commit). Measured: GTA compute corpus -7.7 % words,0x25b390800NVIDIA pipeline creation 5445 -> 3743 ms. Vulkan listsOpFmaKHRas correctly rounded and subject toDenormPreserve; withRoundingModeRTE16 that is RDNA'sv_pk_fma_f16for non-NaN inputs, and the existing NaN / FP16_OVFL / clamp rules run on the result bits. No probe needed. Devices withoutshaderFmaFloat16(e.g. Intel UHD 770 on Windows) keep the f32 path.computeKnownFPClass) rather than by probe. Largest exact cause left; the most work.Each step reports word counts and pipeline creation time on the same requests, and GPU time from a windowed trace (
APS5_TRACE_SECONDS) for the affected batches.Lessons from earlier attempts
NoContractionon the result). OnlyOpFmaKHRis.If you are working on one of these steps, or know why one would be rejected, please say so here.
AI-assisted: yes (Claude Code).