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

Nicolai Hähnle nhaehnle at gmail.com
Wed Jan 20 09:41:55 PST 2016


On 19.01.2016 20:39, Marek Olšák wrote:
> 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);

When/if the kernel starts using traps, we need to remember to 
conditionally add 16 here. Right now that's irrelevant.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

> +		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,
>


More information about the mesa-dev mailing list