[Mesa-dev] [PATCH v2 49/53] intel/compiler: fix cmod propagation for non 32-bit types
Iago Toral
itoral at igalia.com
Thu Jan 3 07:30:50 UTC 2019
On Thu, 2019-01-03 at 08:25 +0100, Iago Toral wrote:
> On Wed, 2019-01-02 at 12:42 +0200, Pohjolainen, Topi wrote:
> > On Wed, Dec 19, 2018 at 12:51:17PM +0100, Iago Toral Quiroga wrote:
> > > ---
> > > src/intel/compiler/brw_fs_cmod_propagation.cpp | 8 +++-----
> > > 1 file changed, 3 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/src/intel/compiler/brw_fs_cmod_propagation.cpp
> > > b/src/intel/compiler/brw_fs_cmod_propagation.cpp
> > > index 7bb5c9afbc9..dfef9d720a2 100644
> > > --- a/src/intel/compiler/brw_fs_cmod_propagation.cpp
> > > +++ b/src/intel/compiler/brw_fs_cmod_propagation.cpp
> > > @@ -244,8 +244,7 @@ opt_cmod_propagation_local(const
> > > gen_device_info *devinfo,
> > > /* CMP's result is the same regardless of dest type.
> > > */
> > > if (inst->conditional_mod == BRW_CONDITIONAL_NZ &&
> > > scan_inst->opcode == BRW_OPCODE_CMP &&
> > > - (inst->dst.type == BRW_REGISTER_TYPE_D ||
> > > - inst->dst.type == BRW_REGISTER_TYPE_UD)) {
> > > + brw_reg_type_is_integer(inst->dst.type)) {
> > > inst->remove(block);
> > > progress = true;
> > > break;
> > > @@ -258,9 +257,8 @@ opt_cmod_propagation_local(const
> > > gen_device_info *devinfo,
> > > break;
> > >
> > > /* Comparisons operate differently for ints and
> > > floats
> > > */
> > > - if (scan_inst->dst.type != inst->dst.type &&
> >
> > This wouldn't let, for example, (DF, F) pair thru while the new
> > version does.
> > Should we keep this line?
>
> This is about not turning a floating point comparison into an integer
> comparison and viceversa, but F and DF are both floating point and
> follow the same rules, so I think this sould be okay in that aspect.
>
> With that being said though, I wonder if we shold prevent propagation
> when the types don't have the same bit-size, since even if the
> underlying comparison semantics are the same, we could have different
> behaviors for out-of-range values... I wonder if that can actually
> ever
> happen though, since that would mean that scan_inst writes, for
> example
> a DF, and then the CMP reads it as F... but anyway, I guess being
> extra
> careful here doesn't hurt.
To be more precise, I am thinking of adding this below, as a separate
check:
/* Comparison result may be altered if the bit-size changes
* since that affects range, denorms, etc
*/
if (type_sz(scan_inst->dst.type) != type_sz(inst->dst.type))
break;
> > > - (scan_inst->dst.type == BRW_REGISTER_TYPE_F ||
> > > - inst->dst.type == BRW_REGISTER_TYPE_F))
> > > + if (brw_reg_type_is_floating_point(scan_inst-
> > > > dst.type) !=
> > >
> > > + brw_reg_type_is_floating_point(inst->dst.type))
> > > break;
> > >
> > > /* If the instruction generating inst's source also
> > > wrote the
> > > --
> > > 2.17.1
> > >
> > > _______________________________________________
> > > mesa-dev mailing list
> > > mesa-dev at lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >
> >
More information about the mesa-dev
mailing list