fix(shader): BDA lookup functions are not inlined #174
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/174"
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 STL1te on 2026-09-30T07:33:39Z.
What
DefineBdaLookupemitsget_bda_pointer,probe_bda_pointerandget_bda_write_pointeras ordinary SPIR-V functions. NVIDIA's compiler inlines every call of them, each with its binary-search loop over the BDA table, and then spends minutes on shaders with a few hundred guest memory accesses: a ray-tracing compute shader with 496 lookup calls (~88% of them from scalar loads through GPU-selected V#s, one probe plus four byte lookups per dword, twice for the wave64 halves) took 104 s to create as a pipeline. Its compile time tracks the number of inlinedOpConvertUToPtrsites and loops, not the size of the module.The functions are now declared with
FunctionControlDontInlineMask. Nothing else changes: same SPIR-V otherwise, same lookups, same fault reporting.Pipeline creation with the driver's disk cache defeated (a fresh generator word per module), NVIDIA RTX PRO 6000 Blackwell:
The same shader structured by #134 (278,626 words) goes from 103.8 s to 4.84 s with this change, so the two are independent.
Tested
Windows 11 Pro, MinGW-w64 GCC, NVIDIA RTX PRO 6000 Blackwell.
spirv-valclean on the modules above; the recompiled SPIR-V differs from the previous build only in the function control word of the three lookup functions.ctestpasses.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repository