Add NDEBUG & disable some DXIL optimizations.#23
Conversation
|
Are we sure we want to eliminate dead code elimination and constant folding? I know the driver will do those at pipeline compilation time. But we have seen a lot of drivers handle them quite poorly. In fact, we are adding re-spirv in Godot to do both those optimizations on SPIRV to save the drivers from having to do them at pipeline compilation time edit actually, I just answered myself. We might be able to run re-spirv in D3D12 too before the NIR step which might actually help reduce the cost of the NIR translation step further and avoid us relying on these optimizations |
|
I only disabled the optimizations done during the SPIR-V -> NIR step. There is still an optimization pass done inside NIR -> DXIL. Like I mention in the main post, the output DXIL is barely different. It just adds some redundant control flow (like jumping to a jump) that the driver compiler should easily be able to optimize out. |
Oh, good to know. Its strange that they would be doing redundant optimizations, but maybe it catches some edge cases in more complex shaders. At any rate, it would be worth exploring doing a re-spirv pass before NIR to see if we can trim down the cost of the SPIRV->DXIL conversion even more as a follow up. I can ask Dario to do that after he is back from vacation |
clayjohn
left a comment
There was a problem hiding this comment.
Content wise the changes look good from my end. I will leave it up to Bruvzg to make the final call on merging
|
I have updated CI config so it should work now, please rebase PR to make sure all CI builds are running fine. |
6da5042 to
eb3eef2
Compare
|
The MSVC artifacts seem to be missing the bin folders? |
|
It seems to be not building with MSVC at all (there's GCC in the logs), so likely something with never MSVC detection, I'll check it tomorrow. |
MSVC detection should be fixed now (#25), artifacts have correct libs. |
Companion PR to: - godotengine/godot-nir-static#22 - godotengine/godot-nir-static#23 - godotengine/godot#111762 (cherry picked from commit 7126657)
Without NDEBUG, the compiled binaries include all assertions and NIR validation passes, which significantly slow down the conversion process.
We can also remove the optimizations applied during the SPIR-V -> NIR pass to save even more time, with barely any impact on the DXIL output.
With both of these changes, conversion times decrease by 2x - 2.5x depending on the project. For example, in the TPS Demo, with both Godot and driver shader caches cleared, the loading time drops from 82 seconds to 33 seconds on my system. For reference, Vulkan is 15 seconds.
Note: Since the validation passes are going to be compiled out, the explicit call to
nir_validate_shaderneeds to be removed in Godot. I'll do that in this PR.