[Mesa-dev] [PATCH] radv: don't lower indirects until after opts have run

Timothy Arceri tarceri at itsqueeze.com
Thu Mar 8 08:37:36 UTC 2018


Noticed while passing by. nNot sure if it impacts anything, but
likely to impact GFX9 more than anything else since we lower
inputs, outputs and locals there.
---
 src/amd/vulkan/radv_shader.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 85672e600d..094cae4f93 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -271,7 +271,7 @@ radv_shader_compile_to_nir(struct radv_device *device,
 	nir_lower_var_copies(nir);
 	nir_lower_global_vars_to_local(nir);
 	nir_remove_dead_variables(nir, nir_var_local);
-	ac_lower_indirect_derefs(nir, device->physical_device->rad_info.chip_class);
+//ac_lower_indirect_derefs(nir, device->physical_device->rad_info.chip_class);
 	nir_lower_subgroups(nir, &(struct nir_lower_subgroups_options) {
 			.subgroup_size = 64,
 			.ballot_bit_size = 64,
@@ -283,6 +283,14 @@ radv_shader_compile_to_nir(struct radv_device *device,
 
 	radv_optimize_nir(nir);
 
+	/* Indirect lowering must be call after the radv_optimize_nir() loop
+	 * has been called at least once. Otherwise indirect lowering can
+	 * bloat the instruction count of the loop and cause it to be
+	 * considered too large for unrolling.
+	 */
+	ac_lower_indirect_derefs(nir, device->physical_device->rad_info.chip_class);
+	radv_optimize_nir(nir);
+
 	return nir;
 }
 
-- 
2.14.3



More information about the mesa-dev mailing list