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

Submitted by Samuel Pitoiset on April 23, 2019, 7:38 a.m.

Details

Message ID 20190423073857.24623-2-samuel.pitoiset@gmail.com
State Rejected
Headers show
Series "Series without cover letter" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Samuel Pitoiset April 23, 2019, 7:38 a.m.
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@gmail.com>
---
 src/amd/vulkan/radv_shader.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

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);