[Beignet] [PATCH] Fix a long DIV/REM hang.
Yang, Rong R
rong.r.yang at intel.com
Sun Feb 23 20:33:43 PST 2014
I also found it, and I think the all16/all8 jump just a optimization, and introduce a or with notemask, also have some cost, so I don't add it.
What's your mind?
-----Original Message-----
From: Zhigang Gong [mailto:zhigang.gong at linux.intel.com]
Sent: Friday, February 21, 2014 4:01 PM
To: Yang, Rong R
Cc: beignet at lists.freedesktop.org
Subject: Re: [Beignet] [PATCH] Fix a long DIV/REM hang.
Good catch, will push latter, thanks.
I also found some JMPI in other long instructions in gen_context.cpp which are using ALL16/ALL8. Could you also check those use cases?
I believe they also need to be fixed. Thanks.
On Fri, Feb 21, 2014 at 04:54:39PM +0800, Yang Rong wrote:
> There is a jumpi in long DIV/REM, with predication is any16/any8. So
> MUST AND the predication register with emask, otherwise may dead loop.
>
> Signed-off-by: Yang Rong <rong.r.yang at intel.com>
> ---
> backend/src/backend/gen_context.cpp | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/backend/src/backend/gen_context.cpp
> b/backend/src/backend/gen_context.cpp
> index 7a74856..44dbee2 100644
> --- a/backend/src/backend/gen_context.cpp
> +++ b/backend/src/backend/gen_context.cpp
> @@ -1364,6 +1364,7 @@ namespace gbe
> GenRegister l = ra->genReg(insn.dst(12));
> GenRegister m = ra->genReg(insn.dst(13));
> GenRegister flagReg =
> checkFlagRegister(ra->genReg(insn.dst(14)));
> + GenRegister emaskReg =
> + ra->genReg(GenRegister::uw1grf(ir::ocl::emask));
> GenRegister zero = GenRegister::immud(0),
> one = GenRegister::immud(1),
> imm31 = GenRegister::immud(31); @@ -1445,6 +1446,11
> @@ namespace gbe
> p->curr.predicate = GEN_PREDICATE_NONE;
> p->curr.useFlag(flagReg.flag_nr(), flagReg.flag_subnr());
> p->CMP(GEN_CONDITIONAL_L, m, GenRegister::immud(64));
> +
> + p->curr.execWidth = 1;
> + p->curr.noMask = 1;
> + p->AND(flagReg, flagReg, emaskReg);
> +
> p->curr.predicate = GEN_PREDICATE_NORMAL;
> // under condition, jump back to start point
> if (simdWidth == 8)
> @@ -1453,8 +1459,6 @@ namespace gbe
> p->curr.predicate = GEN_PREDICATE_ALIGN1_ANY16H;
> else
> NOT_IMPLEMENTED;
> - p->curr.execWidth = 1;
> - p->curr.noMask = 1;
> int jip = -(int)(p->n_instruction() - loop_start + 1) * 2;
> p->JMPI(zero);
> p->patchJMPI(p->n_instruction()-2, jip);
> --
> 1.8.3.2
>
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list