pan/mdg: Use analysis to set .cont/.last flags
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 12 May 2020 17:34:52 +0000 (13:34 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 12 May 2020 22:30:41 +0000 (22:30 +0000)
Corresponds roughly to what we analyze. Note that "terminate AND
execute" is a contradiction (rather: it's equivalent to just
terminating), hence why there are only three possibilities for the
states of the flags:

   .cont = continue, don't execute
   .last = don't continue, don't execute
   .cont.last = continue and execute

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5014>

src/panfrost/midgard/midgard_emit.c

index 98844169faed400674089705a56bb56d27c3b010..b62052b1317cf4117a3e477f16e3d9a995beb97e 100644 (file)
@@ -508,16 +508,8 @@ emit_binary_bundle(compiler_context *ctx,
                 ctx->texture_op_count--;
 
                 if (mir_op_computes_derivatives(ctx->stage, ins->texture.op)) {
-                        bool continues = ctx->texture_op_count > 0;
-
-                        /* Control flow complicates helper invocation
-                         * lifespans, so for now just keep helper threads
-                         * around indefinitely with loops. TODO: Proper
-                         * analysis */
-                        continues |= ctx->loop_count > 0;
-
-                        ins->texture.cont = continues;
-                        ins->texture.last = !continues;
+                        ins->texture.cont = !ins->helper_terminate;
+                        ins->texture.last = ins->helper_terminate || ins->helper_execute;
                 } else {
                         ins->texture.cont = ins->texture.last = 1;
                 }