This allows NIR to CSE more operations. LLVM does this also so the impact is limited, however doing this in NIR allows other opts to make progress.
I didn't have a large vkpipeline-db to run this against but for radeonsi enabling this allowed some loops in Civilization Beyond Earth shaders to unroll. --- src/amd/vulkan/radv_shader.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index c10209c79dd..14faf2f174a 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -314,6 +314,8 @@ radv_shader_compile_to_nir(struct radv_device *device, .lower_vote_eq_to_ballot = 1, }); + NIR_PASS_V(nir, nir_lower_load_const_to_scalar); + if (!(flags & VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT)) radv_optimize_nir(nir, false); -- 2.17.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev