From 04f97eefa35d8337b6e078be003ad5f5fe5656fe Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 15 Apr 2019 22:17:49 -0700 Subject: [PATCH] iris: Print the reason for shader recompiles. I was lazy earlier and hadn't bothered typing / refactoring this. Now I'm hitting some extra recompiles and would like to see why. Reviewed-by: Jordan Justen --- src/gallium/drivers/iris/iris_program.c | 36 ++++++++++++++++++++----- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index 7da3a372b10..061d379ec29 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -510,6 +510,30 @@ iris_setup_uniforms(const struct brw_compiler *compiler, *out_num_cbufs = num_cbufs; } +static void +iris_debug_recompile(struct iris_context *ice, + struct shader_info *info, + unsigned program_string_id, + const void *key) +{ + struct iris_screen *screen = (struct iris_screen *) ice->ctx.screen; + const struct brw_compiler *c = screen->compiler; + + if (!info) + return; + + c->shader_perf_log(&ice->dbg, "Recompiling %s shader for program %s: %s\n", + _mesa_shader_stage_to_string(info->stage), + info->name ? info->name : "(no identifier)", + info->label ? info->label : ""); + + const void *old_key = + iris_find_previous_compile(ice, info->stage, program_string_id); + + brw_debug_key_recompile(c, &ice->dbg, info->stage, old_key, key); +} + + /** * Compile a vertex shader, and upload the assembly. */ @@ -580,7 +604,7 @@ iris_compile_vs(struct iris_context *ice, num_cbufs); if (ish->compiled_once) { - perf_debug(&ice->dbg, "Recompiling vertex shader\n"); + iris_debug_recompile(ice, &nir->info, key->program_string_id, key); } else { ish->compiled_once = true; } @@ -770,7 +794,7 @@ iris_compile_tcs(struct iris_context *ice, if (ish) { if (ish->compiled_once) { - perf_debug(&ice->dbg, "Recompiling tessellation control shader\n"); + iris_debug_recompile(ice, &nir->info, key->program_string_id, key); } else { ish->compiled_once = true; } @@ -873,7 +897,7 @@ iris_compile_tes(struct iris_context *ice, num_cbufs); if (ish->compiled_once) { - perf_debug(&ice->dbg, "Recompiling tessellation evaluation shader\n"); + iris_debug_recompile(ice, &nir->info, key->program_string_id, key); } else { ish->compiled_once = true; } @@ -973,7 +997,7 @@ iris_compile_gs(struct iris_context *ice, num_cbufs); if (ish->compiled_once) { - perf_debug(&ice->dbg, "Recompiling geometry shader\n"); + iris_debug_recompile(ice, &nir->info, key->program_string_id, key); } else { ish->compiled_once = true; } @@ -1063,7 +1087,7 @@ iris_compile_fs(struct iris_context *ice, num_cbufs); if (ish->compiled_once) { - perf_debug(&ice->dbg, "Recompiling fragment shader\n"); + iris_debug_recompile(ice, &nir->info, key->program_string_id, key); } else { ish->compiled_once = true; } @@ -1297,7 +1321,7 @@ iris_compile_cs(struct iris_context *ice, num_cbufs); if (ish->compiled_once) { - perf_debug(&ice->dbg, "Recompiling compute shader\n"); + iris_debug_recompile(ice, &nir->info, key->program_string_id, key); } else { ish->compiled_once = true; } -- 2.30.2