summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2018-01-10 23:09:58 +0100
committerMarek Olšák <[email protected]>2018-01-31 03:21:20 +0100
commitc02c9ee550d137fbea3ed105131d621d6af5813b (patch)
tree2e36f13080af74ac91fe11dd23bd830a1a00ea06 /src/gallium/drivers/radeonsi
parenta7311cd7eee309adb8ebb8b556dfa2fe15c5cdde (diff)
radeonsi: move max_simd_waves computation into a separate function
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c34
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.h1
2 files changed, 23 insertions, 12 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 76215b318a0..7304d7e00db 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -5362,16 +5362,11 @@ static void si_shader_dump_disassembly(const struct ac_shader_binary *binary,
}
}
-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)
+static void si_calculate_max_simd_waves(struct si_shader *shader)
{
- const struct si_shader_config *conf = &shader->config;
- unsigned num_inputs = shader->selector ? shader->selector->info.num_inputs : 0;
- unsigned code_size = si_get_shader_binary_size(shader);
+ struct si_screen *sscreen = shader->selector->screen;
+ struct si_shader_config *conf = &shader->config;
+ unsigned num_inputs = shader->selector->info.num_inputs;
unsigned lds_increment = sscreen->info.chip_class >= CIK ? 512 : 256;
unsigned lds_per_wave = 0;
unsigned max_simd_waves;
@@ -5388,7 +5383,7 @@ static void si_shader_dump_stats(struct si_screen *sscreen,
}
/* Compute LDS usage for PS. */
- switch (processor) {
+ switch (shader->selector->type) {
case PIPE_SHADER_FRAGMENT:
/* The minimum usage per wave is (num_inputs * 48). The maximum
* usage is (num_inputs * 48 * 16).
@@ -5429,6 +5424,19 @@ static void si_shader_dump_stats(struct si_screen *sscreen,
if (lds_per_wave)
max_simd_waves = MIN2(max_simd_waves, 16384 / lds_per_wave);
+ conf->max_simd_waves = max_simd_waves;
+}
+
+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)) {
if (processor == PIPE_SHADER_FRAGMENT) {
@@ -5453,7 +5461,7 @@ static void si_shader_dump_stats(struct si_screen *sscreen,
conf->spilled_sgprs, conf->spilled_vgprs,
conf->private_mem_vgprs, code_size,
conf->lds_size, conf->scratch_bytes_per_wave,
- max_simd_waves);
+ conf->max_simd_waves);
}
pipe_debug_message(debug, SHADER_INFO,
@@ -5462,7 +5470,7 @@ static void si_shader_dump_stats(struct si_screen *sscreen,
"Spilled VGPRs: %d PrivMem VGPRs: %d",
conf->num_sgprs, conf->num_vgprs, code_size,
conf->lds_size, conf->scratch_bytes_per_wave,
- max_simd_waves, conf->spilled_sgprs,
+ conf->max_simd_waves, conf->spilled_sgprs,
conf->spilled_vgprs, conf->private_mem_vgprs);
}
@@ -6971,6 +6979,7 @@ int si_compile_tgsi_shader(struct si_screen *sscreen,
shader->info.num_input_vgprs += 1;
}
+ si_calculate_max_simd_waves(shader);
return 0;
}
@@ -8044,6 +8053,7 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm,
shader->config.num_vgprs = MAX2(shader->config.num_vgprs,
shader->epilog->config.num_vgprs);
}
+ si_calculate_max_simd_waves(shader);
}
si_fix_resource_usage(sscreen, shader);
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index c449aa96844..6ed1646817f 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -557,6 +557,7 @@ struct si_shader_config {
unsigned spilled_vgprs;
unsigned private_mem_vgprs;
unsigned lds_size;
+ unsigned max_simd_waves;
unsigned spi_ps_input_ena;
unsigned spi_ps_input_addr;
unsigned float_mode;