[Mesa-dev] [PATCH 5/5] radeonsi: report accurate SGPR and VGPR spills

Nicolai Hähnle nhaehnle at gmail.com
Wed Jul 13 08:11:44 UTC 2016


On 12.07.2016 13:21, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
>   src/gallium/drivers/radeonsi/si_shader.c | 18 +++++++++++++-----
>   src/gallium/drivers/radeonsi/si_shader.h |  2 ++
>   2 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index f60c363..31140b1 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -5959,6 +5959,12 @@ void si_shader_binary_read_config(struct radeon_shader_binary *binary,
>   				conf->scratch_bytes_per_wave =
>   					G_00B860_WAVESIZE(value) * 256 * 4;
>   			break;
> +		case 0x4: /* SPILLED_SGPRS */
> +			conf->spilled_sgprs = value;
> +			break;
> +		case 0x8: /* SPILLED_VGPRS */
> +			conf->spilled_vgprs = value;
> +			break;

I don't see those config values. Does this require a missing change to 
LLVM? That should go in first...

Apart from that, the series is

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

>   		default:
>   			{
>   				static bool printed;
> @@ -6122,8 +6128,6 @@ static void si_shader_dump_stats(struct si_screen *sscreen,
>   	unsigned lds_increment = sscreen->b.chip_class >= CIK ? 512 : 256;
>   	unsigned lds_per_wave = 0;
>   	unsigned max_simd_waves = 10;
> -	/* Assuming SGPRs aren't spilled. */
> -	unsigned spilled_vgprs = conf->scratch_bytes_per_wave / 64 / 4;
>
>   	/* Compute LDS usage for PS. */
>   	if (processor == PIPE_SHADER_FRAGMENT) {
> @@ -6170,23 +6174,27 @@ static void si_shader_dump_stats(struct si_screen *sscreen,
>   		fprintf(file, "*** SHADER STATS ***\n"
>   			"SGPRS: %d\n"
>   			"VGPRS: %d\n"
> +		        "Spilled SGPRs: %d\n"
>   			"Spilled VGPRs: %d\n"
>   			"Code Size: %d bytes\n"
>   			"LDS: %d blocks\n"
>   			"Scratch: %d bytes per wave\n"
>   			"Max Waves: %d\n"
>   			"********************\n",
> -			conf->num_sgprs, conf->num_vgprs, spilled_vgprs, code_size,
> +			conf->num_sgprs, conf->num_vgprs,
> +			conf->spilled_sgprs, conf->spilled_vgprs, code_size,
>   			conf->lds_size, conf->scratch_bytes_per_wave,
>   			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 VGPRs: %d",
> +			   "LDS: %d Scratch: %d Max Waves: %d Spilled SGPRs: %d "
> +			   "Spilled VGPRs: %d",
>   			   conf->num_sgprs, conf->num_vgprs, code_size,
>   			   conf->lds_size, conf->scratch_bytes_per_wave,
> -			   max_simd_waves, spilled_vgprs);
> +			   max_simd_waves, conf->spilled_sgprs,
> +			   conf->spilled_vgprs);
>   }
>
>   static const char *si_get_shader_name(struct si_shader *shader,
> diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
> index 8fc0a36..2906931 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.h
> +++ b/src/gallium/drivers/radeonsi/si_shader.h
> @@ -397,6 +397,8 @@ union si_shader_key {
>   struct si_shader_config {
>   	unsigned			num_sgprs;
>   	unsigned			num_vgprs;
> +	unsigned			spilled_sgprs;
> +	unsigned			spilled_vgprs;
>   	unsigned			lds_size;
>   	unsigned			spi_ps_input_ena;
>   	unsigned			spi_ps_input_addr;
>


More information about the mesa-dev mailing list