freedreno: Log the number of loops in the shader for shader-db.
authorEric Anholt <eric@anholt.net>
Tue, 14 May 2019 23:24:33 +0000 (16:24 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 16 May 2019 17:25:22 +0000 (10:25 -0700)
shader-db's report.py will use this to see when we've changed loop
unrolling behavior on a shader and skip including other stats like
instruction count from being considered for that shader, since they won't
be useful as a proxy for real world performance in that case.

Reviewed-by: Rob Clark <robdclark@gmail.com>
Tested-by: Eduardo Lima Mitev <elima@igalia.com>
src/freedreno/ir3/ir3_compiler_nir.c
src/freedreno/ir3/ir3_shader.h
src/gallium/drivers/freedreno/ir3/ir3_gallium.c

index c230fbd3b708b6dbf5af25bd0941115bc9bb5dea..4cae442032cc83bd37ea229126f6565a516df746 100644 (file)
@@ -2168,6 +2168,7 @@ static void
 emit_loop(struct ir3_context *ctx, nir_loop *nloop)
 {
        emit_cf_list(ctx, &nloop->body);
+       ctx->so->loops++;
 }
 
 static void
index c2c1a5312bc8042707159365403cf40afc6319a5..06336eda0daecf6459c349b9f06c57b010e014d7 100644 (file)
@@ -401,6 +401,7 @@ struct ir3_shader_variant {
        unsigned branchstack;
 
        unsigned max_sun;
+       unsigned loops;
 
        /* the instructions length is in units of instruction groups
         * (4 instructions for a3xx, 16 instructions for a4xx.. each
index c189a90dc16e02b7762b8932f0264e2ee8ba3419..9fd84899b36eb96f1d9563df520812afedec1bfd 100644 (file)
@@ -52,7 +52,7 @@ dump_shader_info(struct ir3_shader_variant *v, struct pipe_debug_callback *debug
        pipe_debug_message(debug, SHADER_INFO,
                        "%s shader: %u inst, %u dwords, "
                        "%u half, %u full, %u const, %u constlen, "
-                       "%u (ss), %u (sy), %d max_sun\n",
+                       "%u (ss), %u (sy), %d max_sun, %d loops\n",
                        ir3_shader_stage(v->shader),
                        v->info.instrs_count,
                        v->info.sizedwords,
@@ -61,7 +61,7 @@ dump_shader_info(struct ir3_shader_variant *v, struct pipe_debug_callback *debug
                        v->info.max_const + 1,
                        v->constlen,
                        v->info.ss, v->info.sy,
-                       v->max_sun);
+                       v->max_sun, v->loops);
 }
 
 struct ir3_shader_variant *