[Mesa-dev] [PATCH 2/2] radv: make use of nir_lower_load_const_to_scalar()

Timothy Arceri tarceri at itsqueeze.com
Mon Jul 16 04:01:41 UTC 2018


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



More information about the mesa-dev mailing list