radeonsi: print shader-db stats for main parts, not final binaries
authorMarek Olšák <marek.olsak@amd.com>
Wed, 10 Jan 2018 22:25:37 +0000 (23:25 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 31 Jan 2018 02:21:20 +0000 (03:21 +0100)
This is needed to get shader-db stats for LS,HS,ES,GS stages on gfx9.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_shader.c
src/gallium/drivers/radeonsi/si_shader.h
src/gallium/drivers/radeonsi/si_state_shaders.c

index 7304d7e00db1c1b976f50c692412008091912ab4..9458920b9d7709aa9bcd2be37b4ff31583321efa 100644 (file)
@@ -5427,15 +5427,29 @@ static void si_calculate_max_simd_waves(struct si_shader *shader)
        conf->max_simd_waves = max_simd_waves;
 }
 
+void si_shader_dump_stats_for_shader_db(const struct si_shader *shader,
+                                       struct pipe_debug_callback *debug)
+{
+       const struct si_shader_config *conf = &shader->config;
+
+       pipe_debug_message(debug, SHADER_INFO,
+                          "Shader Stats: SGPRS: %d VGPRS: %d Code Size: %d "
+                          "LDS: %d Scratch: %d Max Waves: %d Spilled SGPRs: %d "
+                          "Spilled VGPRs: %d PrivMem VGPRs: %d",
+                          conf->num_sgprs, conf->num_vgprs,
+                          si_get_shader_binary_size(shader),
+                          conf->lds_size, conf->scratch_bytes_per_wave,
+                          conf->max_simd_waves, conf->spilled_sgprs,
+                          conf->spilled_vgprs, conf->private_mem_vgprs);
+}
+
 static void si_shader_dump_stats(struct si_screen *sscreen,
                                 const struct si_shader *shader,
-                                struct pipe_debug_callback *debug,
                                 unsigned processor,
                                 FILE *file,
                                 bool check_debug_option)
 {
        const struct si_shader_config *conf = &shader->config;
-       unsigned code_size = si_get_shader_binary_size(shader);
 
        if (!check_debug_option ||
            si_can_dump_shader(sscreen, processor)) {
@@ -5459,19 +5473,11 @@ static void si_shader_dump_stats(struct si_screen *sscreen,
                        "********************\n\n\n",
                        conf->num_sgprs, conf->num_vgprs,
                        conf->spilled_sgprs, conf->spilled_vgprs,
-                       conf->private_mem_vgprs, code_size,
+                       conf->private_mem_vgprs,
+                       si_get_shader_binary_size(shader),
                        conf->lds_size, conf->scratch_bytes_per_wave,
                        conf->max_simd_waves);
        }
-
-       pipe_debug_message(debug, SHADER_INFO,
-                          "Shader Stats: SGPRS: %d VGPRS: %d Code Size: %d "
-                          "LDS: %d Scratch: %d Max Waves: %d Spilled SGPRs: %d "
-                          "Spilled VGPRs: %d PrivMem VGPRs: %d",
-                          conf->num_sgprs, conf->num_vgprs, code_size,
-                          conf->lds_size, conf->scratch_bytes_per_wave,
-                          conf->max_simd_waves, conf->spilled_sgprs,
-                          conf->spilled_vgprs, conf->private_mem_vgprs);
 }
 
 const char *si_get_shader_name(const struct si_shader *shader, unsigned processor)
@@ -5549,7 +5555,7 @@ void si_shader_dump(struct si_screen *sscreen, const struct si_shader *shader,
                fprintf(file, "\n");
        }
 
-       si_shader_dump_stats(sscreen, shader, debug, processor, file,
+       si_shader_dump_stats(sscreen, shader, processor, file,
                             check_debug_option);
 }
 
@@ -6980,6 +6986,7 @@ int si_compile_tgsi_shader(struct si_screen *sscreen,
        }
 
        si_calculate_max_simd_waves(shader);
+       si_shader_dump_stats_for_shader_db(shader, debug);
        return 0;
 }
 
index 6ed1646817f689b2bc8c8fe30a5b154ad9cbc99a..3cc49caf214155172a8f3c1e758bc430417464a7 100644 (file)
@@ -641,6 +641,8 @@ int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader)
 void si_shader_dump(struct si_screen *sscreen, const struct si_shader *shader,
                    struct pipe_debug_callback *debug, unsigned processor,
                    FILE *f, bool check_debug_option);
+void si_shader_dump_stats_for_shader_db(const struct si_shader *shader,
+                                       struct pipe_debug_callback *debug);
 void si_multiwave_lds_size_workaround(struct si_screen *sscreen,
                                      unsigned *lds_size);
 void si_shader_apply_scratch_relocs(struct si_shader *shader,
index ecb8a0dad8531125b044fb994fd18c8d87b8a5ff..959aead892f28e4c6096bca799e9ae73e4874f0a 100644 (file)
@@ -1823,6 +1823,7 @@ static void si_init_shader_selector_async(void *job, int thread_index)
                if (tgsi_binary &&
                    si_shader_cache_load_shader(sscreen, tgsi_binary, shader)) {
                        mtx_unlock(&sscreen->shader_cache_mutex);
+                       si_shader_dump_stats_for_shader_db(shader, debug);
                } else {
                        mtx_unlock(&sscreen->shader_cache_mutex);