freedreno/ir3: add experimental GCM pass
authorRob Clark <robdclark@gmail.com>
Mon, 29 Jan 2018 19:53:13 +0000 (14:53 -0500)
committerRob Clark <robdclark@gmail.com>
Sat, 10 Feb 2018 19:54:58 +0000 (14:54 -0500)
Generally seems to do worse on instruction count and register usage,
according to shader-db.  But shader-db also doesn't do a very good job
of weighting loop bodies, so that might not be totally valid.

So add an env variable to enable GCM pass for easier experimentation.

Signed-off-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/ir3/ir3_nir.c

index 3706a023d3ca4972a452364bf9e9806747de0569..6edb0e457497b38fa7a6cfabf6a0201923104be6 100644 (file)
@@ -97,6 +97,13 @@ ir3_optimize_loop(nir_shader *s)
                progress |= OPT(s, nir_copy_prop);
                progress |= OPT(s, nir_opt_dce);
                progress |= OPT(s, nir_opt_cse);
+               static int gcm = -1;
+               if (gcm == -1)
+                       gcm = env2u("GCM");
+               if (gcm == 1)
+                       progress |= OPT(s, nir_opt_gcm, true);
+               else if (gcm == 2)
+                       progress |= OPT(s, nir_opt_gcm, false);
                progress |= OPT(s, nir_opt_peephole_select, 16);
                progress |= OPT(s, nir_opt_intrinsics);
                progress |= OPT(s, nir_opt_algebraic);