From 5693c77efba876f4a6efdaa5480754ae80cfd3cf Mon Sep 17 00:00:00 2001 From: STL1te <1242562+STL1te@users.noreply.github.com> Date: Wed, 30 Sep 2026 10:32:15 +0300 Subject: [PATCH] fix(shader): BDA lookup functions are not inlined NVIDIA's compiler inlines every call of the BDA lookup functions, each with its binary-search loop, and then spends minutes compiling shaders with a few hundred guest memory accesses. Marked DontInline, they compile in seconds. Pipeline creation without the driver cache, NVIDIA RTX PRO 6000 Blackwell: | Shader | SPIR-V words | Inlined | DontInline | |--------------|--------------|----------|------------| | 0x25b1e8600 | 280168 | 104.4 s | 4.8 s | | 0x7ff6df189d00 | 95698 | 86.3 s | 1.5 s | | 0x25b27ce00 | 39959 | 6.0 s | 0.45 s | | 0x25b27e400 | 40640 | 6.6 s | 0.48 s | | 0x7ff6df2a8000 | 69179 | 5.7 s | 1.1 s | | 0x7ff6df253400 | 90491 | 4.1 s | 0.74 s | | 0x7ff6df256700 | 92459 | 4.0 s | 0.69 s | The menu renders 3311 frames in 120 s against 3325 without the change; the story mode load takes the same time and GPU dispatch time in both builds. Co-Authored-By: Claude Opus 5.5 (cherry picked from commit 7615af4d4dd31581f52aa5d88118c73435fd6ae9) --- core/shader/recompiler/SpirvBackend/src/SpirvBdaLookup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/shader/recompiler/SpirvBackend/src/SpirvBdaLookup.cpp b/core/shader/recompiler/SpirvBackend/src/SpirvBdaLookup.cpp index 62a7a4289..f3ef2e128 100644 --- a/core/shader/recompiler/SpirvBackend/src/SpirvBdaLookup.cpp +++ b/core/shader/recompiler/SpirvBackend/src/SpirvBdaLookup.cpp @@ -31,7 +31,7 @@ std::uint32_t DefineBdaLookup(SpirvEmitterState& state, const char* name, bool r }; const auto function = state.module.AllocateId(); state.module.AddName(function, name); - state.module.AddFunction(spv::OpFunction, u64, function, spv::FunctionControlMaskNone, state.module.Type(spv::OpTypeFunction, u64, u64, u32, u32)); + state.module.AddFunction(spv::OpFunction, u64, function, spv::FunctionControlDontInlineMask, state.module.Type(spv::OpTypeFunction, u64, u64, u32, u32)); const auto address = state.module.AllocateId(); const auto bytes = state.module.AllocateId(); const auto instruction = state.module.AllocateId();