[Mesa-dev] [PATCH 1/3] nir: allow nir search type check to see through bcsel

Ian Romanick idr at freedesktop.org
Thu Jul 19 06:17:09 UTC 2018


Oh man... I was also recently looking at that same compute shader, and I
wrote nearly identical patches the early part of last week.  The bcsel
patches caused a bit of pain for i965.  I came up with a different way
to handle that particular problem... either way, I eventually abandoned
the whole approach.  Adding a bunch of one-off cases for weird
combinations of logic expressions (and that shader has some doozies!)
just isn't scalable.

I've pushed a branch logic-expression-frobbing to my cgit with all that
work.

In the mean time, I have been working code that generically optimizes
logical expressions.  I'm hoping to get that sent out next week.  So
far, it looks like it should be able to achieve the same affect on this
particular shader.  This new pass should make most, if not all, of the
logic expression algebraic optimizations in nir_opt_algebraic.

As soon as I can run shader-db, I'll post a branch.

On 07/18/2018 08:29 PM, Timothy Arceri wrote:
> ---
>  src/compiler/nir/nir_search.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/compiler/nir/nir_search.c b/src/compiler/nir/nir_search.c
> index 28b36b2b863..743ffdf232c 100644
> --- a/src/compiler/nir/nir_search.c
> +++ b/src/compiler/nir/nir_search.c
> @@ -73,6 +73,9 @@ src_is_type(nir_src src, nir_alu_type type)
>                     src_is_type(src_alu->src[1].src, nir_type_bool);
>           case nir_op_inot:
>              return src_is_type(src_alu->src[0].src, nir_type_bool);
> +         case nir_op_bcsel:
> +            return src_is_type(src_alu->src[1].src, nir_type_bool) &&
> +                   src_is_type(src_alu->src[2].src, nir_type_bool);
>           default:
>              break;
>           }
> 



More information about the mesa-dev mailing list