[Mesa-dev] [PATCH 05/11] panfrost/midgard: Include loop count for shader-db
Alyssa Rosenzweig
alyssa.rosenzweig at collabora.com
Wed Jul 10 13:24:32 UTC 2019
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 at collabora.com>
---
src/gallium/drivers/panfrost/midgard/compiler.h | 3 +++
src/gallium/drivers/panfrost/midgard/midgard_compile.c | 8 ++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
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);
}
--
2.20.1
More information about the mesa-dev
mailing list