aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/ir3/ir3_shader.c
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2014-09-06 12:45:17 -0400
committerRob Clark <[email protected]>2014-09-09 19:42:18 -0400
commitfd4884e9291cd941c31e9ed7858a42bec2f1eca8 (patch)
tree85e8b300e6642a2386ceb16bbf253ff8431f386c /src/gallium/drivers/freedreno/ir3/ir3_shader.c
parente387fdd2351b87f1614cebdc87a4b2aa3af8c3f6 (diff)
freedreno/ir3: add no-copy-propagate fallback step
Most of the things the new compiler still has trouble with basically amount to cp stage removing too many copies. But without the cp stage, the shaders the new compiler produces are still better (perf and correctness) than the old compiler. So a simple thing to do until I have more time to work on it is first trying falling back to new compiler without cp, before finally falling back to old compiler. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/ir3/ir3_shader.c')
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_shader.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.c b/src/gallium/drivers/freedreno/ir3/ir3_shader.c
index 4c06770d627..a170469b573 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_shader.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.c
@@ -101,6 +101,17 @@ fixup_vp_regfootprint(struct ir3_shader_variant *v)
}
}
+/* reset before attempting to compile again.. */
+static void reset_variant(struct ir3_shader_variant *v, const char *msg)
+{
+ debug_error(msg);
+ v->inputs_count = 0;
+ v->outputs_count = 0;
+ v->total_in = 0;
+ v->has_samp = false;
+ v->immediates_count = 0;
+}
+
static struct ir3_shader_variant *
create_variant(struct ir3_shader *shader, struct ir3_shader_key key)
{
@@ -122,15 +133,12 @@ create_variant(struct ir3_shader *shader, struct ir3_shader_key key)
}
if (!(fd_mesa_debug & FD_DBG_NOOPT)) {
- ret = ir3_compile_shader(v, tokens, key);
+ ret = ir3_compile_shader(v, tokens, key, true);
if (ret) {
- debug_error("new compiler failed, trying fallback!");
-
- v->inputs_count = 0;
- v->outputs_count = 0;
- v->total_in = 0;
- v->has_samp = false;
- v->immediates_count = 0;
+ reset_variant(v, "new compiler failed, trying without copy propagation!");
+ ret = ir3_compile_shader(v, tokens, key, false);
+ if (ret)
+ reset_variant(v, "new compiler failed, trying fallback!");
}
} else {
ret = -1; /* force fallback to old compiler */