[Mesa-dev] [PATCH 01/14] i965: Don't copy propagate sat MOVs into LOAD_PAYLOAD

Matt Turner mattst88 at gmail.com
Tue Oct 28 16:52:54 PDT 2014


On Tue, Oct 28, 2014 at 4:50 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> On Tuesday, October 28, 2014 03:41:45 PM Matt Turner wrote:
>> On Tue, Oct 28, 2014 at 3:17 PM, Kristian Høgsberg <krh at bitplanet.net>
> wrote:
>> > The LOAD_PAYLOAD opcode can't saturate its sources, so skip
>> > saturating MOVs.  The register coalescing after lower_load_payload()
>> > will clean up the extra MOVs.
>> >
>> > Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>
>> > ---
>> >  src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp | 6 +++++-
>> >  1 file changed, 5 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
> b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
>> > index e1989cb..87ea9c2 100644
>> > --- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
>> > +++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
>> > @@ -454,8 +454,12 @@ fs_visitor::try_constant_propagate(fs_inst *inst,
> acp_entry *entry)
>> >        val.effective_width = inst->src[i].effective_width;
>> >
>> >        switch (inst->opcode) {
>> > -      case BRW_OPCODE_MOV:
>> >        case SHADER_OPCODE_LOAD_PAYLOAD:
>> > +         /* LOAD_PAYLOAD can't sat its sources. */
>> > +         if (entry->saturate)
>> > +            break;
>> > +         /* Otherwise, fall through */
>> > +      case BRW_OPCODE_MOV:
>>
>> I'm confused. This is the *constant* propagation function not copy
>> propagation, and if we're doing a mov.sat of an immediate, we can just
>> figure out what that is.
>>
>> If you're seeing mov.sat with immediates, you should modify
>> opt_algebraic to remove them.
>
> Making opt_algebraic handle mov.sat with immediates seems like a good plan.
> But, shouldn't we then make this code bail on saturates for both MOV and
> LOAD_PAYLOAD?  We should be robust in case one shows up between opt_algebraic
> and this pass.

Yes, I think it should simply bail out at the beginning of
fs_visitor::try_constant_propagate if entry->saturate.


More information about the mesa-dev mailing list