[Mesa-dev] [PATCH 1/2] st/glsl_to_tgsi: be precise about merging scopes

Gert Wollny gw.fossdev at gmail.com
Wed Sep 6 12:34:45 UTC 2017


For the series

Reviewed-By: Gert Wollny <gw.fossdev at gmail.com>

Am Mittwoch, den 06.09.2017, 11:54 +0200 schrieb Nicolai Hähnle:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
> 
> enclosing_scope already contains enclosing_scope_first_read.
> What we really want to check here -- not for correctness, but
> for speed -- is whether last_read_scope already contains
> enclosing_scope.
> ---
>  src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp
> b/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp
> index d984184e701..8ba1f5bb0be 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp
> @@ -526,22 +526,22 @@ lifetime
> temp_comp_access::get_required_lifetime()
>        enclosing_scope_first_write = conditional->outermost_loop();
>     }
>  
>     /* Evaluate the scope that is shared by all: required first write
> scope,
>      * required first read before write scope, and last read scope.
>      */
>     const prog_scope *enclosing_scope = enclosing_scope_first_read;
>     if (enclosing_scope_first_write-
> >contains_range_of(*enclosing_scope))
>        enclosing_scope = enclosing_scope_first_write;
>  
> -   if (enclosing_scope_first_read-
> >contains_range_of(*enclosing_scope))
> -      enclosing_scope = enclosing_scope_first_read;
> +   if (last_read_scope->contains_range_of(*enclosing_scope))
> +      enclosing_scope = last_read_scope;
>  
>     while (!enclosing_scope-
> >contains_range_of(*enclosing_scope_first_write) ||
>            !enclosing_scope->contains_range_of(*last_read_scope)) {
>        enclosing_scope = enclosing_scope->parent();
>        assert(enclosing_scope);
>     }
>  
>     /* Propagate the last read scope to the target scope */
>     while (enclosing_scope->nesting_depth() < last_read_scope-
> >nesting_depth()) {
>        /* If the read is in a loop and we have to move up the scope
> we need to


More information about the mesa-dev mailing list