[Mesa-dev] [PATCH 2/2] gm200/ir: optimize rcp(sqrt) to rsq
Ilia Mirkin
imirkin at alum.mit.edu
Sat Aug 4 03:27:35 UTC 2018
With the minor fix in 1/2, this series is
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
On Fri, Aug 3, 2018 at 10:52 PM, Karol Herbst <kherbst at redhat.com> wrote:
> mitigates hurt shaders after adding sqrt:
> total instructions in shared programs : 5456166 -> 5454825 (-0.02%)
> total gprs used in shared programs : 647522 -> 647551 (0.00%)
> total shared used in shared programs : 389120 -> 389120 (0.00%)
> total local used in shared programs : 21064 -> 21064 (0.00%)
> total bytes used in shared programs : 58288696 -> 58274448 (-0.02%)
>
> local shared gpr inst bytes
> helped 0 0 0 516 516
> hurt 0 0 27 2 2
>
> Signed-off-by: Karol Herbst <kherbst at redhat.com>
> ---
> .../drivers/nouveau/codegen/nv50_ir_peephole.cpp | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> index 16022e6f237..2f7cc206b84 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> @@ -1848,15 +1848,24 @@ AlgebraicOpt::handleMINMAX(Instruction *minmax)
> }
> }
>
> +// rcp(rcp(a)) = a
> +// rcp(sqrt(a)) = rsq(a)
> void
> AlgebraicOpt::handleRCP(Instruction *rcp)
> {
> Instruction *si = rcp->getSrc(0)->getUniqueInsn();
>
> - if (si && si->op == OP_RCP) {
> + if (!si)
> + return;
> +
> + if (si->op == OP_RCP) {
> Modifier mod = rcp->src(0).mod * si->src(0).mod;
> rcp->op = mod.getOp();
> rcp->setSrc(0, si->getSrc(0));
> + } else if (si->op == OP_SQRT) {
> + rcp->op = OP_RSQ;
> + rcp->setSrc(0, si->getSrc(0));
> + rcp->src(0).mod = rcp->src(0).mod * si->src(0).mod;
> }
> }
>
> --
> 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