panfrost/midgard: Include loop count for shader-db
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 9 Jul 2019 18:10:49 +0000 (11:10 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 10 Jul 2019 13:45:20 +0000 (06:45 -0700)
We have to emit it anyway for the report to be happy (with respect to
unrolling), so return an actual count rather than dummy numbers.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/midgard/compiler.h
src/gallium/drivers/panfrost/midgard/midgard_compile.c

index 820831d35dd9869fbf020cf8b4daa5c6e516fe41..5692467c565b4824421d25466bf34e6187fb84c2 100644 (file)
@@ -212,6 +212,9 @@ typedef struct compiler_context {
          * when using nested loops */
         int current_loop_depth;
 
+        /* Total number of loops for shader-db */
+        unsigned loop_count;
+
         /* Constants which have been loaded, for later inlining */
         struct hash_table_u64 *ssa_constants;
 
index 43f451c79db2af92e260abd008a1d5a1d36c0bdd..1e09e46218c5100252e7e1017f57e3c08a6b6b1f 100644 (file)
@@ -2479,6 +2479,9 @@ emit_loop(struct compiler_context *ctx, nir_loop *nloop)
         /* Now that we've finished emitting the loop, free up the depth again
          * so we play nice with recursion amid nested loops */
         --ctx->current_loop_depth;
+
+        /* Dump loop stats */
+        ++ctx->loop_count;
 }
 
 static midgard_block *
@@ -2883,11 +2886,12 @@ midgard_compile_shader_nir(nir_shader *nir, midgard_program *program, bool is_bl
 
                 fprintf(stderr, "shader%d - %s shader: "
                                 "%u inst, %u bundles, "
-                                "%u registers, %u threads, 0 loops\n",
+                                "%u registers, %u threads, %u loops\n",
                                 SHADER_DB_COUNT++,
                                 gl_shader_stage_name(ctx->stage),
                                 nr_ins, nr_bundles,
-                                nr_registers, nr_threads);
+                                nr_registers, nr_threads,
+                                ctx->loop_count);
         }