Commit 4fa92a7b by Ben Clayton

VkPipeline: Add basic optimization passes.

A lot of the Regres timeouts we are seeing are in LLVM code generation. These appear to happen for shaders with a pathological number of loads and stores - most likely created by glslang. Each of these loads and stores produce a bunch of branches in the LLVM IR (due to lane masking), which then choke LLVM. Tests: dEQP-VK.ssbo.layout.* Change-Id: I0bb654d9001d0d6bdd02244844bed8e73ce8d9d4 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28348 Presubmit-Ready: Ben Clayton <bclayton@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent 5d143aa0
...@@ -228,6 +228,15 @@ std::vector<uint32_t> preprocessSpirv( ...@@ -228,6 +228,15 @@ std::vector<uint32_t> preprocessSpirv(
opt.RegisterPass(spvtools::CreateFreezeSpecConstantValuePass()); opt.RegisterPass(spvtools::CreateFreezeSpecConstantValuePass());
opt.RegisterPass(spvtools::CreateFoldSpecConstantOpAndCompositePass()); opt.RegisterPass(spvtools::CreateFoldSpecConstantOpAndCompositePass());
// Basic optimization passes to primarily address glslang's love of loads &
// stores. Significantly reduces time spent in LLVM passes and codegen.
opt.RegisterPass(spvtools::CreateLocalAccessChainConvertPass());
opt.RegisterPass(spvtools::CreateLocalSingleBlockLoadStoreElimPass());
opt.RegisterPass(spvtools::CreateLocalSingleStoreElimPass());
opt.RegisterPass(spvtools::CreateBlockMergePass());
opt.RegisterPass(spvtools::CreateLocalMultiStoreElimPass());
opt.RegisterPass(spvtools::CreateSSARewritePass());
std::vector<uint32_t> optimized; std::vector<uint32_t> optimized;
opt.Run(code.data(), code.size(), &optimized); opt.Run(code.data(), code.size(), &optimized);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment