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 <noreply@anthropic.com> (cherry picked from commit 7615af4d4dd31581f52aa5d88118c73435fd6ae9)
This commit is contained in:
parent
0f6205aa36
commit
5693c77efb
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue