diff options
author | Erico Nunes <[email protected]> | 2019-08-03 10:56:12 +0200 |
---|---|---|
committer | Erico Nunes <[email protected]> | 2019-08-06 15:43:31 +0200 |
commit | e0aeee946004685527dfa0a4f5f141b85ae076dd (patch) | |
tree | 84377b66fb5c5f8b9e237b6aae65ae7038c886c4 /src/gallium/drivers/lima/ir/gp | |
parent | 9e41a514a8aabe209e7cc999a609c9a0a252b3d7 (diff) |
lima: add summary report for shader-db
Very basic summary, loops and gpir spills:fills are not updated yet and
are only there to comply with the strings to shader-db report.py regex.
For now it can be used to analyze the impact of changes in instruction
count in both gpir and ppir.
The LIMA_DEBUG=shaderdb setting can be useful to output stats on
applications other than shader-db.
Signed-off-by: Erico Nunes <[email protected]>
Reviewed-by: Qiang Yu <[email protected]>
Diffstat (limited to 'src/gallium/drivers/lima/ir/gp')
-rw-r--r-- | src/gallium/drivers/lima/ir/gp/codegen.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/lima/ir/gp/gpir.h | 6 | ||||
-rw-r--r-- | src/gallium/drivers/lima/ir/gp/nir.c | 28 |
3 files changed, 34 insertions, 1 deletions
diff --git a/src/gallium/drivers/lima/ir/gp/codegen.c b/src/gallium/drivers/lima/ir/gp/codegen.c index 19eb38c18a7..76e360b4fb1 100644 --- a/src/gallium/drivers/lima/ir/gp/codegen.c +++ b/src/gallium/drivers/lima/ir/gp/codegen.c @@ -602,6 +602,7 @@ bool gpir_codegen_prog(gpir_compiler *comp) comp->prog->shader = code; comp->prog->shader_size = num_instr * sizeof(gpir_codegen_instr); + comp->num_instr = num_instr; if (lima_debug & LIMA_DEBUG_GP) { gpir_codegen_print_prog(comp); diff --git a/src/gallium/drivers/lima/ir/gp/gpir.h b/src/gallium/drivers/lima/ir/gp/gpir.h index e7707814b7c..36553a7e169 100644 --- a/src/gallium/drivers/lima/ir/gp/gpir.h +++ b/src/gallium/drivers/lima/ir/gp/gpir.h @@ -388,6 +388,12 @@ typedef struct gpir_compiler { struct lima_vs_shader_state *prog; int constant_base; + + /* shaderdb */ + int num_instr; + int num_loops; + int num_spills; + int num_fills; } gpir_compiler; #define GPIR_VALUE_REG_NUM 11 diff --git a/src/gallium/drivers/lima/ir/gp/nir.c b/src/gallium/drivers/lima/ir/gp/nir.c index 18121b9a914..c208d735b9d 100644 --- a/src/gallium/drivers/lima/ir/gp/nir.c +++ b/src/gallium/drivers/lima/ir/gp/nir.c @@ -24,6 +24,8 @@ #include "util/ralloc.h" #include "compiler/nir/nir.h" +#include "pipe/p_state.h" + #include "gpir.h" #include "lima_context.h" @@ -396,7 +398,29 @@ static int gpir_glsl_type_size(enum glsl_base_type type) return 4; } -bool gpir_compile_nir(struct lima_vs_shader_state *prog, struct nir_shader *nir) +static void gpir_print_shader_db(struct nir_shader *nir, gpir_compiler *comp, + struct pipe_debug_callback *debug) +{ + const struct shader_info *info = &nir->info; + char *shaderdb; + int ret = asprintf(&shaderdb, + "%s shader: %d inst, %d loops, %d:%d spills:fills\n", + gl_shader_stage_name(info->stage), + comp->num_instr, + comp->num_loops, + comp->num_spills, + comp->num_fills); + assert(ret >= 0); + + if (lima_debug & LIMA_DEBUG_SHADERDB) + fprintf(stderr, "SHADER-DB: %s\n", shaderdb); + + pipe_debug_message(debug, SHADER_INFO, "%s", shaderdb); + free(shaderdb); +} + +bool gpir_compile_nir(struct lima_vs_shader_state *prog, struct nir_shader *nir, + const struct pipe_debug_callback *debug) { nir_function_impl *func = nir_shader_get_entrypoint(nir); gpir_compiler *comp = gpir_compiler_create(prog, func->reg_alloc, func->ssa_alloc); @@ -446,6 +470,8 @@ bool gpir_compile_nir(struct lima_vs_shader_state *prog, struct nir_shader *nir) v->components += glsl_get_components(var->type); } + gpir_print_shader_db(nir, comp, debug); + ralloc_free(comp); return true; |