[Beignet] [PATCH] Add the logic for pack/unpack long for scalar.
Yang, Rong R
rong.r.yang at intel.com
Thu Jan 29 18:17:44 PST 2015
Hi Junyan,
Can't apply this patch, can you rebase it?
> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> Zhigang Gong
> Sent: Tuesday, January 27, 2015 16:28
> To: junyan.he at inbox.com
> Cc: Junyan He; beignet at lists.freedesktop.org
> Subject: Re: [Beignet] [PATCH] Add the logic for pack/unpack long for scalar.
>
> Rong, could you review this patch and verify it on your BDW machine. Thanks.
>
> On Tue, Jan 27, 2015 at 10:53:22AM +0800, junyan.he at inbox.com wrote:
> > From: Junyan He <junyan.he at linux.intel.com>
> >
> > Sometimes, such as printf the kernel's long type parameter, the scalar
> > register will also need to be pack/unpack.
> >
> > Signed-off-by: Junyan He <junyan.he at linux.intel.com>
> > ---
> > backend/src/backend/gen8_context.cpp | 94
> > ++++++++++++++++++++++--------------
> > 1 file changed, 59 insertions(+), 35 deletions(-)
> >
> > diff --git a/backend/src/backend/gen8_context.cpp
> > b/backend/src/backend/gen8_context.cpp
> > index 07f8c47..cde87de 100644
> > --- a/backend/src/backend/gen8_context.cpp
> > +++ b/backend/src/backend/gen8_context.cpp
> > @@ -618,60 +618,84 @@ namespace gbe
> >
> > void Gen8Context::packLongVec(GenRegister unpacked, GenRegister
> packed, uint32_t simd)
> > {
> > + bool isScalar = false;
> > + if (unpacked.hstride == GEN_HORIZONTAL_STRIDE_0)
> > + isScalar = true;
> > +
> > GBE_ASSERT(packed.subnr == 0);
> > - GBE_ASSERT(unpacked.subnr == 0);
> > + GBE_ASSERT(packed.hstride != GEN_HORIZONTAL_STRIDE_0);
> > + GBE_ASSERT(unpacked.subnr == 0 || isScalar);
> >
> > unpacked = GenRegister::retype(unpacked, GEN_TYPE_UD);
> > packed = GenRegister::retype(packed, GEN_TYPE_UD);
> >
> > - if (simd == 16) {
> > - p->push();
> > - p->curr.execWidth = 8;
> > - p->MOV(GenRegister::h2(packed), unpacked);
> > - p->MOV(GenRegister::h2(GenRegister::offset(packed, 0,
> typeSize(GEN_TYPE_UD))),
> > - GenRegister::offset(unpacked, 2));
> > - p->curr.quarterControl = 1;
> > - p->MOV(GenRegister::h2(GenRegister::offset(packed, 2, 0)),
> GenRegister::offset(unpacked, 1));
> > - p->MOV(GenRegister::h2(GenRegister::offset(packed, 2,
> typeSize(GEN_TYPE_UD))),
> > - GenRegister::offset(unpacked, 3));
> > - p->pop();
> > + if (isScalar) {
> > + p->MOV(packed, unpacked);
> > } else {
> > - GBE_ASSERT(simd == 8);
> > - p->MOV(GenRegister::h2(packed), unpacked);
> > - p->MOV(GenRegister::h2(GenRegister::offset(packed, 0,
> typeSize(GEN_TYPE_UD))),
> > - GenRegister::offset(unpacked, 1));
> > + if (simd == 16) {
> > + p->push();
> > + p->curr.execWidth = 8;
> > + p->MOV(GenRegister::h2(packed), unpacked);
> > + p->MOV(GenRegister::h2(GenRegister::offset(packed, 0,
> typeSize(GEN_TYPE_UD))),
> > + GenRegister::offset(unpacked, 2));
> > + p->curr.quarterControl = 1;
> > + p->MOV(GenRegister::h2(GenRegister::offset(packed, 2, 0)),
> GenRegister::offset(unpacked, 1));
> > + p->MOV(GenRegister::h2(GenRegister::offset(packed, 2,
> typeSize(GEN_TYPE_UD))),
> > + GenRegister::offset(unpacked, 3));
> > + p->pop();
> > + } else {
> > + GBE_ASSERT(simd == 8);
> > + p->MOV(GenRegister::h2(packed), unpacked);
> > + p->MOV(GenRegister::h2(GenRegister::offset(packed, 0,
> typeSize(GEN_TYPE_UD))),
> > + GenRegister::offset(unpacked, 1));
> > + }
> > }
> > }
> >
> > void Gen8Context::unpackLongVec(GenRegister packed, GenRegister
> unpacked, uint32_t simd)
> > {
> > - GBE_ASSERT(packed.subnr == 0);
> > + bool isScalar = false;
> > + if (packed.hstride == GEN_HORIZONTAL_STRIDE_0)
> > + isScalar = true;
> > +
> > + GBE_ASSERT(packed.subnr == 0 || isScalar);
> > + GBE_ASSERT(unpacked.hstride != GEN_HORIZONTAL_STRIDE_0);
> > GBE_ASSERT(unpacked.subnr == 0);
> >
> > unpacked = GenRegister::retype(unpacked, GEN_TYPE_UD);
> > packed = GenRegister::retype(packed, GEN_TYPE_UD);
> >
> > - packed.vstride = GEN_VERTICAL_STRIDE_8;
> > - packed.width = GEN_WIDTH_4;
> > -
> > - p->push();
> > - p->curr.execWidth = 8;
> > - if (simd == 16) {
> > - p->MOV(unpacked, GenRegister::h2(packed));
> > - p->MOV(GenRegister::offset(unpacked, 2),
> > - GenRegister::h2(GenRegister::offset(packed, 0,
> typeSize(GEN_TYPE_UD))));
> > + if (isScalar) {
> > + p->MOV(unpacked, packed);
> >
> > - p->curr.quarterControl = 1;
> > - p->MOV(GenRegister::offset(unpacked, 1),
> GenRegister::h2(GenRegister::offset(packed, 2)));
> > - p->MOV(GenRegister::offset(unpacked, 3),
> > - GenRegister::h2(GenRegister::offset(packed, 2,
> typeSize(GEN_TYPE_UD))));
> > + if (simd == 16) {
> > + p->MOV(GenRegister::offset(unpacked, 2),
> GenRegister::offset(packed, 0, typeSize(GEN_TYPE_UD)));
> > + } else {
> > + p->MOV(GenRegister::offset(unpacked, 1),
> GenRegister::offset(packed, 0, typeSize(GEN_TYPE_UD)));
> > + }
> > } else {
> > - GBE_ASSERT(simd == 8);
> > - p->MOV(unpacked, GenRegister::h2(packed));
> > - p->MOV(GenRegister::offset(unpacked, 1),
> > - GenRegister::h2(GenRegister::offset(packed, 0,
> typeSize(GEN_TYPE_UD))));
> > + packed.vstride = GEN_VERTICAL_STRIDE_8;
> > + packed.width = GEN_WIDTH_4;
> > +
> > + p->push();
> > + p->curr.execWidth = 8;
> > + if (simd == 16) {
> > + p->MOV(unpacked, GenRegister::h2(packed));
> > + p->MOV(GenRegister::offset(unpacked, 2),
> > + GenRegister::h2(GenRegister::offset(packed, 0,
> > + typeSize(GEN_TYPE_UD))));
> > +
> > + p->curr.quarterControl = 1;
> > + p->MOV(GenRegister::offset(unpacked, 1),
> GenRegister::h2(GenRegister::offset(packed, 2)));
> > + p->MOV(GenRegister::offset(unpacked, 3),
> > + GenRegister::h2(GenRegister::offset(packed, 2,
> typeSize(GEN_TYPE_UD))));
> > + } else {
> > + GBE_ASSERT(simd == 8);
> > + p->MOV(unpacked, GenRegister::h2(packed));
> > + p->MOV(GenRegister::offset(unpacked, 1),
> > + GenRegister::h2(GenRegister::offset(packed, 0,
> typeSize(GEN_TYPE_UD))));
> > + }
> > + p->pop();
> > }
> > - p->pop();
> > }
> >
> > void Gen8Context::emitRead64Instruction(const SelectionInstruction
> > &insn)
> > --
> > 1.9.1
> >
> > _______________________________________________
> > Beignet mailing list
> > Beignet at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/beignet
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list