[Mesa-dev] [PATCH 02/15] radeonsi/gfx9: prevent shader-db crashes

Nicolai Hähnle nhaehnle at gmail.com
Tue Aug 22 08:14:02 UTC 2017


On 21.08.2017 23:54, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> - don't precompile LS and ES (they don't exist on GFX9), compile as VS instead
> - don't precompile HS and GS (we don't have LS and ES parts)

Is this true even for the non-monolithic case? Would be nice to have 
those precompiled for shader-db.

Cheers,
Nicolai

> ---
>   src/gallium/drivers/radeonsi/si_state_shaders.c | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
> index de5260c..fd9828f 100644
> --- a/src/gallium/drivers/radeonsi/si_state_shaders.c
> +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
> @@ -1882,29 +1882,39 @@ void si_init_shader_selector_async(void *job, int thread_index)
>   				case TGSI_SEMANTIC_PSIZE:
>   				case TGSI_SEMANTIC_CLIPVERTEX:
>   				case TGSI_SEMANTIC_EDGEFLAG:
>   					break;
>   				}
>   			}
>   		}
>   	}
>   
>   	/* Pre-compilation. */
> -	if (sscreen->b.debug_flags & DBG_PRECOMPILE) {
> +	if (sscreen->b.debug_flags & DBG_PRECOMPILE &&
> +	    /* GFX9 needs LS or ES for compilation, which we don't have here. */
> +	    (sscreen->b.chip_class <= VI ||
> +	     (sel->type != PIPE_SHADER_TESS_CTRL &&
> +	      sel->type != PIPE_SHADER_GEOMETRY))) {
>   		struct si_shader_ctx_state state = {sel};
>   		struct si_shader_key key;
>   
>   		memset(&key, 0, sizeof(key));
>   		si_parse_next_shader_property(&sel->info,
>   					      sel->so.num_outputs != 0,
>   					      &key);
>   
> +		/* GFX9 doesn't have LS and ES. */
> +		if (sscreen->b.chip_class >= GFX9) {
> +			key.as_ls = 0;
> +			key.as_es = 0;
> +		}
> +
>   		/* Set reasonable defaults, so that the shader key doesn't
>   		 * cause any code to be eliminated.
>   		 */
>   		switch (sel->type) {
>   		case PIPE_SHADER_TESS_CTRL:
>   			key.part.tcs.epilog.prim_mode = PIPE_PRIM_TRIANGLES;
>   			break;
>   		case PIPE_SHADER_FRAGMENT:
>   			key.part.ps.prolog.bc_optimize_for_persp =
>   				sel->info.uses_persp_center &&
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list