[Mesa-dev] [PATCH 1/2] radeonsi: add max waves / CU to shader stats

Marek Olšák maraeo at gmail.com
Tue Jan 19 17:39:50 PST 2016


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/radeonsi/si_shader.c | 33 +++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 0c5fd32..5c536f8 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -3994,12 +3994,39 @@ static void si_shader_dump_stats(struct si_screen *sscreen,
 			         struct pipe_debug_callback *debug,
 			         unsigned processor)
 {
+	/* Compute the maximum number of waves.
+	 * The pixel shader additionally allocates 1 - 48 blocks of LDS
+	 * depending on non-compile times parameters.
+	 */
+	unsigned ps_lds_size = processor == TGSI_PROCESSOR_FRAGMENT ? 1 : 0;
+	unsigned lds_size = ps_lds_size + conf->lds_size;
+	unsigned max_waves = 10;
+
+	if (conf->num_sgprs) {
+		if (sscreen->b.chip_class >= VI)
+			max_waves = MIN2(max_waves, 800 / conf->num_sgprs);
+		else
+			max_waves = MIN2(max_waves, 512 / conf->num_sgprs);
+	}
+
+	if (conf->num_vgprs)
+		max_waves = MIN2(max_waves, 256 / conf->num_vgprs);
+
+	if (lds_size)
+		max_waves = MIN2(max_waves, 128 / lds_size);
+
 	if (r600_can_dump_shader(&sscreen->b, processor)) {
 		fprintf(stderr, "*** SHADER STATS ***\n"
-			"SGPRS: %d\nVGPRS: %d\nCode Size: %d bytes\nLDS: %d blocks\n"
-			"Scratch: %d bytes per wave\n********************\n",
+			"SGPRS: %d\n"
+			"VGPRS: %d\n"
+			"Code Size: %d bytes\n"
+			"LDS: %d blocks\n"
+			"Scratch: %d bytes per wave\n"
+			"Max waves / CU: %d\n"
+			"********************\n",
 			conf->num_sgprs, conf->num_vgprs, code_size,
-			conf->lds_size, conf->scratch_bytes_per_wave);
+			conf->lds_size, conf->scratch_bytes_per_wave,
+			max_waves);
 	}
 
 	pipe_debug_message(debug, SHADER_INFO,
-- 
2.1.4



More information about the mesa-dev mailing list