<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Wed, Dec 5, 2018 at 7:14 AM Pohjolainen, Topi <<a href="mailto:topi.pohjolainen@gmail.com">topi.pohjolainen@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Dec 05, 2018 at 02:04:16PM +0100, Iago Toral wrote:<br>
> On Wed, 2018-12-05 at 14:58 +0200, Pohjolainen, Topi wrote:<br>
> > On Tue, Dec 04, 2018 at 08:16:52AM +0100, Iago Toral Quiroga wrote:<br>
> > > Source0 and Destination extract the floating-point precision<br>
> > > automatically<br>
> > > from the SrcType and DstType instruction fields respectively when<br>
> > > they are<br>
> > > set to types :F or :HF. For Source1 and Source2 operands, we use<br>
> > > the new<br>
> > > 1-bit fields Src1Type and Src2Type, where 0 means normal precision<br>
> > > and 1<br>
> > > means half-precision. Since we always use the type of the<br>
> > > destination for<br>
> > > all operands when we emit 3-source instructions, we only need set<br>
> > > Src1Type<br>
> > > and Src2Type to 1 when we are emitting a half-precision<br>
> > > instruction.<br>
> > > ---<br>
> > >  src/intel/compiler/brw_eu_emit.c | 5 +++++<br>
> > >  1 file changed, 5 insertions(+)<br>
> > > <br>
> > > diff --git a/src/intel/compiler/brw_eu_emit.c<br>
> > > b/src/intel/compiler/brw_eu_emit.c<br>
> > > index 2c9fc9a5c7c..66edfb43baf 100644<br>
> > > --- a/src/intel/compiler/brw_eu_emit.c<br>
> > > +++ b/src/intel/compiler/brw_eu_emit.c<br>
> > > @@ -801,6 +801,11 @@ brw_alu3(struct brw_codegen *p, unsigned<br>
> > > opcode, struct brw_reg dest,<br>
> > >            */<br>
> > >           brw_inst_set_3src_a16_src_type(devinfo, inst, dest.type);<br>
> > >           brw_inst_set_3src_a16_dst_type(devinfo, inst, dest.type);<br>
> > > +<br>
> > > +         if (devinfo->gen >= 8 && dest.type ==<br>
> > > BRW_REGISTER_TYPE_HF) {<br>
> > > +            brw_inst_set_3src_a16_src1_type(devinfo, inst, 1);<br>
> > > +            brw_inst_set_3src_a16_src2_type(devinfo, inst, 1);<br>
> > > +         }<br>
> > <br>
> > I had similar patch which prepares for mixed mode (useful for linterp<br>
> > with<br>
> > 32-bit input varyings):<br>
> > <br>
> >          /* From the Bspec: Instruction types<br>
> >           *<br>
> >           * Three source instructions can use operands with mixed-<br>
> > mode<br>
> >           * precision. When SrcType field is set to :f or :hf it<br>
> > defines<br>
> >           * precision for source 0 only, and fields Src1Type and<br>
> > Src2Type<br>
> >           * define precision for other source operands:<br>
> >           *<br>
> >           *   0b = :f. Single precision Float (32-bit).<br>
> >           *   1b = :hf. Half precision Float (16-bit).<br>
> >           */<br>
> >          if (src1.type == BRW_REGISTER_TYPE_HF)<br>
> >             brw_inst_set_3src_src1_type(devinfo, inst, 1);<br>
> > <br>
> >          if (src2.type == BRW_REGISTER_TYPE_HF)<br>
> >             brw_inst_set_3src_src2_type(devinfo, inst, 1);<br>
> > <br>
> > How would you feel about that? (Direct cut-paste and the helpers have<br>
> > different name).'<br></blockquote><div><br></div><div>Yeah, let's not base source precisions on destination types.  I like Topi's version better.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> <br>
> Sure, if we are planning to use mixed mode in the future this makes<br>
> more sense. Thanks!<br>
<br>
Nice!<br>
<br>
Reviewed-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com" target="_blank">topi.pohjolainen@intel.com</a>><br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div>