[Mesa-dev] [PATCH 07/11] glsl_to_tgsi: enable copy propagation for tessellation shaders

Nicolai Hähnle nhaehnle at gmail.com
Mon Oct 2 10:55:54 UTC 2017


On 29.09.2017 14:25, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> just don't propagate output reads
> ---
>   src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 50a71e4..2d62213 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -4940,20 +4940,21 @@ glsl_to_tgsi_visitor::copy_propagate(void)
>   
>         /* If this is a copy, add it to the ACP. */
>         if (inst->op == TGSI_OPCODE_MOV &&
>             inst->dst[0].file == PROGRAM_TEMPORARY &&
>             !(inst->dst[0].file == inst->src[0].file &&
>                inst->dst[0].index == inst->src[0].index) &&
>             !inst->dst[0].reladdr &&
>             !inst->dst[0].reladdr2 &&
>             !inst->saturate &&
>             inst->src[0].file != PROGRAM_ARRAY &&
> +          inst->src[0].file != PROGRAM_OUTPUT &&

Did you check shader-db effects of this? We only really need this 
restriction on TCS. Though I guess radeonsi is actually one of the least 
affected drivers thanks to LLVM.

Cheers,
Nicolai


>             !inst->src[0].reladdr &&
>             !inst->src[0].reladdr2 &&
>             !inst->src[0].negate &&
>             !inst->src[0].abs) {
>            for (int i = 0; i < 4; i++) {
>               if (inst->dst[0].writemask & (1 << i)) {
>                  acp[4 * inst->dst[0].index + i] = inst;
>                  acp_level[4 * inst->dst[0].index + i] = level;
>               }
>            }
> @@ -6595,24 +6596,21 @@ get_mesa_program_tgsi(struct gl_context *ctx,
>                   last_writes[i]);
>         ralloc_free(first_writes);
>         ralloc_free(first_reads);
>         ralloc_free(last_writes);
>         ralloc_free(last_reads);
>      }
>   #endif
>   
>      /* Perform optimizations on the instructions in the glsl_to_tgsi_visitor. */
>      v->simplify_cmp();
> -
> -   if (shader->Stage != MESA_SHADER_TESS_CTRL &&
> -       shader->Stage != MESA_SHADER_TESS_EVAL)
> -      v->copy_propagate();
> +   v->copy_propagate();
>   
>      while (v->eliminate_dead_code());
>   
>      v->merge_two_dsts();
>      if (!skip_merge_registers)
>         v->merge_registers();
>      v->renumber_registers();
>   
>      /* Write the END instruction. */
>      v->emit_asm(NULL, TGSI_OPCODE_END);
> 


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


More information about the mesa-dev mailing list