Enable more optimizations for the compiler like LTO, PGO, PLO #5632
zamazan4ik
started this conversation in
Ideas
Replies: 1 comment 4 replies
-
I don't think the techniques mentioned here make sense for Slang. For shaders, there is no known way to collect the "profile" data where there can be thousands of pixels running at the same time every seconds, if not milliseconds. The linking is also not very relevant for shader, because each compilation units for shaders are not really linked in a way that cpp object files are linked. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
Here I want to propose additional optimizations that can be enabled for the Slang compiler (and maybe other related Slang tools too).
Link-Time Optimization (LTO)
Link-Time Optimization (LTO) is an additional compiler optimization that gives more context to the compiler during the optimization process which leads to better optimization results. It's supported by all major C++ compilers like GCC, Clang, MSVC (
-flto
for GCC e.g.). It also could be enabled on the CMake level viaset(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
.I tried to search over the build scripts but didn't find a place where LTO is enabled so I suppose it's disabled for now.
Profile-Guided Optimization (PGO) and Post-Link Optimization (PLO)
According to my benchmarks, PGO measurably helps to optimize various applications (its CPU efficiency more precisely) in several domains, especially compilers, static analysis, linters, etc - see Clang, Rustc, clang-tidy, Rust Analyzer and many other examples. That's why I think applying PGO (and a similar PLO technique via LLVM BOLT) could help to optimize Slang further even after LTO.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions