[Mesa-dev] [PATCH 12/47] i965/fs: Add brw_reg_type_from_bit_size utility method

Chema Casanova jmcasanova at igalia.com
Mon Aug 28 12:13:42 UTC 2017


El 26/08/17 a las 19:19, Jason Ekstrand escribió:
> On Thu, Aug 24, 2017 at 6:54 AM, Alejandro Piñeiro
> <apinheiro at igalia.com <mailto:apinheiro at igalia.com>> wrote:
>
>     Returns the brw_type for a given ssa.bit_size, and a reference type.
>     So if bit_size is 64, and the reference type is BRW_REGISTER_TYPE_F,
>     it returns BRW_REGISTER_TYPE_DF. The same applies if bit_size is 32
>     and reference type is BRW_REGISTER_TYPE_HF it returns
>     BRW_REGISTER_TYPE_F
>
>     Signed-off-by: Jose Maria Casanova Crespo <jmcasanova at igalia.com
>     <mailto:jmcasanova at igalia.com>>
>     Signed-off-by: Alejandro Piñeiro <apinheiro at igalia.com
>     <mailto:apinheiro at igalia.com>
>     ---
>      src/intel/compiler/brw_fs_nir.cpp | 67
>     ++++++++++++++++++++++++++++++++++++---
>      1 file changed, 62 insertions(+), 5 deletions(-)
>
>     diff --git a/src/intel/compiler/brw_fs_nir.cpp
>     b/src/intel/compiler/brw_fs_nir.cpp
>     index d760946e624..e4eba1401f8 100644
>     --- a/src/intel/compiler/brw_fs_nir.cpp
>     +++ b/src/intel/compiler/brw_fs_nir.cpp
>     @@ -214,6 +214,63 @@ fs_visitor::nir_emit_system_values()
>         }
>      }
>
>     +/*
>     + * Returns a type based on a reference_type (word, float,
>     half-float) and a
>     + * given bit_size.
>     + *
>     + * Reference BRW_REGISTER_TYPE are HF,F,DF,W,D,UW,UD.
>     + *
>     + * @FIXME: 64-bit return types are always DF on integer types to
>     maintain
>     + * compability with uses of DF previously to the introduction of
>     int64
>     + * support.
>     + */
>     +static brw_reg_type
>     +brw_reg_type_from_bit_size(const unsigned bit_size,
>     +                           const brw_reg_type reference_type)
>     +{
>     +   switch(reference_type) {
>     +   case BRW_REGISTER_TYPE_HF:
>     +   case BRW_REGISTER_TYPE_F:
>     +   case BRW_REGISTER_TYPE_DF:
>     +      switch(bit_size) {
>     +      case 16:
>     +         return BRW_REGISTER_TYPE_HF;
>     +      case 32:
>     +         return BRW_REGISTER_TYPE_F;
>     +      case 64:
>     +         return BRW_REGISTER_TYPE_DF;
>     +      default:
>     +         unreachable("Not reached");
>
>
> Please add something more descriptive here such as "Invalid bit size"
OK.
>  
>
>     +      }
>     +   case BRW_REGISTER_TYPE_W:
>     +   case BRW_REGISTER_TYPE_D:
>
>
> Please add the Q type
OK.
>  
>
>     +      switch(bit_size) {
>     +      case 16:
>     +         return BRW_REGISTER_TYPE_W;
>     +      case 32:
>     +         return BRW_REGISTER_TYPE_D;
>     +      case 64:
>     +         return BRW_REGISTER_TYPE_DF;
>     +      default:
>     +         unreachable("Not reached");
>
>
> Better message
OK.
>  
>
>     +      }
>     +   case BRW_REGISTER_TYPE_UW:
>     +   case BRW_REGISTER_TYPE_UD:
>
>
> Please add the UQ type
OK.
>  
>
>     +      switch(bit_size) {
>     +      case 16:
>     +         return BRW_REGISTER_TYPE_UW;
>     +      case 32:
>     +         return BRW_REGISTER_TYPE_UD;
>     +      case 64:
>     +         return BRW_REGISTER_TYPE_DF;
>     +      default:
>     +         unreachable("Not reached");
>
>
> better message
>  
>
>     +      }
>     +   default:
>     +      unreachable("Not reached");
>
>
> better message
>
> I've got all those fixes in a version of this patch I pulled into my
> subgroups tree.
>  
So I finally picked locally your review of this patch from:
https://cgit.freedesktop.org/~jekstrand/mesa/commit/?id=c21aee439ffc15a7b8cec811727c0efb5e2bfa6c

I didn't find your subgroups tree.

Thanks for the review.

Chema


More information about the mesa-dev mailing list