[Mesa-dev] [PATCH 3/3] radeonsi: remove DBG_PRECOMPILE

Nicolai Hähnle nhaehnle at gmail.com
Tue Jan 30 16:47:40 UTC 2018


Series is:

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


On 27.01.2018 19:01, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> it's useless and shader-db stats only report the main shader part.
> ---
>   src/gallium/drivers/radeon/r600_pipe_common.h   |  1 -
>   src/gallium/drivers/radeonsi/si_pipe.c          |  1 -
>   src/gallium/drivers/radeonsi/si_state_shaders.c | 49 -------------------------
>   3 files changed, 51 deletions(-)
> 
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
> index a8e632c..d82e123 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.h
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.h
> @@ -69,21 +69,20 @@ enum {
>   	DBG_NO_ASM,
>   	DBG_PREOPT_IR,
>   
>   	/* Shader compiler options the shader cache should be aware of: */
>   	DBG_FS_CORRECT_DERIVS_AFTER_KILL,
>   	DBG_UNSAFE_MATH,
>   	DBG_SI_SCHED,
>   
>   	/* Shader compiler options (with no effect on the shader cache): */
>   	DBG_CHECK_IR,
> -	DBG_PRECOMPILE,
>   	DBG_NIR,
>   	DBG_MONOLITHIC_SHADERS,
>   	DBG_NO_OPT_VARIANT,
>   
>   	/* Information logging options: */
>   	DBG_INFO,
>   	DBG_TEX,
>   	DBG_COMPUTE,
>   	DBG_VM,
>   
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
> index 676d199..79c31a4 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -48,21 +48,20 @@ static const struct debug_named_value debug_options[] = {
>   	{ "notgsi", DBG(NO_TGSI), "Don't print the TGSI"},
>   	{ "noasm", DBG(NO_ASM), "Don't print disassembled shaders"},
>   	{ "preoptir", DBG(PREOPT_IR), "Print the LLVM IR before initial optimizations" },
>   
>   	/* Shader compiler options the shader cache should be aware of: */
>   	{ "unsafemath", DBG(UNSAFE_MATH), "Enable unsafe math shader optimizations" },
>   	{ "sisched", DBG(SI_SCHED), "Enable LLVM SI Machine Instruction Scheduler." },
>   
>   	/* Shader compiler options (with no effect on the shader cache): */
>   	{ "checkir", DBG(CHECK_IR), "Enable additional sanity checks on shader IR" },
> -	{ "precompile", DBG(PRECOMPILE), "Compile one shader variant at shader creation." },
>   	{ "nir", DBG(NIR), "Enable experimental NIR shaders" },
>   	{ "mono", DBG(MONOLITHIC_SHADERS), "Use old-style monolithic shaders compiled on demand" },
>   	{ "nooptvariant", DBG(NO_OPT_VARIANT), "Disable compiling optimized shader variants." },
>   
>   	/* Information logging options: */
>   	{ "info", DBG(INFO), "Print driver information" },
>   	{ "tex", DBG(TEX), "Print texture info" },
>   	{ "compute", DBG(COMPUTE), "Print compute info" },
>   	{ "vm", DBG(VM), "Print virtual addresses when creating resources" },
>   
> diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
> index 959aead..2c1d990 100644
> --- a/src/gallium/drivers/radeonsi/si_state_shaders.c
> +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
> @@ -1778,21 +1778,20 @@ static void si_parse_next_shader_property(const struct tgsi_shader_info *info,
>    * Compile the main shader part or the monolithic shader as part of
>    * si_shader_selector initialization. Since it can be done asynchronously,
>    * there is no way to report compile failures to applications.
>    */
>   static void si_init_shader_selector_async(void *job, int thread_index)
>   {
>   	struct si_shader_selector *sel = (struct si_shader_selector *)job;
>   	struct si_screen *sscreen = sel->screen;
>   	LLVMTargetMachineRef tm;
>   	struct pipe_debug_callback *debug = &sel->compiler_ctx_state.debug;
> -	unsigned i;
>   
>   	assert(!debug->debug_message || debug->async);
>   	assert(thread_index >= 0);
>   	assert(thread_index < ARRAY_SIZE(sscreen->tm));
>   	tm = sscreen->tm[thread_index];
>   
>   	/* Compile the main shader part for use with a prolog and/or epilog.
>   	 * If this fails, the driver will try to compile a monolithic shader
>   	 * on demand.
>   	 */
> @@ -1882,68 +1881,20 @@ static void si_init_shader_selector_async(void *job, int thread_index)
>   				case TGSI_SEMANTIC_POSITION: /* ignore these */
>   				case TGSI_SEMANTIC_PSIZE:
>   				case TGSI_SEMANTIC_CLIPVERTEX:
>   				case TGSI_SEMANTIC_EDGEFLAG:
>   					break;
>   				}
>   			}
>   		}
>   	}
>   
> -	/* Pre-compilation. */
> -	if (sscreen->debug_flags & DBG(PRECOMPILE) &&
> -	    /* GFX9 needs LS or ES for compilation, which we don't have here. */
> -	    (sscreen->info.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->info.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 &&
> -				sel->info.uses_persp_centroid;
> -			key.part.ps.prolog.bc_optimize_for_linear =
> -				sel->info.uses_linear_center &&
> -				sel->info.uses_linear_centroid;
> -			key.part.ps.epilog.alpha_func = PIPE_FUNC_ALWAYS;
> -			for (i = 0; i < 8; i++)
> -				if (sel->info.colors_written & (1 << i))
> -					key.part.ps.epilog.spi_shader_col_format |=
> -						V_028710_SPI_SHADER_FP16_ABGR << (i * 4);
> -			break;
> -		}
> -
> -		if (si_shader_select_with_key(sscreen, &state,
> -					      &sel->compiler_ctx_state, &key,
> -					      thread_index))
> -			fprintf(stderr, "radeonsi: can't create a monolithic shader\n");
> -	}
> -
>   	/* The GS copy shader is always pre-compiled. */
>   	if (sel->type == PIPE_SHADER_GEOMETRY) {
>   		sel->gs_copy_shader = si_generate_gs_copy_shader(sscreen, tm, sel, debug);
>   		if (!sel->gs_copy_shader) {
>   			fprintf(stderr, "radeonsi: can't create GS copy shader\n");
>   			return;
>   		}
>   
>   		si_shader_vs(sscreen, sel->gs_copy_shader, sel);
>   	}
> 


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


More information about the mesa-dev mailing list