nv50/ir: optimize shl(a, 0) to a
PATCH v2 1/1 nv50/ir: optimize shl(a, 0) to a
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
--- src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 7 +++++++ 1 file changed, 7 insertions(+)
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +7 -0
@@ -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
Signature · 6 lines
2.12.2 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 20170429220934.3355-1-karolherbst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 26 lines · Karol Herbst
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 0v2: handle potential mods on src0
Signed-off-by Karol Herbst <[email protected]>Reviewed-by Samuel Pitoiset <[email protected]>Reviewed-by Ilia Mirkin <[email protected]>--- src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 7 +++++++ 1 file changed, 7 insertions(+)src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +0
-0
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s) · line 1290
Quoted 7 lines
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +4
-0@@ -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...
Quoted 9 lines
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +3
-1+ 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
2017-04-30 0:28 GMT+02:00 Ilia Mirkin <[email protected]>:
Quoted 28 lines · Karol Herbst
Quoted 27 lines
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 0v2: handle potential mods on src0
Signed-off-by Karol Herbst <[email protected]>Reviewed-by Samuel Pitoiset <[email protected]>Reviewed-by Ilia Mirkin <[email protected]>--- src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 7 +++++++ 1 file changed, 7 insertions(+)src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +0
-0@@ -1284,6 +1284,13 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
Quoted 9 lines
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s) · line 1290
Quoted 6 lines
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +4
-0case 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?
Quoted 9 lines
Quoted 9 lines
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +3
-1+ 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
A message that is not in the archive (sent off-list or not yet received): CAKb7Uvg2ZxT4JyfeG24BLDTKHXbFuyx=H2tRnQBM63h1k_kJ8Q@mail.gmail.com
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" <[email protected]> wrote:
2017-04-30 0:28 GMT+02:00 Ilia Mirkin <[email protected]>:
Quoted 1 line
On Sat, Apr 29, 2017 at 6:09 PM, Karol Herbst <[email protected]>
Quoted 14 lines · wrote:
Quoted 14 lines
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 0v2: handle potential mods on src0
Quoted 8 lines
Review
Quoted 8 lines
Signed-off-by Karol Herbst <[email protected]>Reviewed-by Samuel Pitoiset <[email protected]>Reviewed-by Ilia Mirkin <[email protected]>--- src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 7 +++++++ 1 file changed, 7 insertions(+)(quoted diff) +0
-0
b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
Quoted 4 lines
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp ConstantFolding::opnd(Instruction *i,
Quoted 4 lines
index
015def0391..82da0d3e48100644src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +0
-0@@ -1284,6 +1284,13 @@ ConstantFolding::opnd(Instruction *i,
ImmediateValue &imm0, int s)
Quoted 10 lines
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s) · line 1290
Quoted 7 lines
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +4
-0case 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?
Quoted 9 lines
Quoted 9 lines
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +3
-1+ 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
A message that is not in the archive (sent off-list or not yet received): CAKb7UvjfCUF2_WN9FrjoZnpX_2K+YwY9_PhPYjH=fOfM2SRN8A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
2017-04-30 2:28 GMT+02:00 Ilia Mirkin <[email protected]>:
Quoted 3 lines
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?
Quoted 44 lines · Karol Herbst
2017-04-30 0:28 GMT+02:00 Ilia Mirkin <[email protected]>:
Quoted 31 lines
Quoted 29 lines · Karol Herbst
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 0v2: handle potential mods on src0
Signed-off-by Karol Herbst <[email protected]>Reviewed-by Samuel Pitoiset <[email protected]>Reviewed-by Ilia Mirkin <[email protected]>--- src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 7 +++++++ 1 file changed, 7 insertions(+)src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +0
-0@@ -1284,6 +1284,13 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)Quoted 9 lines
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp ConstantFolding::opnd(Instruction *i, · line 1291
Quoted 6 lines
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +4
-0case 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...
Quoted 15 lines
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?
Quoted 9 lines
Quoted 9 lines
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +3
-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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): CAKb7Uvi+en__r67VrjV2hfMHTcXSJCXzjhhGekKYei84bKyE5g@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): CAKb7UvhThjsNh+85-SEvhNHkcmVuuy7itN+6X+DaW2jMM10OVQ@mail.gmail.com
On Apr 30, 2017 8:14 AM, "Karol Herbst" <[email protected]> wrote:
2017-04-30 2:28 GMT+02:00 Ilia Mirkin <[email protected]>:
Quoted 3 lines
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.
Quoted 44 lines · Karol Herbst
2017-04-30 0:28 GMT+02:00 Ilia Mirkin <[email protected]>:
Quoted 31 lines
Quoted 29 lines · Karol Herbst
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 0v2: handle potential mods on src0
Signed-off-by Karol Herbst <[email protected]>Reviewed-by Samuel Pitoiset <[email protected]>Reviewed-by Ilia Mirkin <[email protected]>--- src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 7 +++++++ 1 file changed, 7 insertions(+)src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +0
-0@@ -1284,6 +1284,13 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)Quoted 9 lines
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp ConstantFolding::opnd(Instruction *i, · line 1291
Quoted 6 lines
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +4
-0case 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...
Quoted 15 lines
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?
Quoted 9 lines
Quoted 9 lines
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +3
-0+ 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev