[Mesa-dev] [PATCH] i965/vec4: select predicate based on writemask for sel emissions

Alejandro Piñeiro apinheiro at igalia.com
Wed Nov 4 02:41:08 PST 2015


Gentle ping.

PS: I also pinged Matt about this, but (again) probably Friday evening
is not the best time for reminders ;)

On 23/10/15 16:17, Alejandro Piñeiro wrote:
> Equivalent to commit 4eebeb but with sel operations. In this case
> we select the PredCtrl based on the writemask.
>
> This change allows cmod propagation to optimize out several
> instructions.
>
> Shader-db numbers:
> total instructions in shared programs: 6235835 -> 6228008 (-0.13%)
> instructions in affected programs:     219850 -> 212023 (-3.56%)
> total loops in shared programs:        1979 -> 1979 (0.00%)
> helped:                                1192
> HURT:                                  0
> ---
>  src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> index 0f04f65..bc86be6 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> @@ -1437,8 +1437,24 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr)
>     case nir_op_bcsel:
>        emit(CMP(dst_null_d(), op[0], src_reg(0), BRW_CONDITIONAL_NZ));
>        inst = emit(BRW_OPCODE_SEL, dst, op[1], op[2]);
> -      inst->predicate = BRW_PREDICATE_NORMAL;
> +      switch (dst.writemask) {
> +      case WRITEMASK_X:
> +         inst->predicate = BRW_PREDICATE_ALIGN16_REPLICATE_X;
> +         break;
> +      case WRITEMASK_Y:
> +         inst->predicate = BRW_PREDICATE_ALIGN16_REPLICATE_Y;
> +         break;
> +      case WRITEMASK_Z:
> +         inst->predicate = BRW_PREDICATE_ALIGN16_REPLICATE_Z;
> +         break;
> +      case WRITEMASK_W:
> +         inst->predicate = BRW_PREDICATE_ALIGN16_REPLICATE_W;
> +         break;
> +      default:
> +         inst->predicate = BRW_PREDICATE_NORMAL;
>        break;
> +      }
> +   break;
>  
>     case nir_op_fdot_replicated2:
>        inst = emit(BRW_OPCODE_DP2, dst, op[0], op[1]);

-- 
Alejandro Piñeiro (apinheiro at igalia.com)



More information about the mesa-dev mailing list