vc4: Enable NIR-based loop unrolling.
authorEric Anholt <eric@anholt.net>
Tue, 27 Dec 2016 20:29:09 +0000 (12:29 -0800)
committerEric Anholt <eric@anholt.net>
Thu, 29 Dec 2016 22:41:09 +0000 (14:41 -0800)
This successfully unrolls a new shader in GLB2.7, which also gets that
shader to successfully compile in multithreaded mode.

src/gallium/drivers/vc4/vc4_program.c

index 611c90d7bc32d32ac3ffe199ae07794c6ba6e6e2..54692bc73f94c2dd49dd3031aae79bdaa35e11d3 100644 (file)
@@ -1540,6 +1540,10 @@ vc4_optimize_nir(struct nir_shader *s)
                 NIR_PASS(progress, s, nir_opt_algebraic);
                 NIR_PASS(progress, s, nir_opt_constant_folding);
                 NIR_PASS(progress, s, nir_opt_undef);
+                NIR_PASS(progress, s, nir_opt_loop_unroll,
+                         nir_var_shader_in |
+                         nir_var_shader_out |
+                         nir_var_local);
         } while (progress);
 }
 
@@ -2155,6 +2159,7 @@ static const nir_shader_compiler_options nir_options = {
         .lower_fsqrt = true,
         .lower_negate = true,
         .native_integers = true,
+        .max_unroll_iterations = 32,
 };
 
 const void *