[Mesa-dev] [PATCH 2/2] radv: workaround a GPU hang with No Man Sky by skipping split_alu_of_phi

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Apr 23 07:38:57 UTC 2019


This pass seems totally correct, as well as the generated NIR and
LLVM IR for the revelant shader that hangs the GPU. This likely
triggers a new bug in LLVM which has to be fixed.

As LLVM 7&8 have already been released we need a workaround.

According to my collection of vkpipeline-db shaders, this is the only
game that is affected by this optimization.

Fixes: 0881e90c099 ("nir: Split ALU instructions in loops that read phis")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 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 54a4e732230..fd80e4aac93 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -158,7 +158,15 @@ radv_optimize_nir(struct nir_shader *shader, bool optimize_conservatively,
 			NIR_PASS(progress, shader, nir_opt_remove_phis);
                         NIR_PASS(progress, shader, nir_opt_dce);
                 }
-                NIR_PASS(progress, shader, nir_opt_if, true, false);
+
+		/* Skip the split_alu_of_phi NIR pass because this triggers a
+		 * new bug in LLVM with No Man Sky.
+		 * (see https://bugs.freedesktop.org/show_bug.cgi?id=110471).
+		 * As far I can tell, it's the only game that is affected by
+		 * this optimization.
+		 * TODO: Fix LLVM!
+		 */
+                NIR_PASS(progress, shader, nir_opt_if, true, true);
                 NIR_PASS(progress, shader, nir_opt_dead_cf);
                 NIR_PASS(progress, shader, nir_opt_cse);
                 NIR_PASS(progress, shader, nir_opt_peephole_select, 8, true, true);
-- 
2.21.0



More information about the mesa-dev mailing list