From b84e003079a5e89ffc857697ad63fe22e3d18cb6 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Fri, 6 May 2022 12:04:05 +1000 Subject: [PATCH] r600: switch to NIR loop unrolling Note the NIR unrolling code was already enabled but we bump the iteration unroll count to match the GLSL IR limit as per the comment about loop bugs. Reviewed-by: Emma Anholt Part-of: --- src/gallium/drivers/r600/r600_pipe.c | 7 +------ src/gallium/drivers/r600/r600_pipe_common.c | 6 +++++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index d5f50b8b163..85e987fff3e 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -642,6 +642,7 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, } return ir; } + case PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT: case PIPE_SHADER_CAP_DROUND_SUPPORTED: case PIPE_SHADER_CAP_DFRACEXP_DLDEXP_SUPPORTED: case PIPE_SHADER_CAP_LDEXP_SUPPORTED: @@ -663,12 +664,6 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, return EG_MAX_ATOMIC_BUFFERS; } return 0; - case PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT: - /* due to a bug in the shader compiler, some loops hang - * if they are not unrolled, see: - * https://bugs.freedesktop.org/show_bug.cgi?id=86720 - */ - return 255; } return 0; } diff --git a/src/gallium/drivers/r600/r600_pipe_common.c b/src/gallium/drivers/r600/r600_pipe_common.c index 572a1676b02..7a4e61132db 100644 --- a/src/gallium/drivers/r600/r600_pipe_common.c +++ b/src/gallium/drivers/r600/r600_pipe_common.c @@ -1339,7 +1339,11 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen, .lower_insert_byte = true, .lower_insert_word = true, .lower_rotate = true, - .max_unroll_iterations = 32, + /* due to a bug in the shader compiler, some loops hang + * if they are not unrolled, see: + * https://bugs.freedesktop.org/show_bug.cgi?id=86720 + */ + .max_unroll_iterations = 255, .lower_interpolate_at = true, .vectorize_io = true, .has_umad24 = true,