From 6ac3f9d64e49e28263a6ac631aae2d252711e722 Mon Sep 17 00:00:00 2001 From: SoroushIMG Date: Tue, 27 Sep 2022 11:18:11 +0100 Subject: [PATCH] zink: enable loop unrolling for loops that have soft fp64 The info that a loop contains fp64 ops is lost after full software lowering. Therefore, specifically unroll these loops in zink instead of in vulkan, where the blown up body is no longer unrolled. This helps a lot in KHR-Single-GL46.arrays_of_arrays_gl.SubroutineFunctionCalls2. Reviewed-by: Mike Blumenkrantz Part-of: --- src/gallium/drivers/zink/ci/zink-tu-a630-fails.txt | 1 - src/gallium/drivers/zink/zink_compiler.c | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/ci/zink-tu-a630-fails.txt b/src/gallium/drivers/zink/ci/zink-tu-a630-fails.txt index 2d29a159fd1..3da662b4a6e 100644 --- a/src/gallium/drivers/zink/ci/zink-tu-a630-fails.txt +++ b/src/gallium/drivers/zink/ci/zink-tu-a630-fails.txt @@ -3,7 +3,6 @@ GTF-GL46.gtf30.GL3Tests.sgis_texture_lod.sgis_texture_lod_basic_lod_selection,Fa GTF-GL46.gtf32.GL3Tests.draw_elements_base_vertex.draw_elements_base_vertex_invalid_mode,Fail KHR-Single-GL46.arrays_of_arrays_gl.AtomicUsage,Fail -KHR-Single-GL46.arrays_of_arrays_gl.SubroutineFunctionCalls2,Crash # Turnip has maxFragmentInputComponents = 124, while GL requires # gl_MaxFragmentInputComponents >= 128 diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index 7dec1da36fd..9b2fda5e7f8 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -394,6 +394,7 @@ zink_screen_init_compiler(struct zink_screen *screen) .has_txs = true, .lower_mul_2x32_64 = true, .support_16bit_alu = true, /* not quite what it sounds like */ + .max_unroll_iterations = 0, }; screen->nir_options = default_options; @@ -405,6 +406,10 @@ zink_screen_init_compiler(struct zink_screen *screen) screen->nir_options.lower_doubles_options = ~0; screen->nir_options.lower_flrp64 = true; screen->nir_options.lower_ffma64 = true; + /* soft fp64 function inlining will blow up loop bodies and effectively + * stop Vulkan drivers from unrolling the loops. + */ + screen->nir_options.max_unroll_iterations_fp64 = 32; } /*