pan/midgard: Report spills:fills to shader-db
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 22 Jul 2019 13:32:48 +0000 (06:32 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 22 Jul 2019 15:20:34 +0000 (08:20 -0700)
Route this info through so we can track how we're doing on register
spilling.

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

index 2ea0cc6ce600614c869eaaa44893afee4038edc2..186ee7d425fb50ae5b6cc77a8157e64b1da13e7f 100644 (file)
@@ -197,6 +197,10 @@ typedef struct compiler_context {
         /* Number of bytes used for Thread Local Storage */
         unsigned tls_size;
 
+        /* Count of spills and fills for shaderdb */
+        unsigned spills;
+        unsigned fills;
+
         /* Current NIR function */
         nir_function *func;
 
index 822cc6a0542365d882bec37cd447746e615f7108..7d6bd31abd0f76cb529c14e051f6c9477d881a01 100644 (file)
@@ -2741,12 +2741,14 @@ midgard_compile_shader_nir(nir_shader *nir, midgard_program *program, bool is_bl
 
                 fprintf(stderr, "shader%d - %s shader: "
                         "%u inst, %u bundles, %u quadwords, "
-                        "%u registers, %u threads, %u loops\n",
+                        "%u registers, %u threads, %u loops, "
+                        "%d:%d spills:fills\n",
                         SHADER_DB_COUNT++,
                         gl_shader_stage_name(ctx->stage),
                         nr_ins, nr_bundles, nr_quadwords,
                         nr_registers, nr_threads,
-                        ctx->loop_count);
+                        ctx->loop_count,
+                        ctx->spills, ctx->fills);
         }
 
 
index 84b7b1be023362220eb21bfa238c07b45bca565f..a53ba7ee208c848bb6ca9fbc6c2f4e3a10282823 100644 (file)
@@ -720,6 +720,8 @@ schedule_program(compiler_context *ctx)
 
                                 midgard_instruction st = v_load_store_scratch(ins->ssa_args.dest, spill_slot, true, ins->mask);
                                 mir_insert_instruction_before(mir_next_op(ins), st);
+
+                                ctx->spills++;
                         }
 
                         /* Insert a load from TLS before the first consecutive
@@ -759,6 +761,8 @@ schedule_program(compiler_context *ctx)
 
                                 /* Rewrite to use */
                                 mir_rewrite_index_src_single(ins, spill_node, consecutive_index);
+
+                                ctx->fills++;
                         }
                         }
                 }