All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] nv50/ir: optimize shl(a, 0) to a
@ 2017-04-29 22:09 Karol Herbst
       [not found] ` <20170429220934.3355-1-karolherbst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Karol Herbst @ 2017-04-29 22:09 UTC (permalink / raw)
  To: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

helps two alien isolation shaders

shader-db:
total instructions in shared programs : 4251497 -> 4251494 (-0.00%)
total gprs used in shared programs    : 513962 -> 513962 (0.00%)
total local used in shared programs   : 29797 -> 29797 (0.00%)
total bytes used in shared programs   : 38960264 -> 38960232 (-0.00%)

                local        gpr       inst      bytes
    helped           0           0           2           2
      hurt           0           0           0           0

v2: handle potential mods on src0

Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index 015def0391..82da0d3e48 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -1284,6 +1284,13 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
 
    case OP_SHL:
    {
+      if (s == 1 && imm0.isInteger(0)) {
+         i->op = i->src(0).mod.getOp();
+         if (i->op != OP_CVT)
+            i->src(0).mod = 0;
+         i->setSrc(1, NULL);
+         break;
+      }
       if (s != 1 || i->src(0).mod != Modifier(0))
          break;
       // try to concatenate shifts
-- 
2.12.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] nv50/ir: optimize shl(a, 0) to a
       [not found] ` <20170429220934.3355-1-karolherbst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-04-29 22:28   ` Ilia Mirkin
  2017-04-30  0:04     ` Karol Herbst
  0 siblings, 1 reply; 6+ messages in thread
From: Ilia Mirkin @ 2017-04-29 22:28 UTC (permalink / raw)
  To: Karol Herbst
  Cc: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Sat, Apr 29, 2017 at 6:09 PM, Karol Herbst <karolherbst@gmail.com> wrote:
> helps two alien isolation shaders
>
> shader-db:
> total instructions in shared programs : 4251497 -> 4251494 (-0.00%)
> total gprs used in shared programs    : 513962 -> 513962 (0.00%)
> total local used in shared programs   : 29797 -> 29797 (0.00%)
> total bytes used in shared programs   : 38960264 -> 38960232 (-0.00%)
>
>                 local        gpr       inst      bytes
>     helped           0           0           2           2
>       hurt           0           0           0           0
>
> v2: handle potential mods on src0
>
> Signed-off-by: Karol Herbst <karolherbst@gmail.com>
> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
> ---
>  src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> index 015def0391..82da0d3e48 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> @@ -1284,6 +1284,13 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
>
>     case OP_SHL:
>     {
> +      if (s == 1 && imm0.isInteger(0)) {
> +         i->op = i->src(0).mod.getOp();
> +         if (i->op != OP_CVT)
> +            i->src(0).mod = 0;

Is this necessary? Presumably if the op != 0, then op == OP_CVT...

> +         i->setSrc(1, NULL);
> +         break;
> +      }
>        if (s != 1 || i->src(0).mod != Modifier(0))
>           break;
>        // try to concatenate shifts
> --
> 2.12.2
>
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] nv50/ir: optimize shl(a, 0) to a
  2017-04-29 22:28   ` Ilia Mirkin
@ 2017-04-30  0:04     ` Karol Herbst
       [not found]       ` <CAKb7Uvg2ZxT4JyfeG24BLDTKHXbFuyx=H2tRnQBM63h1k_kJ8Q@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Karol Herbst @ 2017-04-30  0:04 UTC (permalink / raw)
  To: Ilia Mirkin; +Cc: mesa-dev, nouveau

2017-04-30 0:28 GMT+02:00 Ilia Mirkin <imirkin@alum.mit.edu>:
> On Sat, Apr 29, 2017 at 6:09 PM, Karol Herbst <karolherbst@gmail.com> wrote:
>> helps two alien isolation shaders
>>
>> shader-db:
>> total instructions in shared programs : 4251497 -> 4251494 (-0.00%)
>> total gprs used in shared programs    : 513962 -> 513962 (0.00%)
>> total local used in shared programs   : 29797 -> 29797 (0.00%)
>> total bytes used in shared programs   : 38960264 -> 38960232 (-0.00%)
>>
>>                 local        gpr       inst      bytes
>>     helped           0           0           2           2
>>       hurt           0           0           0           0
>>
>> v2: handle potential mods on src0
>>
>> Signed-off-by: Karol Herbst <karolherbst@gmail.com>
>> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
>> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
>> ---
>>  src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>> index 015def0391..82da0d3e48 100644
>> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>> @@ -1284,6 +1284,13 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
>>
>>     case OP_SHL:
>>     {
>> +      if (s == 1 && imm0.isInteger(0)) {
>> +         i->op = i->src(0).mod.getOp();
>> +         if (i->op != OP_CVT)
>> +            i->src(0).mod = 0;
>
> Is this necessary? Presumably if the op != 0, then op == OP_CVT...
>

yeah, no idea. I just thought I do it right when I actually depend on
the getOp magic. But we can't emit any mods to begin with, so maybe we
should just drop the mod handling and be done with it?

>> +         i->setSrc(1, NULL);
>> +         break;
>> +      }
>>        if (s != 1 || i->src(0).mod != Modifier(0))
>>           break;
>>        // try to concatenate shifts
>> --
>> 2.12.2
>>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] nv50/ir: optimize shl(a, 0) to a
       [not found]       ` <CAKb7Uvg2ZxT4JyfeG24BLDTKHXbFuyx=H2tRnQBM63h1k_kJ8Q@mail.gmail.com>
@ 2017-04-30  0:28         ` Ilia Mirkin
       [not found]           ` <CAKb7UvjfCUF2_WN9FrjoZnpX_2K+YwY9_PhPYjH=fOfM2SRN8A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Ilia Mirkin @ 2017-04-30  0:28 UTC (permalink / raw)
  To: Karol Herbst; +Cc: nouveau, mesa-dev


[-- Attachment #1.1: Type: text/plain, Size: 2224 bytes --]

Maybe in a separate change. I'd want to double check on all gens. I think
the thing I suggested is sufficient.

On Apr 29, 2017 8:09 PM, "Karol Herbst" <karolherbst@gmail.com> wrote:

2017-04-30 0:28 GMT+02:00 Ilia Mirkin <imirkin@alum.mit.edu>:
> On Sat, Apr 29, 2017 at 6:09 PM, Karol Herbst <karolherbst@gmail.com>
wrote:
>> helps two alien isolation shaders
>>
>> shader-db:
>> total instructions in shared programs : 4251497 -> 4251494 (-0.00%)
>> total gprs used in shared programs    : 513962 -> 513962 (0.00%)
>> total local used in shared programs   : 29797 -> 29797 (0.00%)
>> total bytes used in shared programs   : 38960264 -> 38960232 (-0.00%)
>>
>>                 local        gpr       inst      bytes
>>     helped           0           0           2           2
>>       hurt           0           0           0           0
>>
>> v2: handle potential mods on src0
>>
>> Signed-off-by: Karol Herbst <karolherbst@gmail.com>
>> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
>> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
>> ---
>>  src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>> index 015def0391..82da0d3e48 100644
>> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>> @@ -1284,6 +1284,13 @@ ConstantFolding::opnd(Instruction *i,
ImmediateValue &imm0, int s)
>>
>>     case OP_SHL:
>>     {
>> +      if (s == 1 && imm0.isInteger(0)) {
>> +         i->op = i->src(0).mod.getOp();
>> +         if (i->op != OP_CVT)
>> +            i->src(0).mod = 0;
>
> Is this necessary? Presumably if the op != 0, then op == OP_CVT...
>

yeah, no idea. I just thought I do it right when I actually depend on
the getOp magic. But we can't emit any mods to begin with, so maybe we
should just drop the mod handling and be done with it?

>> +         i->setSrc(1, NULL);
>> +         break;
>> +      }
>>        if (s != 1 || i->src(0).mod != Modifier(0))
>>           break;
>>        // try to concatenate shifts
>> --
>> 2.12.2
>>

[-- Attachment #1.2: Type: text/html, Size: 3553 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] nv50/ir: optimize shl(a, 0) to a
       [not found]           ` <CAKb7UvjfCUF2_WN9FrjoZnpX_2K+YwY9_PhPYjH=fOfM2SRN8A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-04-30 12:14             ` Karol Herbst
       [not found]               ` <CAKb7Uvi+en__r67VrjV2hfMHTcXSJCXzjhhGekKYei84bKyE5g@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Karol Herbst @ 2017-04-30 12:14 UTC (permalink / raw)
  To: Ilia Mirkin; +Cc: ML nouveau, ML mesa-dev

2017-04-30 2:28 GMT+02:00 Ilia Mirkin <imirkin@alum.mit.edu>:
> Maybe in a separate change. I'd want to double check on all gens. I think
> the thing I suggested is sufficient.
>

well, if I just fixup the op, I kind of have to fix the mod as well.
And if I use getOp, it could also return a OP_CVT, so I have to do the
check.

I don't see how I can only use getOp, but not fixing the mod?

> On Apr 29, 2017 8:09 PM, "Karol Herbst" <karolherbst@gmail.com> wrote:
>
> 2017-04-30 0:28 GMT+02:00 Ilia Mirkin <imirkin@alum.mit.edu>:
>> On Sat, Apr 29, 2017 at 6:09 PM, Karol Herbst <karolherbst@gmail.com>
>> wrote:
>>> helps two alien isolation shaders
>>>
>>> shader-db:
>>> total instructions in shared programs : 4251497 -> 4251494 (-0.00%)
>>> total gprs used in shared programs    : 513962 -> 513962 (0.00%)
>>> total local used in shared programs   : 29797 -> 29797 (0.00%)
>>> total bytes used in shared programs   : 38960264 -> 38960232 (-0.00%)
>>>
>>>                 local        gpr       inst      bytes
>>>     helped           0           0           2           2
>>>       hurt           0           0           0           0
>>>
>>> v2: handle potential mods on src0
>>>
>>> Signed-off-by: Karol Herbst <karolherbst@gmail.com>
>>> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
>>> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
>>> ---
>>>  src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 7 +++++++
>>>  1 file changed, 7 insertions(+)
>>>
>>> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>> b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>> index 015def0391..82da0d3e48 100644
>>> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>> @@ -1284,6 +1284,13 @@ ConstantFolding::opnd(Instruction *i,
>>> ImmediateValue &imm0, int s)
>>>
>>>     case OP_SHL:
>>>     {
>>> +      if (s == 1 && imm0.isInteger(0)) {
>>> +         i->op = i->src(0).mod.getOp();
>>> +         if (i->op != OP_CVT)
>>> +            i->src(0).mod = 0;
>>
>> Is this necessary? Presumably if the op != 0, then op == OP_CVT...
>>
>
> yeah, no idea. I just thought I do it right when I actually depend on
> the getOp magic. But we can't emit any mods to begin with, so maybe we
> should just drop the mod handling and be done with it?
>
>>> +         i->setSrc(1, NULL);
>>> +         break;
>>> +      }
>>>        if (s != 1 || i->src(0).mod != Modifier(0))
>>>           break;
>>>        // try to concatenate shifts
>>> --
>>> 2.12.2
>>>
>
>
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] nv50/ir: optimize shl(a, 0) to a
       [not found]                 ` <CAKb7UvhThjsNh+85-SEvhNHkcmVuuy7itN+6X+DaW2jMM10OVQ@mail.gmail.com>
@ 2017-04-30 14:09                   ` Ilia Mirkin
  0 siblings, 0 replies; 6+ messages in thread
From: Ilia Mirkin @ 2017-04-30 14:09 UTC (permalink / raw)
  To: Karol Herbst; +Cc: nouveau, mesa-dev


[-- Attachment #1.1: Type: text/plain, Size: 2736 bytes --]

On Apr 30, 2017 8:14 AM, "Karol Herbst" <karolherbst@gmail.com> wrote:

2017-04-30 2:28 GMT+02:00 Ilia Mirkin <imirkin@alum.mit.edu>:
> Maybe in a separate change. I'd want to double check on all gens. I think
> the thing I suggested is sufficient.
>

well, if I just fixup the op, I kind of have to fix the mod as well.
And if I use getOp, it could also return a OP_CVT, so I have to do the
check.

I don't see how I can only use getOp, but not fixing the mod?


Perhaps this all doesn't work the way I remember. Will try to look during
the week.


> On Apr 29, 2017 8:09 PM, "Karol Herbst" <karolherbst@gmail.com> wrote:
>
> 2017-04-30 0:28 GMT+02:00 Ilia Mirkin <imirkin@alum.mit.edu>:
>> On Sat, Apr 29, 2017 at 6:09 PM, Karol Herbst <karolherbst@gmail.com>
>> wrote:
>>> helps two alien isolation shaders
>>>
>>> shader-db:
>>> total instructions in shared programs : 4251497 -> 4251494 (-0.00%)
>>> total gprs used in shared programs    : 513962 -> 513962 (0.00%)
>>> total local used in shared programs   : 29797 -> 29797 (0.00%)
>>> total bytes used in shared programs   : 38960264 -> 38960232 (-0.00%)
>>>
>>>                 local        gpr       inst      bytes
>>>     helped           0           0           2           2
>>>       hurt           0           0           0           0
>>>
>>> v2: handle potential mods on src0
>>>
>>> Signed-off-by: Karol Herbst <karolherbst@gmail.com>
>>> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
>>> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
>>> ---
>>>  src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 7 +++++++
>>>  1 file changed, 7 insertions(+)
>>>
>>> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>> b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>> index 015def0391..82da0d3e48 100644
>>> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>> @@ -1284,6 +1284,13 @@ ConstantFolding::opnd(Instruction *i,
>>> ImmediateValue &imm0, int s)
>>>
>>>     case OP_SHL:
>>>     {
>>> +      if (s == 1 && imm0.isInteger(0)) {
>>> +         i->op = i->src(0).mod.getOp();
>>> +         if (i->op != OP_CVT)
>>> +            i->src(0).mod = 0;
>>
>> Is this necessary? Presumably if the op != 0, then op == OP_CVT...
>>
>
> yeah, no idea. I just thought I do it right when I actually depend on
> the getOp magic. But we can't emit any mods to begin with, so maybe we
> should just drop the mod handling and be done with it?
>
>>> +         i->setSrc(1, NULL);
>>> +         break;
>>> +      }
>>>        if (s != 1 || i->src(0).mod != Modifier(0))
>>>           break;
>>>        // try to concatenate shifts
>>> --
>>> 2.12.2
>>>
>
>

[-- Attachment #1.2: Type: text/html, Size: 4751 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-04-30 14:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-29 22:09 [PATCH v2] nv50/ir: optimize shl(a, 0) to a Karol Herbst
     [not found] ` <20170429220934.3355-1-karolherbst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-29 22:28   ` Ilia Mirkin
2017-04-30  0:04     ` Karol Herbst
     [not found]       ` <CAKb7Uvg2ZxT4JyfeG24BLDTKHXbFuyx=H2tRnQBM63h1k_kJ8Q@mail.gmail.com>
2017-04-30  0:28         ` Ilia Mirkin
     [not found]           ` <CAKb7UvjfCUF2_WN9FrjoZnpX_2K+YwY9_PhPYjH=fOfM2SRN8A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-30 12:14             ` Karol Herbst
     [not found]               ` <CAKb7Uvi+en__r67VrjV2hfMHTcXSJCXzjhhGekKYei84bKyE5g@mail.gmail.com>
     [not found]                 ` <CAKb7UvhThjsNh+85-SEvhNHkcmVuuy7itN+6X+DaW2jMM10OVQ@mail.gmail.com>
2017-04-30 14:09                   ` Ilia Mirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.