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

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

Signed-off-by: Karol Herbst <karolherbst@gmail.com>
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 5 +++++
 1 file changed, 5 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..a2446e4df8 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -1284,6 +1284,11 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
 
    case OP_SHL:
    {
+      if (s == 1 && imm0.isInteger(0)) {
+         i->op = OP_MOV;
+         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 related	[flat|nested] 4+ messages in thread

* Re: [PATCH] nv50/ir: optimmize shl(a, 0) to a
       [not found] ` <20170429164604.3263-1-karolherbst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-04-29 16:49   ` Samuel Pitoiset
  2017-04-29 19:03   ` Ilia Mirkin
  1 sibling, 0 replies; 4+ messages in thread
From: Samuel Pitoiset @ 2017-04-29 16:49 UTC (permalink / raw)
  To: Karol Herbst, mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

"optimmize" ? No need to resend just for that though.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>

On 04/29/2017 06:46 PM, Karol Herbst 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
> 
> Signed-off-by: Karol Herbst <karolherbst@gmail.com>
> ---
>   src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 5 +++++
>   1 file changed, 5 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..a2446e4df8 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> @@ -1284,6 +1284,11 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
>   
>      case OP_SHL:
>      {
> +      if (s == 1 && imm0.isInteger(0)) {
> +         i->op = OP_MOV;
> +         i->setSrc(1, NULL);
> +         break;
> +      }
>         if (s != 1 || i->src(0).mod != Modifier(0))
>            break;
>         // try to concatenate shifts
> 
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

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

* Re: [PATCH] nv50/ir: optimmize shl(a, 0) to a
       [not found] ` <20170429164604.3263-1-karolherbst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-04-29 16:49   ` Samuel Pitoiset
@ 2017-04-29 19:03   ` Ilia Mirkin
  2017-04-29 20:19     ` Karol Herbst
  1 sibling, 1 reply; 4+ messages in thread
From: Ilia Mirkin @ 2017-04-29 19:03 UTC (permalink / raw)
  To: Karol Herbst
  Cc: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

On Sat, Apr 29, 2017 at 12:46 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
>
> Signed-off-by: Karol Herbst <karolherbst@gmail.com>
> ---
>  src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 5 +++++
>  1 file changed, 5 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..a2446e4df8 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> @@ -1284,6 +1284,11 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
>
>     case OP_SHL:
>     {
> +      if (s == 1 && imm0.isInteger(0)) {
> +         i->op = OP_MOV;
> +         i->setSrc(1, NULL);
> +         break;
> +      }
>        if (s != 1 || i->src(0).mod != Modifier(0))
>           break;

Interesting. This suggests that src(0) may have modifiers, although I
can't imagine what that'd be. Perhaps it can take a neg? In that case,
you need to fix the OP_MOV above -- should probably do it anyways,
i.e. i->op = i->src(0).mod.getOp() or something. With that, this is

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>

Separately, I just noticed that we don't appear to have any 0 << x or
0 >> y or EXTBF or anything like that. I doubt it comes up too often
though.

>        // 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] 4+ messages in thread

* Re: [PATCH] nv50/ir: optimmize shl(a, 0) to a
  2017-04-29 19:03   ` Ilia Mirkin
@ 2017-04-29 20:19     ` Karol Herbst
  0 siblings, 0 replies; 4+ messages in thread
From: Karol Herbst @ 2017-04-29 20:19 UTC (permalink / raw)
  To: Ilia Mirkin; +Cc: mesa-dev@lists.freedesktop.org, nouveau@lists.freedesktop.org

2017-04-29 21:03 GMT+02:00 Ilia Mirkin <imirkin@alum.mit.edu>:
> On Sat, Apr 29, 2017 at 12:46 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
>>
>> Signed-off-by: Karol Herbst <karolherbst@gmail.com>
>> ---
>>  src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 5 +++++
>>  1 file changed, 5 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..a2446e4df8 100644
>> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>> @@ -1284,6 +1284,11 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
>>
>>     case OP_SHL:
>>     {
>> +      if (s == 1 && imm0.isInteger(0)) {
>> +         i->op = OP_MOV;
>> +         i->setSrc(1, NULL);
>> +         break;
>> +      }
>>        if (s != 1 || i->src(0).mod != Modifier(0))
>>           break;
>
> Interesting. This suggests that src(0) may have modifiers, although I
> can't imagine what that'd be. Perhaps it can take a neg? In that case,
> you need to fix the OP_MOV above -- should probably do it anyways,
> i.e. i->op = i->src(0).mod.getOp() or something. With that, this is
>

I looked through the emitter and there seem to be no flags. Envydis
and nvdisasm seem to think the same.
Will fix it up nethertheless.

> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
>
> Separately, I just noticed that we don't appear to have any 0 << x or
> 0 >> y or EXTBF or anything like that. I doubt it comes up too often
> though.
>
>>        // 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] 4+ messages in thread

end of thread, other threads:[~2017-04-29 20:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-29 16:46 [PATCH] nv50/ir: optimmize shl(a, 0) to a Karol Herbst
     [not found] ` <20170429164604.3263-1-karolherbst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-29 16:49   ` Samuel Pitoiset
2017-04-29 19:03   ` Ilia Mirkin
2017-04-29 20:19     ` Karol Herbst

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.