[Mesa-dev] [PATCH 19/23] radeonsi: separate shader dumping code to si_shader_dump and *_dump_stats

Nicolai Hähnle nhaehnle at gmail.com
Wed Jan 6 13:05:12 PST 2016


On 06.01.2016 07:41, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> Eventually, I'd like to dump stats for several combined binaries, which is
> why you don't see a binary parameter in si_shader_dump_stats
> ---
>   src/gallium/drivers/radeonsi/si_shader.c | 42 +++++++++++++++++++++++---------
>   1 file changed, 30 insertions(+), 12 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index 0773fff..95cdf8a 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -3853,31 +3853,49 @@ static void si_shader_dump_disassembly(const struct radeon_shader_binary *binary
>   	}
>   }
>
> -void si_shader_binary_read(struct si_screen *sscreen,
> -			   struct radeon_shader_binary *binary,
> -			   struct si_shader_config *conf,
> -			   struct pipe_debug_callback *debug,
> -			   unsigned processor)
> +static void si_shader_dump_stats(struct si_screen *sscreen,
> +			         struct si_shader_config *conf,
> +				 unsigned code_size,
> +			         struct pipe_debug_callback *debug,
> +			         unsigned processor)
>   {
> -	si_shader_binary_read_config(binary, conf, 0);
> -
>   	if (r600_can_dump_shader(&sscreen->b, processor)) {
> -		if (!(sscreen->b.debug_flags & DBG_NO_ASM))
> -			si_shader_dump_disassembly(binary, debug);
> -
>   		fprintf(stderr, "*** SHADER STATS ***\n"
>   			"SGPRS: %d\nVGPRS: %d\nCode Size: %d bytes\nLDS: %d blocks\n"
>   			"Scratch: %d bytes per wave\n********************\n",
> -			conf->num_sgprs, conf->num_vgprs, binary->code_size,
> +			conf->num_sgprs, conf->num_vgprs, code_size,
>   			conf->lds_size, conf->scratch_bytes_per_wave);
>   	}
>
>   	pipe_debug_message(debug, SHADER_INFO,
>   			   "Shader Stats: SGPRS: %d VGPRS: %d Code Size: %d LDS: %d Scratch: %d",
> -			   conf->num_sgprs, conf->num_vgprs, binary->code_size,
> +			   conf->num_sgprs, conf->num_vgprs, code_size,
>   			   conf->lds_size, conf->scratch_bytes_per_wave);
>   }
>
> +static void si_shader_dump(struct si_screen *sscreen,
> +			   struct radeon_shader_binary *binary,
> +			   struct si_shader_config *conf,
> +			   struct pipe_debug_callback *debug,
> +			   unsigned processor)
> +{
> +	if (r600_can_dump_shader(&sscreen->b, processor))
> +		if (!(sscreen->b.debug_flags & DBG_NO_ASM))
> +			si_shader_dump_disassembly(binary, debug);

I prefer to have braces around an if-block that spans multiple lines, 
but that's a bit of a bike-sheddy quibble. Either way, patches 11-19 are

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

> +
> +	si_shader_dump_stats(sscreen, conf, binary->code_size, debug, processor);
> +}
> +
> +void si_shader_binary_read(struct si_screen *sscreen,
> +			   struct radeon_shader_binary *binary,
> +			   struct si_shader_config *conf,
> +			   struct pipe_debug_callback *debug,
> +			   unsigned processor)
> +{
> +	si_shader_binary_read_config(binary, conf, 0);
> +	si_shader_dump(sscreen, binary, conf, debug, processor);
> +}
> +
>   int si_compile_llvm(struct si_screen *sscreen,
>   		    struct radeon_shader_binary *binary,
>   		    struct si_shader_config *conf,
>


More information about the mesa-dev mailing list