From: Alyssa Rosenzweig Date: Tue, 9 Jul 2019 18:10:49 +0000 (-0700) Subject: panfrost/midgard: Include loop count for shader-db X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7ad6516f3b70e46683bedbe2dc22623d87e13525;p=mesa.git panfrost/midgard: Include loop count for shader-db 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 --- diff --git a/src/gallium/drivers/panfrost/midgard/compiler.h b/src/gallium/drivers/panfrost/midgard/compiler.h index 820831d35dd..5692467c565 100644 --- a/src/gallium/drivers/panfrost/midgard/compiler.h +++ b/src/gallium/drivers/panfrost/midgard/compiler.h @@ -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; diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c b/src/gallium/drivers/panfrost/midgard/midgard_compile.c index 43f451c79db..1e09e46218c 100644 --- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c +++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c @@ -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); }